/* Standalone program to estimate the sensitivity of a pulsar timing array to a gravitational wave background. Based on Verbiest et al., MNRAS 2009 and arXiv:0906.4246 (Ph.D. Thesis) Joris P.W. Verbiest, MPIfR, 12 Feb 2010 */ /* 26 April 2010: Added in self-noise as explained by KJ Lee. */ // g++ -o PTAS PTASens.C -Wall #include #include #include #include #include #include using namespace std; #define MAX_NPSR 60 int verb = 0; void GetCoordinates(char *Name,long double *dec,long double *RA); long double GetHD(char *Name1,char *Name2); void help(); int main(int argc,char *argv[]){ int ct; // generic counter char infile[100]="Standard.dat"; char outfile[100]="Sensitivity.dat"; long double alpha = -2.0/3.0; long double minAmp=1e-16,maxAmp=1e-11; int Namp=300; // Get Essential Data from the Command Line for(ct = 1;ct Sens; int sensCt=0; long double AmpIncrease = (log10(maxAmp)-log10(minAmp))/(long double)(Namp-1); // Loop over the GWB Amplitudes for(LogAmp=log10(minAmp);LogAmpFNyq[ct]) FCorn[ct] = FNyq[ct]; SigNSq[ct] = 0.0; SigGSq[ct] = 0.0; // Determine the integrated Noise and GW power spectra: for(Freq = 1.0/Tspan[ct];Freq<=FNyq[ct];Freq+=1.0/Tspan[ct]){ //SigNSq[ct] += pow(Freq/FCorn[ct],2.0*alpha-3.0) // /pow(1+pow(Freq/FCorn[ct],2.0*alpha-3.0),2.0); SigNSq[ct] += pow(Freq/FCorn[ct],2.0*alpha-3.0) /pow(1.0+pow(Freq/FCorn[ct],2.0*alpha-3.0),2.0)+ pow(Freq/FCorn[ct],4.0*alpha-6.0) /pow(1.0+pow(Freq/FCorn[ct],2.0*alpha-3.0),2.0); //SigGSq[ct] += pow(Freq/FCorn[ct],4.0*alpha-6.0) // /pow(1+pow(Freq/FCorn[ct],2.0*alpha-3.0),2.0); SigGSq[ct] += pow(Freq/FCorn[ct],4.0*alpha-6.0) /pow(1.0+pow(Freq/FCorn[ct],2.0*alpha-3.0),2.0); } // Only the fraction of these comes up in the Sensitivity Equation: SigFrac[ct] = SigNSq[ct]/SigGSq[ct]; } // Now loop over the pulsar pairs to add up the sensitivity: Sens.push_back(0.0); for(pct1=0;pct120) cout << "Right ascension: " << *RA << " hours: " << hours << endl; // Declination: int PosNeg = 1; if(Name[++xtra]=='-') PosNeg = -1; else if(Name[xtra]!='+') cout << "Don't understand declination sign in Name: " << Name << endl; *dec = 0.0; long double degrees = 0.0; temp = (long double)(Name[++xtra]-'0'); degrees += 10.0*temp; temp = (long double)(Name[++xtra]-'0'); degrees += temp; if(length>8){ temp = (long double)(Name[++xtra]-'0'); degrees += temp/6.0; temp = (long double)(Name[++xtra]-'0'); degrees += temp/60.0; } degrees *= (long double)PosNeg; *dec = degrees/180.0*M_PI; if(verb>20) cout << "Declination: " << *dec << " degrees: " << degrees << endl; } void help(){ cout << " _______________________________________________________________\n"; cout << "/PTAS - a standalone program to estimate PTA sensitivity \\\n" << "| curves. |\n"; cout << "| |\n"; cout << "| USAGE and defaults: |\n" << "| PTAS -h -file Standard.dat -alpha -0.66666 -minAmp 1e-16 |\n" << "| -maxAmp 1e-11 -namp 300 |\n" << "| -outfile Sensitivity.dat |\n" << "| |\n"; cout << "| OPTIONS: |\n" << "| -h : this help information |\n" << "| -file : input filename (see notes below) |\n" << "| -outfile: output filename (see notes below) |\n" << "| -alpha : GWB spectral index (default -2/3) |\n" << "| -minAmp : minimum GWB amplitude |\n" << "| -maxAmp : maximum GWB amplitude |\n" << "| -namp : number of GWB amplitudes |\n"; cout << "| NOTES: |\n" << "| -file: The input file must contain a four-column line |\n" << "| for each pulsar of the PTA. The four columns must|\n" << "| contain respectively: |\n" << "| 1: the pulsar name |\n" << "| 2: the timing rms in seconds |\n" << "| 3: the data span in years |\n" << "| 4: the number of TOAs. |\n" << "| |\n" << "| -outfile: The outfile will contain two columns: |\n" << "| 1: the GWB amplitude |\n" << "| 2: the PTA sensitivity. |\n"; cout << "| Have a nice day! |\n" << "\\_______________________________________________" <<"________________/\n"; }