373#include <lal/LALgetopt.h>
374#include <lal/LIGOLwXML.h>
375#include <lal/LIGOLwXMLRead.h>
376#include <lal/LIGOMetadataTables.h>
377#include <lal/LIGOMetadataUtils.h>
378#include <lal/LIGOMetadataInspiralUtils.h>
379#include <lal/Random.h>
380#include <lal/AVFactories.h>
381#include <lal/InspiralInjectionParams.h>
382#include <lal/LALDetectors.h>
383#include <lal/LALSimulation.h>
384#include <lal/RingUtils.h>
386#include <lal/LALDatatypes.h>
387#include <lal/FrequencySeries.h>
391#define CVS_REVISION "$Revision$"
392#define CVS_ID_STRING "$Id$"
393#define CVS_SOURCE "$Source$"
394#define CVS_DATE "$Date$"
395#define CVS_NAME_STRING "$Name$"
396#define PROGRAM_NAME "inspinj"
398#define ADD_PROCESS_PARAM( pptype, format, ppvalue ) \
399 this_proc_param = this_proc_param->next = (ProcessParamsTable *) \
400calloc( 1, sizeof(ProcessParamsTable) ); \
401snprintf( this_proc_param->program, LIGOMETA_PROGRAM_MAX, "%s", \
403snprintf( this_proc_param->param, LIGOMETA_PARAM_MAX, "--%s", \
404 long_options[option_index].name ); \
405snprintf( this_proc_param->type, LIGOMETA_TYPE_MAX, "%s", pptype ); \
406snprintf( this_proc_param->value, LIGOMETA_VALUE_MAX, format, ppvalue );
409#define UNUSED __attribute__ ((unused))
423 const char *fmt, ... );
435 REAL8 *declination );
609 pz = -0.000429072589677+(rshift*(-0.036349728568888+(rshift*(0.860892111762314
610 +(rshift*(-0.740935488674010+rshift*(0.265848831356864+rshift*(-0.050041573542298
611 +rshift*(0.005184554232421+rshift*(-0.000281450045300+rshift*0.000006400690921))))))))));
620 dL = -2.89287707063171+(rshift*(4324.33492012756+(rshift*(3249.74193862773
621 +(rshift*(-1246.66339928289+rshift*(335.354613407693+rshift*(-56.1194965448065
622 +rshift*(5.20261234121263+rshift*(-0.203151569744028))))))))));
629 REAL8 logzmax,loglambda,step;
632 loglambda = -0.039563*pow(logzmax,6.)-0.15282*pow(logzmax,5.)-0.017596*pow(logzmax,4.)
633 + 0.67193*pow(logzmax,3.)+1.1347*pow(logzmax,2.)-2.3543*logzmax+ 2.0228;
634 step=pow(10.,loglambda)/rate_local;
677 tempStrain->
data = NULL;
688 REAL8 snr_total = 0.0;
692 strcpy(tmp, ifo_list);
694 ifo = strtok (tmp,
",");
698 snr_total += this_snr * this_snr;
699 ifo = strtok (NULL,
",");
704 return sqrt(snr_total);
711 REAL8 UNUSED low_snr, UNUSED high_snr;
712 REAL8 low_dist,high_dist;
716 if (this_snr > target_snr)
721 while (this_snr > target_snr)
723 inj-> distance = inj->
distance * 3.0;
732 while (this_snr < target_snr)
741 while ( fabs(target_snr - this_snr) > 1.0 )
743 inj->
distance = (high_dist + low_dist) / 2.0;
746 if (this_snr > target_snr)
784 REAL8 snr_total = 0.0;
788 strcpy(tmp, ifo_list);
789 ifo = strtok (tmp,
",");
794 snr_total += this_snr * this_snr;
795 ifo = strtok (NULL,
",");
800 return sqrt(snr_total);
807 const char *ifo_list)
811 REAL8 UNUSED low_snr, UNUSED high_snr;
812 REAL8 low_dist,high_dist;
816 if (this_snr > target_snr)
821 while (this_snr > target_snr)
823 inj-> distance = inj->
distance * 3.0;
834 while (this_snr < target_snr)
843 while ( fabs(target_snr - this_snr) > 1.0 )
845 inj->
distance = (high_dist + low_dist) / 2.0;
848 if (this_snr > target_snr)
886 const char **ifo_list,
891 REAL8 snr_total = 0.0;
894 for (
i=0;
i< num_ifos;
i++)
897 snr_total += this_snr * this_snr;
900 return sqrt(snr_total);
907 const char **ifo_list,
925 const char *fmt, ... )
929 pp = calloc( 1,
sizeof( *
pp ) );
932 perror(
"next_process_param" );
953 "The following options are recognized. Options not surrounded in []\n"\
954 "are required. Defaults are shown in brackets\n",
program );
956 " [--help ] display this message\n"\
957 " [--verbose] print progress information\n"\
958 " [--user-tag] usertag set the usertag \n"\
959 " [--output ] name overwrite the standard file naming convention\n"\
960 " [--write-compress] write a compressed xml file\n\n");\
962 "Waveform details:\n"\
963 " [--seed] randomSeed seed for random number generator (default : 1)\n"\
964 " --f-lower freq lower cut-off frequency.\n"\
965 " --waveform wfm set waveform type to wfm\n"\
966 " --amp-order set PN order in amplitude\n\n");
968 "Time distribution information:\n"\
969 " --gps-start-time start GPS start time for injections\n"\
970 " --gps-end-time end GPS end time for injections\n"\
971 " --ipn-gps-time IPNtime GPS end time for IPN trigger\n"\
972 " --t-distr timeDist set the time step distribution of injections\n"\
973 " fixed: fixed time step\n"\
974 " uniform: uniform distribution\n"\
975 " exponential: exponential distribution for Poisson process\n"\
976 " [--time-step] step space injections by average of step seconds\n"\
977 " (suggestion : 2630 / pi seconds)\n"\
978 " [--time-interval] int distribute injections in an interval, int s\n"\
979 " (default : 0 seconds)\n\n");
981 "Source distribution information:\n"\
982 " --l-distr locDist set the source location distribution,\n"\
983 " locDist must be one of:\n"\
984 " source: use locations from source-file\n"\
985 " exttrig: use external trigger file\n"\
986 " random: uses random locations\n"\
987 " fixed: set fixed location\n"\
988 " ipn: random locations from IPN skypoints\n"\
989 " [--longitude] longitude read longitude if fixed value (degrees)\n"
990 " [--latitude] latitude read latitude if fixed value (degrees)\n"
991 " [--d-distr] distDist use a distribution over physical distance\n"\
992 " source: take distance from galaxy source file\n"\
993 " uniform: uniform distribution in distance\n"\
994 " distancesquared: uniform distribution in distance^2\n"\
995 " log10: uniform distribution in log10(d) \n"\
996 " volume: uniform distribution in volume\n"\
997 " sfr: distribution derived from the SFR\n"\
998 " [--min-distance] DMIN set the minimum (chirp) distance to DMIN kpc\n"\
999 " [--max-distance] DMAX set the maximum (chirp) distance to DMAX kpc\n"\
1000 " min/max distance required if d-distr not 'source'\n"\
1001 " [--source-file] sources read source parameters from sources\n"\
1002 " requires enable/disable milkyway\n"\
1003 " [--sourcecomplete] distance \n"
1004 " complete galaxy catalog out to distance (kPc)\n"\
1005 " [--make-catalog] create a text file of the completed galaxy catalog\n"\
1006 " [--enable-milkyway] lum enables MW injections, set MW luminosity\n"\
1007 " [--disable-milkyway] disables Milky Way injections\n"\
1008 " [--dchirp-distr] use a distribution over chirp distance\n"\
1009 " (normalized to a 1.4,1.4 Msun binary)\n"\
1010 " [--z-distr] use a distribution over redshift\n"\
1011 " currently only 'sfr' is supported\n"\
1012 " [--local-rate] rho set the local coalescence rate for --z-distr sfr\n"\
1013 " (suggestion: 1 per Mpc^3 per Myr)\n"\
1014 " [--min-z] set the minimum redshift: at least 0.2 for sfr\n"\
1015 " [--max-z] set the maximum redshift: at most 1.0 for sfr\n"\
1016 " [--snr-distr] use a distribution over expected (optimal) network SNR\n"\
1017 " uniform: uniform in SNR, log10: uniform in log10(SNR)\n"\
1018 " volume: uniform in 1/SNR^3\n"\
1019 " ( Setting max-snr == min-snr will allow you to choose a fixed SNR )\n"\
1020 " [--ninja-snr] use a NINJA waveform SNR calculation (if not set, use LALSimulation)\n"\
1021 " [--min-snr] SMIN set the minimum network snr\n"\
1022 " [--max-snr] SMAX set the maximum network snr\n"\
1023 " [--min-coinc-snr] sm Set the minimum SNR in two IFOs. Neglected if a single IFO is used\n"\
1024 " [--ligo-psd] filename Ascii, tab-separated file of frequency, value pairs to use for LIGO PSD in snr computation\n"\
1025 " [--ligo-fake-psd] PSD LALsimulation PSD fit to use instead of a file. Allowed values: LALLIGO, LALAdLIGO\n"\
1026 " [--ligo-start-freq] freq Frequency in Hz to use for LIGO snr computation\n"\
1027 " [--virgo-psd] filename Ascii, tab-separated file of frequency, value pairs to use for Virgo PSD in snr computation\n"\
1028 " [--virgo-fake-psd] PSD LALsimulation PSD fit to use instead of a file. Allowed values: LALVirgo, LALAdVirgo\n"\
1029 " [--virgo-start-freq] freq Frequency in Hz to use for Virgo snr computation\n"\
1030 " [--ifos] ifos Comma-separated list of ifos to include in network SNR\n\n"\
1031 " --i-distr INCDIST set the inclination distribution, must be either\n"\
1032 " uniform: distribute uniformly over arccos(i)\n"\
1033 " gaussian: gaussian distributed in (i)\n"\
1034 " fixed: no distribution, fixed values of (i)\n"\
1035 " [--polarization] psi set the polarization angle for all injections (degrees)\n"\
1036 " [--incl-std] inclStd std dev for gaussian inclination dist\n"\
1037 " [--fixed-inc] fixed_inc value for the fixed inclination angle (in degrees) if '--i-distr fixed' is chosen.\n"\
1038 " [--max-inc] max_inc value for the maximum inclination angle (in degrees) if '--i-distr uniform' is chosen. \n"\
1039 " [--coa-phase-distr] cDist set the coalescence phase distribution,\n"\
1040 " cDist must be one of:\n"\
1041 " uniform: use random, uniformly distributed coalescence phase [default]\n"\
1042 " fixed: set fixed coalescence phase\n"\
1043 " [--fixed-coa-phase] phase set the coalescence phase (in degrees) for all injections if --coa-phase-distr=fixed\n"\
1044 " [--ipn-file] ipnskypoints read IPN sky points from file\n"\
1045 " [--exttrig-file] exttrig XML file containing external trigger\n\n");
1047 "Mass distribution information:\n"\
1048 " --m-distr massDist set the mass distribution of injections\n"\
1049 " must be one of:\n"\
1050 " source: using file containing list of mass pairs\n"\
1051 " nrwaves: using xml file with list of NR waveforms\n"\
1052 " (requires setting max/min total masses)\n"\
1053 " totalMass: uniform distribution in total mass\n"\
1054 " componentMass: uniform in m1 and m2\n"\
1055 " gaussian: gaussian mass distribution\n"\
1056 " log: log distribution in component mass\n"\
1057 " totalMassRatio: uniform distribution in total mass and\n"\
1058 " mass ratio m1 /m2\n"\
1059 " logTotalMassUniformMassRatio: log distribution in total mass\n"\
1060 " and uniform in mass ratio\n"\
1061 " totalMassFraction: uniform distribution in total mass and\n"\
1062 " in m1 /(m1+m2)\n"\
1063 " m1m2SquareGrid: component masses on a square grid\n"\
1064 " fixMasses: fix m1 and m2 to specific values\n"\
1065 " [--ninja2-mass] use the NINJA 2 mass-selection algorithm\n"\
1066 " [--real8-ninja2] when distributing by SNR for NINJA2, assume frames are REAL8\n"\
1067 " [--mass-file] mFile read population mass parameters from mFile\n"\
1068 " [--nr-file] nrFile read mass/spin parameters from xml nrFile\n"\
1069 " [--min-mass1] m1min set the minimum component mass to m1min\n"\
1070 " [--max-mass1] m1max set the maximum component mass to m1max\n"\
1071 " [--min-mass2] m2min set the min component mass2 to m2min\n"\
1072 " [--max-mass2] m2max set the max component mass2 to m2max\n"\
1073 " [--min-mtotal] minTotal sets the minimum total mass to minTotal\n"\
1074 " [--max-mtotal] maxTotal sets the maximum total mass to maxTotal\n"\
1075 " [--fixed-mass1] fixMass1 set mass1 to fixMass1\n"\
1076 " [--fixed-mass2] fixMass2 set mass2 to fixMass2\n"\
1077 " [--mean-mass1] m1mean set the mean value for mass1\n"\
1078 " [--stdev-mass1] m1std set the standard deviation for mass1\n"\
1079 " [--mean-mass2] m2mean set the mean value for mass2\n"\
1080 " [--stdev-mass2] m2std set the standard deviation for mass2\n"\
1081 " [--min-mratio] minr set the minimum mass ratio\n"\
1082 " [--max-mratio] maxr set the maximum mass ratio\n"\
1083 " [--mass1-points] m1pnt set the number of grid points in the m1 direction if '--m-distr=m1m2SquareGrid'\n"\
1084 " [--mass2-points] m2pnt set the number of grid points in the m2 direction if '--m-distr=m1m2SquareGrid'\n\n");
1086 "Spin distribution information:\n"\
1087 " --disable-spin disables spinning injections\n"\
1088 " --enable-spin enables spinning injections\n"\
1089 " One of these is required.\n"\
1090 " [--spin-gaussian] enable gaussian spin distribution\n"\
1091 " --aligned enforces the spins to be along the direction\n"\
1092 " of orbital angular momentum. Spin z-components are the only non-vanishing (unless '--axis-choice view' convention is chosen)\n"\
1093 " [--axis-choice] choice frame axis choice: 'angmomentum' (default) or 'view' to define convention for spin aligned case\n"\
1094 " [--min-spin1] spin1min Set the minimum spin1 to spin1min (0.0)\n"\
1095 " [--max-spin1] spin1max Set the maximum spin1 to spin1max (0.0)\n"\
1096 " [--mean-spin1] spin1mean Set the mean for |spin1| distribution\n"\
1097 " [--stdev-spin1] spin1std Set the standard deviation for |spin1|\n"\
1098 " [--min-spin2] spin2min Set the minimum spin2 to spin2min (0.0)\n"\
1099 " [--max-spin2] spin2max Set the maximum spin2 to spin2max (0.0)\n"\
1100 " [--mean-spin2] spin2mean Set the mean for |spin2| distribution\n"\
1101 " [--stdev-spin2] spin2std Set the standard deviation for |spin2|\n"\
1102 " [--min-kappa1] kappa1min Set the minimum cos(S1.L_N) to kappa1min (-1.0)\n"\
1103 " [--max-kappa1] kappa1max Set the maximum cos(S1.L_N) to kappa1max (1.0)\n"\
1104 " [--min-abskappa1] abskappa1min \n"\
1105 " Set the minimum absolute value of cos(S1.L_N)\n"\
1106 " to abskappa1min (0.0)\n"\
1107 " [--max-abskappa1] abskappa1max \n"\
1108 " Set the maximum absolute value of cos(S1.L_N) \n"\
1109 " to abskappa1max (1.0)\n\n");
1111 "Tapering the injection waveform:\n"\
1112 " [--taper-injection] OPT Taper the inspiral template using option OPT\n"\
1113 " (start|end|startend) \n"\
1114 " [--band-pass-injection] sets the tapering method of the injected waveform\n\n");
1134 perror(
"read_mass_data" );
1136 "Error while trying to open file %s\n",
1150 fprintf( stderr,
"Allocation error for mass_data\n" );
1178 perror(
"read_time_data" );
1180 "Error while trying to open file %s\n",
1194 fprintf( stderr,
"Allocation error for inj_times\n" );
1204 sscanf(
line,
"%d", &this_time);
1205 if ( this_time < 441417609 )
1207 fprintf( stderr,
"invalid injection time %d:\n"
1208 "GPS start time is prior to "
1209 "Jan 01, 1994 00:00:00 UTC:\n"
1234 fprintf( stderr,
"error: unable to read sim_inspiral table from %s\n",
1238 for(
num_nr = 0, thisEvent = nrSimHead; thisEvent;
num_nr++, thisEvent = thisEvent->
next);
1241 fprintf( stderr,
"error: zero events in sim_inspiral table from %s\n",
1251 fprintf( stderr,
"Allocation error for nr simulations\n" );
1255 for(
j = 0, thisEvent=nrSimHead;
j <
num_nr;
1256 ++
j, thisEvent = thisEvent->
next )
1283 perror(
"read_source_data" );
1291 if (
line[0] ==
'#' )
1303 fprintf( stderr,
"Allocation error for source_data\n" );
1309 if (
line[0] ==
'#' )
1313 char ra_sgn, dec_sgn;
1314 REAL8 ra_h, ra_m, dec_d, dec_m;
1317 c = sscanf(
line,
"%s %c%le:%le %c%le:%le %le %le %le",
1330 if ( ra_sgn ==
'-' )
1332 if ( dec_sgn ==
'-' )
1346 fprintf( stderr,
"Allocation error for ratioVec/fracVec\n" );
1388 fseek(
data, 0, SEEK_SET);
1394 fprintf( stderr,
"Allocation error for skyPoints\n" );
1431 REAL8 Mbstar = -20.45;
1434 REAL8 phistar = 0.0081/0.92;
1436 REAL8 initDistance = 0.0;
1437 REAL8 DeltaD = 100.0;
1439 REAL8 M_min = -12.0;
1441 REAL8 edgestep = 0.1;
1453 int edgenum = (
int) ceil((M_min-M_max)/edgestep);
1454 const char *galaxyname =
"Fake";
1455 int distnum = (maxDistance-initDistance)/DeltaD;
1456 int k_at_25Mpc = floor((25000-initDistance)/DeltaD);
1464 REAL8 UNUSED shellLum = 0.0;
1469 int rand_skylocation_seed = 3456;
1490 head = myFakeGalaxy;
1493 for (
j=0;
j<edgenum;
j++)
1495 phibins->
data[
j] = M_max+
j*edgestep;
1499 Corrections->
data[
j] = 0;
1502 pow1 = -1*pow(10, (-0.4*(phibins->
data[
j]-Mbstar)));
1503 pow2 = pow(10, (-0.4*(phibins->
data[
j]-Mbstar)));
1504 phi->
data[
j] = 0.92*phistar*exp(pow1)*pow(pow2,
alpha+1);
1508 for (
j=0;
j<=distnum;
j++)
1510 Distance->
data[
j] = initDistance+
j*DeltaD;
1514 for (
k = k_at_25Mpc;
k<distnum;
k++)
1518 for (
q = 0;
q<edgenum;
q++)
1531 mag_index = (
int) floor((mag-M_max)/edgestep);
1533 if (mag_index >= 0 && mag_index<edgenum)
1535 N->data[mag_index] += 1.0;
1537 else printf(
"WARNING GALAXY DOESNT FIT IN BIN\n");
1542 for (
j = 0;
j<edgenum;
j++)
1549 if (Corrections->
data[
j]>0.0)
1551 for (
q=0;
q<floor(Corrections->
data[
j]);
q++)
1554 myFakeGalaxy->
dist = Distance->
data[
k+1];
1557 myFakeGalaxy->
fudge = 1;
1559 myFakeGalaxy->
lum = pow(10.0, (phibins->
data[
j]/(-2.5)-7.808));
1561 myFakeGalaxy = myFakeGalaxy->
next;
1572 {
fprintf( stderr,
"Allocation error for temparray\n" );
1585 myFakeGalaxy =
head;
1594 myFakeGalaxy = myFakeGalaxy->
next;
1596 myFakeGalaxy->
next = NULL;
1608 fp = fopen(
"correctedcatalog.txt",
"w+");
1621 fprintf( stderr,
"Allocation error for ratioVec/fracVec\n" );
1636 myFakeGalaxy =
head;
1638 saved_next = myFakeGalaxy->
next;
1640 myFakeGalaxy = saved_next;
1705 REAL8 startFreq, startFreqHz, massTotal;
1706 int indx,tmp,*indicies;
1720 indicies[
j] = indicies[indx];
1721 indicies[indx] = tmp;
1734 startFreqHz = startFreq / (massTotal);
1736 if (startFreqHz <= inj->f_lower)
1741 inj->
mchirp = massTotal * pow(inj->
eta, 3.0/5.0);
1744 inj->
mass1 = (massTotal / 2.0) * (1 + pow( (1 - 4 * inj->
eta), 0.5) );
1745 inj->
mass2 = (massTotal / 2.0) * (1 - pow( (1 - 4 * inj->
eta), 0.5) );
1769 fprintf(stderr,
"No waveform could be injected at MTotal=%f Msun\n", massTotal);
1780 REAL8 *rightAscension,
1820 REAL8 *rightAscension,
1821 REAL8 *declination )
1849 REAL4 ra_rad, de_rad;
1864 table->longitude = ra_rad- gmst1 + gmst2;
1865 table->latitude = de_rad;
1883 REAL8 meanTimeStep = -1;
1884 REAL8 timeInterval = 0;
1886 UINT4 useChirpDist = 0;
1887 REAL4 minMass10, maxMass10, minMass20, maxMass20, minMtotal0, maxMtotal0,
1888 meanMass10, meanMass20, massStdev10, massStdev20;
1896 CHAR axisChoiceString[]=
"angmomentum";
1898 INT4 amp_order = -1;
1909 REAL8 drawnDistance = 0.0;
1910 REAL8 drawnRightAscension = 0.0;
1911 REAL8 drawnDeclination = 0.0;
1913 REAL8 IPNgmst1 = 0.0;
1914 REAL8 IPNgmst2 = 0.0;
1918 CHAR *ligoPsdFileName = NULL;
1919 REAL8 ligoStartFreq = -1;
1920 CHAR *virgoPsdFileName = NULL;
1921 REAL8 virgoStartFreq = -1;
1922 CHAR *ligoFakePsd=NULL;
1923 CHAR *virgoFakePsd=NULL;
2049 int option_index = 0;
2051 size_t LALoptarg_len;
2054 "hf:m:a:b:t:s:w:i:M:*", long_options, &option_index );
2066 if ( long_options[option_index].
flag != 0 )
2072 fprintf( stderr,
"error parsing option %s with argument %s\n",
2079 LALoptarg_len = strlen(
LALoptarg ) + 1;
2082 this_proc_param = this_proc_param->
next =
2088 LALoptarg_len = strlen(
LALoptarg ) + 1;
2089 massFileName = calloc( 1, LALoptarg_len *
sizeof(
char) );
2091 this_proc_param = this_proc_param->
next =
2097 LALoptarg_len = strlen(
LALoptarg ) + 1;
2098 nrFileName = calloc( 1, LALoptarg_len *
sizeof(
char) );
2100 this_proc_param = this_proc_param->
next =
2106 LALoptarg_len = strlen(
LALoptarg ) + 1;
2109 this_proc_param = this_proc_param->
next =
2115 LALoptarg_len = strlen(
LALoptarg ) + 1;
2118 this_proc_param = this_proc_param->
next =
2125 this_proc_param = this_proc_param->
next =
2132 if ( gpsinput < 441417609 )
2134 fprintf( stderr,
"invalid argument to --%s:\n"
2135 "GPS start time is prior to "
2136 "Jan 01, 1994 00:00:00 UTC:\n"
2137 "(%ld specified)\n",
2138 long_options[option_index].
name, gpsinput );
2143 this_proc_param = this_proc_param->
next =
2150 if ( gpsinput < 441417609 )
2152 fprintf( stderr,
"invalid argument to --%s:\n"
2153 "GPS start time is prior to "
2154 "Jan 01, 1994 00:00:00 UTC:\n"
2155 "(%ld specified)\n",
2156 long_options[option_index].
name, gpsinput );
2161 this_proc_param = this_proc_param->
next =
2168 if ( gpsinput < 441417609 )
2170 fprintf( stderr,
"invalid argument to --%s:\n"
2171 "GPS start time is prior to "
2172 "Jan 01, 1994 00:00:00 UTC:\n"
2173 "(%ld specified)\n",
2174 long_options[option_index].
name, gpsinput );
2178 this_proc_param = this_proc_param->
next =
2185 this_proc_param = this_proc_param->
next =
2191 LALoptarg_len = strlen(
LALoptarg ) + 1;
2194 if (!strcmp(
dummy,
"fixed"))
2198 else if (!strcmp(
dummy,
"uniform"))
2202 else if (!strcmp(
dummy,
"exponential"))
2206 else if (!strcmp(
dummy,
"file"))
2213 fprintf( stderr,
"invalid argument to --%s:\n"
2214 "unknown time distribution: %s must be one of\n"
2215 "fixed, uniform or exponential\n",
2223 this_proc_param = this_proc_param->
next =
2228 fprintf( stderr,
"invalid argument to --%s:\n"
2229 "local coalescence rate must be positive"
2238 this_proc_param = this_proc_param->
next =
2240 "%le", meanTimeStep );
2245 this_proc_param = this_proc_param->
next =
2247 "%le", timeInterval );
2252 this_proc_param = this_proc_param->
next =
2259 this_proc_param = this_proc_param->
next =
2269 fprintf( stderr,
"invalid argument to --%s:\n"
2270 "Milky Way luminosity must be positive"
2276 this_proc_param = this_proc_param->
next =
2283 this_proc_param = this_proc_param->
next =
2291 LALoptarg_len = strlen(
LALoptarg ) + 1;
2306 LALoptarg_len = strlen(
LALoptarg ) + 1;
2317 if (!strcmp(
dummy,
"source"))
2321 else if (!strcmp(
dummy,
"nrwaves"))
2325 else if (!strcmp(
dummy,
"totalMass"))
2329 else if (!strcmp(
dummy,
"componentMass"))
2333 else if (!strcmp(
dummy,
"gaussian"))
2337 else if (!strcmp(
dummy,
"log"))
2341 else if (!strcmp(
dummy,
"totalMassRatio"))
2345 else if (!strcmp(
dummy,
"logTotalMassUniformMassRatio"))
2349 else if (!strcmp(
dummy,
"m1m2SquareGrid"))
2353 else if (!strcmp(
dummy,
"fixMasses"))
2357 else if (!strcmp(
dummy,
"totalMassFraction"))
2363 fprintf( stderr,
"invalid argument to --%s:\n"
2364 "unknown mass distribution: %s must be one of\n"
2365 "(source, nrwaves, totalMass, componentMass, gaussian, log,\n"
2366 "totalMassRatio, totalMassFraction, logTotalMassUniformMassRatio,\n"
2367 "m1m2SquareGrid, fixMasses)\n",
2375 this_proc_param = this_proc_param->
next =
2382 this_proc_param = this_proc_param->
next =
2389 this_proc_param = this_proc_param->
next =
2396 this_proc_param = this_proc_param->
next =
2403 this_proc_param = this_proc_param->
next =
2410 this_proc_param = this_proc_param->
next =
2417 this_proc_param = this_proc_param->
next =
2424 this_proc_param = this_proc_param->
next =
2431 this_proc_param = this_proc_param->
next =
2438 this_proc_param = this_proc_param->
next =
2445 this_proc_param = this_proc_param->
next =
2452 this_proc_param = this_proc_param->
next =
2459 this_proc_param = this_proc_param->
next =
2466 this_proc_param = this_proc_param->
next =
2473 this_proc_param = this_proc_param->
next =
2480 this_proc_param = this_proc_param->
next =
2486 LALoptarg_len = strlen(
LALoptarg ) + 1;
2497 if (!strcmp(
dummy,
"source"))
2501 else if (!strcmp(
dummy,
"uniform"))
2505 else if (!strcmp(
dummy,
"distancesquared"))
2509 else if (!strcmp(
dummy,
"log10"))
2513 else if (!strcmp(
dummy,
"volume"))
2519 fprintf( stderr,
"invalid argument to --%s:\n"
2520 "unknown distance distribution: "
2521 "%s, must be one of (uniform, distancesquared, volume, log10, source)\n",
2528 LALoptarg_len = strlen(
LALoptarg ) + 1;
2540 if (!strcmp(
dummy,
"uniform"))
2544 else if (!strcmp(
dummy,
"distancesquared"))
2548 else if (!strcmp(
dummy,
"log10"))
2552 else if (!strcmp(
dummy,
"volume"))
2558 fprintf( stderr,
"invalid argument to --%s:\n"
2559 "unknown distribution: "
2560 "%s, must be one of (uniform, distancesquared, volume, log10)\n",
2571 fprintf( stderr,
"invalid argument to --%s:\n"
2572 "minimum distance must be > 0: "
2573 "(%f kpc specified)\n",
2574 long_options[option_index].
name,
minD );
2577 this_proc_param = this_proc_param->
next =
2579 "float",
"%e",
minD );
2587 fprintf( stderr,
"invalid argument to --%s:\n"
2588 "maximum distance must be greater than 0: "
2589 "(%f kpc specified)\n",
2590 long_options[option_index].
name,
maxD );
2593 this_proc_param = this_proc_param->
next =
2595 "float",
"%e",
maxD );
2599 LALoptarg_len = strlen(
LALoptarg ) + 1;
2610 if (!strcmp(
dummy,
"sfr"))
2616 fprintf( stderr,
"invalid argument to --%s:\n"
2617 "unknown redshift distribution: "
2618 "%s, must be sfr (other distributions may be implemented in future)\n",
2626 this_proc_param = this_proc_param->
next =
2628 "float",
"%le",
minZ );
2631 fprintf(stderr,
"invalid argument to --%s:\n"
2632 "%s must not be less than 0.\n",
2640 this_proc_param = this_proc_param->
next =
2642 "float",
"%le",
maxZ );
2645 fprintf(stderr,
"invalid argument to --%s:\n"
2646 "%s must not be less than 0.\n",
2653 LALoptarg_len = strlen(
LALoptarg ) + 1;
2664 if (!strcmp(
dummy,
"uniform"))
2668 else if (!strcmp(
dummy,
"log10"))
2672 else if (!strcmp(
dummy,
"volume"))
2678 fprintf( stderr,
"invalid argument to --%s:\n"
2679 "unknown SNR distribution: "
2680 "%s, must be uniform, log10, or volume \n",
2688 this_proc_param = this_proc_param->
next =
2690 "float",
"%le",
minSNR );
2693 fprintf(stderr,
"invalid argument to --%s:\n"
2694 "%s must be greater than 2\n",
2702 this_proc_param = this_proc_param->
next =
2704 "float",
"%le",
maxSNR );
2707 fprintf(stderr,
"invalid argument to --%s:\n"
2708 "%s must be greater than 2\n",
2715 LALoptarg_len = strlen(
LALoptarg ) + 1;
2716 ifos = calloc( 1, LALoptarg_len *
sizeof(
char) );
2718 this_proc_param = this_proc_param->
next =
2724 LALoptarg_len = strlen(
LALoptarg ) + 1;
2735 if (!strcmp(
dummy,
"source"))
2739 else if (!strcmp(
dummy,
"exttrig"))
2743 else if (!strcmp(
dummy,
"random"))
2747 else if (!strcmp(
dummy,
"fixed"))
2751 else if (!strcmp(
dummy,
"ipn"))
2757 fprintf( stderr,
"invalid argument to --%s:\n"
2758 "unknown location distribution: "
2759 "%s must be one of (source, random)\n",
2770 this_proc_param = this_proc_param->
next =
2786 this_proc_param = this_proc_param->
next =
2792 fprintf(stderr,
"invalid argument to --%s:\n"
2793 "%s must be between -180. and 180. degrees\n",
2805 this_proc_param = this_proc_param->
next =
2811 fprintf(stderr,
"invalid argument to --%s:\n"
2812 "%s must be between -90. and 90. degrees\n",
2819 LALoptarg_len = strlen(
LALoptarg ) + 1;
2830 if (!strcmp(
dummy,
"uniform"))
2834 else if (!strcmp(
dummy,
"gaussian"))
2838 else if (!strcmp(
dummy,
"fixed"))
2844 fprintf( stderr,
"invalid argument to --%s:\n"
2845 "unknown inclination distribution: "
2846 "%s must be one of (uniform, gaussian, fixed)\n",
2857 fprintf( stderr,
"invalid argument to --%s:\n"
2858 "inclination gaussian width must be greater than 0: "
2863 this_proc_param = this_proc_param->
next =
2871 this_proc_param = this_proc_param->
next =
2880 fprintf( stderr,
"invalid argument to --%s:\n"
2881 "maximum inclination angle must be between 0 and 180 degrees:"
2886 this_proc_param = this_proc_param->
next =
2893 if ( strcmp(
LALoptarg,
"uniform" ) == 0)
2895 else if ( strcmp(
LALoptarg,
"fixed" ) == 0)
2898 fprintf( stderr,
"invalid argument to --%s:\n"
2899 "must either uniform or fixed (%s specified)\n",
2917 fprintf( stderr,
"invalid argument to --%s:\n"
2918 "fixed coalescence phase must be between 0 and 360 degrees:"
2923 this_proc_param = this_proc_param->
next =
2933 fprintf( stderr,
"invalid argument to --%s:\n"
2934 "polarization angle must be between 0 and 360 degrees: "
2939 this_proc_param = this_proc_param->
next =
2941 "float",
"%e",
psi );
2945 LALoptarg_len = strlen(
LALoptarg ) + 1;
2948 this_proc_param = this_proc_param->
next =
2954 LALoptarg_len = strlen(
LALoptarg ) + 1;
2955 ligoPsdFileName = calloc( 1, LALoptarg_len *
sizeof(
char) );
2956 memcpy( ligoPsdFileName,
LALoptarg, LALoptarg_len *
sizeof(
char) );
2957 this_proc_param = this_proc_param->
next =
2963 LALoptarg_len = strlen(
LALoptarg ) + 1;
2964 ligoFakePsd = calloc( 1, LALoptarg_len *
sizeof(
char) );
2965 memcpy( ligoFakePsd,
LALoptarg, LALoptarg_len *
sizeof(
char) );
2966 this_proc_param = this_proc_param->
next =
2973 this_proc_param = this_proc_param->
next =
2975 "float",
"%f", ligoStartFreq );
2979 LALoptarg_len = strlen(
LALoptarg ) + 1;
2980 virgoPsdFileName = calloc( 1, LALoptarg_len *
sizeof(
char) );
2981 memcpy( virgoPsdFileName,
LALoptarg, LALoptarg_len *
sizeof(
char) );
2982 this_proc_param = this_proc_param->
next =
2988 LALoptarg_len = strlen(
LALoptarg ) + 1;
2989 virgoFakePsd = calloc( 1, LALoptarg_len *
sizeof(
char) );
2990 memcpy( virgoFakePsd,
LALoptarg, LALoptarg_len *
sizeof(
char) );
2991 this_proc_param = this_proc_param->
next =
2998 this_proc_param = this_proc_param->
next =
3000 "float",
"%f", virgoStartFreq );
3005 this_proc_param = this_proc_param->
next =
3012 this_proc_param = this_proc_param->
next =
3019 this_proc_param = this_proc_param->
next =
3026 this_proc_param = this_proc_param->
next =
3033 this_proc_param = this_proc_param->
next =
3040 this_proc_param = this_proc_param->
next =
3047 this_proc_param = this_proc_param->
next =
3054 this_proc_param = this_proc_param->
next =
3061 this_proc_param = this_proc_param->
next =
3068 fprintf( stdout,
"LIGO/LSC inspiral injection engine\n");
3075 this_proc_param = this_proc_param->
next =
3083 this_proc_param = this_proc_param->
next =
3091 this_proc_param = this_proc_param->
next =
3100 this_proc_param = this_proc_param->
next =
3107 this_proc_param = this_proc_param->
next =
3119 else if ( ! strcmp(
"end",
LALoptarg ) )
3123 else if ( ! strcmp(
"startend",
LALoptarg ) )
3129 fprintf( stderr,
"invalid argument to --%s:\n"
3130 "unknown option specified: %s\n"
3131 "(Must be one of start|end|startend)\n",
3134 this_proc_param = this_proc_param->
next =
3150 LALoptarg_len = strlen(
LALoptarg ) + 1;
3153 this_proc_param = this_proc_param->
next =
3160 this_proc_param = this_proc_param->
next =
3166 this_proc_param = this_proc_param->
next =
3173 this_proc_param = this_proc_param->
next =
3179 this_proc_param = this_proc_param->
next =
3185 this_proc_param = this_proc_param->
next =
3192 fprintf( stderr,
"unknown error while parsing options\n" );
3202 "Must specify either --enable-milkyway LUM or --disable-milkyway\n"\
3203 " when using --d-distr=source\n" );
3210 "Must specify both --gps-start-time and --gps-end-time.\n");
3218 fprintf(stderr,
"Must specify exactly one distribution out of\n"\
3219 "--d-distr, --dchirp-distr, --z-distr or --snr-distr.\n");
3225 fprintf(stderr,
"Must specify a location distribution (--l-distr).\n");
3232 "Must specify both --longitude and --latitude when using \n"\
3233 "--l-distr=fixed\n");
3240 "Must specify both --longitude and --latitude when using \n"\
3241 "--l-distr=fixed\n");
3247 fprintf(stderr,
"Must specify a mass distribution (--m-distr).\n");
3253 fprintf(stderr,
"Must specify an inclination distribution (--i-distr).\n");
3263 "Must specify --source-file when using --d-distr or --l-distr source \n" );
3270 "Cannot specify --min-distance or --max-distance\n"\
3271 "if --d-distr=source\n");
3291 "Must specify --ipn-file when using IPN sky points distribution\n" );
3305 "Positive minimum and maximum distances must be specified\n");
3316 "One or more options on redshift or SNR are incompatible\n"\
3317 "with --d-distr or --dchirp-distr !\n");
3326 "One or more options on distance or SNR are incompatible\n"\
3327 "with --z-distr !\n");
3330 if ( minZ<0.2 || maxZ>1.0 )
3333 "Redshift can only take values between 0.2 and 1 for --z-distr=sfr\n");
3339 "Local coalescence rate must be positive for --z-distr=sfr\n");
3342 if ( meanTimeStep>=0. )
3344 fprintf( stderr,
"Time step cannot be specified for --z-distr=sfr\n"\
3345 "(it is calculated from local coalescence rate)\n");
3354 "One or more options on distance or redshift are incompatible\n"\
3355 "with --snr-distr !\n");
3368 "Must provide all of --min-snr, --max-snr and --ifos to distribute by SNR\n" );
3374 "Minimum coincident SNR should not be larger than maximum network SNR. Exiting...\n");
3384 ifo = strtok(tmp,
",");
3389 ifo = strtok(NULL,
",");
3394 ifo = strtok(tmp,
",");
3401 ifo = strtok(NULL,
",");
3417 if(!( ligoFakePsd || ligoPsdFileName ))
3420 "Must provide PSD file or the name of analytic PSD for LIGO if --snr-distr is given and H1 or L1 are in --ifos. \n" );
3424 if ( ligoFakePsd && ligoPsdFileName )
3426 fprintf( stderr,
"Must provide only one between --ligo-psd and --ligo-fake-psd \n" );
3430 if (ligoStartFreq < 0)
3432 fprintf( stderr,
"Must specify --ligo-start-freq together with --ligo-psd or --ligo-fake-psd.\n");
3436 if (
ninjaSNR && !(ligoPsdFileName))
3438 fprintf( stderr,
"Ninja injections do not support SNR calculation with simulated PSD.\n"
3439 "Please provide PSD file for LIGO (with --ligo-psd filename.dat). Exiting...\n");
3446 if (!(virgoFakePsd || virgoPsdFileName ))
3449 "Must provide PSD file or the name of analytic PSD for Virgo if --snr-distr is given and V1 is in --ifos. \n" );
3453 if ( virgoFakePsd && virgoPsdFileName )
3455 fprintf( stderr,
"Must provide only one between --virgo-psd and --virgo-fake-psd \n" );
3459 if (virgoStartFreq < 0)
3461 fprintf( stderr,
"Must specify --virgo-start-freq with --virgo-psd or --virgo-fake-psd.\n");
3465 if (
ninjaSNR && !(virgoPsdFileName))
3467 fprintf( stderr,
"Ninja injections do not support SNR calculation with simulated PSD.\n"
3468 "Please provide PSD file for Virgo (with --virgo-psd filename.dat). Exiting...\n");
3480 fprintf( stderr,
"max SNR must be greater than min SNR\n");
3486 "The single IFO SNR threshold must be positive. Exiting...\n" );
3491 if (ligoPsdFileName) {
3494 fprintf(stderr,
"Unable to load PSD file %s.\n", ligoPsdFileName);
3498 free(ligoPsdFileName);
3501 if (virgoPsdFileName) {
3504 fprintf(stderr,
"Unable to load PSD file %s.\n", virgoPsdFileName);
3508 free(virgoPsdFileName);
3517 "WARNING: source file specified for distance "
3518 "but NOT for location. This might give strange distributions\n" );
3527 "WARNING: source file specified for locations "
3528 "but NOT for distances, while Milky Way injections "
3529 "are allowed. This might give strange distributions\n" );
3536 "If --l-distr exttrig is specified, must specify "
3537 "external trigger XML file using --exttrig-file.\n");
3545 "Number of triggers read from the external trigger file: %d\n",
3551 "WARNING: Only 1 external trigger expected in the file '%s'",
3557 "ERROR: No external trigger found in file '%s'",
3567 "Must specify width for gaussian inclination distribution; \n"
3568 "use --incl-std.\n" );
3574 "Must specify an inclination if you want it fixed; \n"
3575 "use --fixed-inc.\n" );
3582 fprintf( stderr,
"--f-lower must be specified and non-zero\n" );
3590 "Must specify either a file contining the masses (--mass-file) \n"
3591 "or choose another mass-distribution (--m-distr).\n" );
3597 "Must specify either a file contining the masses (--nr-file) \n"
3598 "or choose another mass-distribution (--m-distr).\n" );
3611 "One or more mass distribution options are incompatible with \n"
3612 "using a file containing masses (--mass-file).\n" );
3627 "Must specify positive min-mtotal and max-mtotal when using \n"
3628 "a file containing NR injection masses (--nr-file).\n" );
3637 "One or more mass distribution options are incompatible with \n"
3638 "using a file containing masses (--nr-file).\n" );
3652 "Cannot specify a source or NR injection mass file for your choice \n"
3653 "of --m-distr.\n" );
3666 "Must specify positive minimum and maximum component masses for \n"
3667 "your choice of --m-distr.\n" );
3675 "Cannot specify --min-mratio, --max-mratio, or fixed m1,m2 for \n"
3676 "your choice of --m-distr.\n" );
3688 "Maximum (minimum) total mass must be larger (smaller) than \n"
3689 "minMass1+minMass2 (maxMass1+maxMass2). Check your arithmetic\n");
3703 "Must specify positive min-mratio and max-mratio and min/max mtotal for \n"
3704 "your choice of --m-distr.\n" );
3713 "Cannot specify options related to component masses for your choice \n"
3714 "of --m-distr.\n" );
3726 "Must specify positive --mean-mass1/2 and --stdev-mass1/2 if choosing \n"
3727 " --m-distr gaussian\n" );
3733 "Must specify a nonzero range of mass1 and mass2 if choosing \n"
3734 " --m-distr gaussian\n" );
3743 "Cannot specify --mean-mass1/2 or --stdev-mass1/2 unless choosing \n"
3744 " --m-distr gaussian\n" );
3754 "Values of --mass1-points and --mass2-points must be specified \n"
3755 "and >= 2 if choosing --m-distr m1m2SquareGrid\n" );
3768 "Cannot specify --mass1-points or mass2-points unless choosing \n"
3769 " --m-distr m1m2SquareGrid\n" );
3778 fprintf( stderr,
"--fixed-mass1 and --fixed-mass2 must be specified "
3779 "and positive if choosing --m-distr fixMasses\n" );
3789 "One or more mass options are incompatible with --m-distr fixMasses, \n"
3790 "only --fixed-mass1 and --fixed-mass2 may be specified\n" );
3798 fprintf( stderr,
"No waveform specified (--waveform).\n" );
3805 "Must specify --disable-spin or --enable-spin\n"
3806 "unless doing NR injections\n" );
3813 "Must enable spin to obtain aligned spin injections.\n" );
3818 ( !strncmp(
waveform,
"IMRPhenomB", 10) || !strncmp(
waveform,
"IMRPhenomC", 10) ) )
3821 "Spinning IMRPhenomB or -C injections must have the --aligned option.\n" );
3829 fprintf(stderr,
"Must specify a spin magnitude distribution (--spin-distr).\n");
3837 "Must specify positive |spin| standard deviations when using"
3838 " --spin-gaussian\n" );
3846 "Spins can only take values between 0 and 1.\n" );
3854 "Minimal spins must be less than maximal spins.\n" );
3861 fprintf(stderr,
"Mean of |spin1| distribution is way out of range.\n");
3866 fprintf(stderr,
"Mean of |spin2| distribution is way out of range.\n");
3875 "Either the options [--min-kappa1,--max-kappa1] or\n"
3876 "[--min-abskappa1,--max-abskappa1] can be specified\n" );
3881 if (minKappa1 < -1.0 || maxKappa1 > 1.0)
3884 "Kappa can only take values between -1 and +1\n" );
3892 "Minimal kappa must be less than maximal kappa\n" );
3897 if (minabsKappa1 < 0.0 || maxabsKappa1 > 1.0)
3900 "The absolute value of kappa can only take values between 0 and +1\n" );
3908 "Minimal kappa must be less than maximal kappa\n" );
3922 "Minimum time step value must be larger than zero\n" );
3928 fprintf(stderr,
"No filename for injection GPStimes is given. Use --time-file.\n");
3934 "Cannot specify an injection times file for your choice of --t-distr.\n" );
3941 "time interval must be zero\n" );
3947 if (meanTimeStep > 0.)
3949 fprintf(stderr,
"Minimum time step value must be larger than zero\n" );
3958 snprintf(
fname,
sizeof(
fname),
"HL-INJECTIONS_%d_%s-%d-%ld.xml.gz",
3963 snprintf(
fname,
sizeof(
fname),
"HL-INJECTIONS_%d_%s-%d-%ld.xml",
3968 snprintf(
fname,
sizeof(
fname),
"HL-INJECTIONS_%d-%d-%ld.xml.gz",
3973 snprintf(
fname,
sizeof(
fname),
"HL-INJECTIONS_%d-%d-%ld.xml",
3988 this_proc_param = procparams;
3989 procparams = procparams->
next;
3990 free( this_proc_param );
4036 currentGpsTime, timeInterval );
4114 drawFromSource( &drawnRightAscension, &drawnDeclination, &drawnDistance,
4123 while ( drawnDistance >
maxD/1000.0 )
4126 &drawnDistance, drawnSourceName );
4150 fprintf(stderr,
"Error while generating the distance of the event.\n");
4192 "Unknown location distribution specified. Possible choices: "
4193 "source, exttrig, random or fixed\n" );
4225 if ( !strncmp(axisChoiceString,
"angmomentum", 11) )
4228 if ( !strncmp(axisChoiceString,
"view", 4) )
4231 fprintf( stderr,
"Unknown axis-choice specification: 'angmomentum' and 'view' allowed, %s given.\n",axisChoiceString);
4262 fprintf(stderr,
"Allowed values for --snr-distr are uniform, log10 and volume. Exiting...\n");
4273 const char **ifo_list;
4275 int count, num_ifos = 0;
4280 ifo = strtok (tmp,
",");
4285 ifo = strtok (NULL,
",");
4289 ifo_list = (
const char **)
LALCalloc(num_ifos,
sizeof(
char *));
4293 ifo = strtok (tmp,
",");
4300 if (ifo_list[
count][0] ==
'V')
4302 start_freqs[
count] = virgoStartFreq;
4303 psds[
count] = virgoPsd;
4307 start_freqs[
count] = ligoStartFreq;
4308 psds[
count] = ligoPsd;
4311 ifo = strtok (NULL,
",");
4342 if (strstr(WF,
"EOB"))
4345 REAL8 segment = 64.0;
4352 if(!strcmp(
"V1",
ifo))
4354 start_freqs[
i]=virgoStartFreq;
4360 if (!virgoPsd)
fprintf(stderr,
"Failed to produce Virgo PSD series. Exiting...\n");
4363 else if (!strcmp(
"L1",
ifo) || !strcmp(
"H1",
ifo))
4365 start_freqs[
i]=ligoStartFreq;
4371 if (!ligoPsd)
fprintf(stderr,
"Failed to produce LIGO PSD series. Exiting...\n");
4376 fprintf(stderr,
"Unknown IFO. Allowed IFOs are H1,L1 and V1. Exiting...\n");
4386 fprintf(stdout,
"Warning: You are using less than 2 IFOs. Disabling the single IFO SNR threshold check...\n");
4395 if (start_freqs)
LALFree(start_freqs);
4407 "%s",
"TAPER_NONE");
4411 "%s",
"TAPER_START");
4419 "%s",
"TAPER_STARTEND");
4422 fprintf( stderr,
"unknown error while populating sim_inspiral taper options\n" );
4448 XLALGPSAdd( ¤tGpsTime, ninj * meanTimeStep );
4540 REAL8 proposedSNR=0.0;
4541 REAL8 local_min=0.0;
4544 UINT4 above_threshold=0;
4552 if (IFOnames ==NULL)
4554 fprintf(stderr,
"scale_lalsim_distance() called with IFOnames=NULL. Exiting...\n");
4557 char *
ifo=IFOnames[0];
4563 ifo=IFOnames[num_ifos];
4566 SNRs=calloc(num_ifos+1 ,
sizeof(
REAL8));
4568 for (
j=0;
j<num_ifos;
j++)
4571 net_snr+=SNRs[
j]*SNRs[
j];
4573 net_snr=sqrt(net_snr);
4580 above_threshold=num_ifos;
4596 fprintf(stderr,
"Allowed values for snr-distr are uniform, uniformLogSnr and uniformVolumeSnr. Exiting...\n");
4600 if (
vrbflg) { printf(
"proposed SNR %lf. Proposed new dist %lf \n",
4601 proposedSNR,inj->
distance*net_snr/proposedSNR); }
4603 ratio=net_snr/proposedSNR;
4606 for (
j=0;
j<num_ifos;
j++)
4613 local_min=proposedSNR;
4619 if (
maxSNR-proposedSNR<0.1 && single_IFO_SNR_threshold>0.0)
4621 fprintf(stdout,
"WARNING: Could not get two or more IFOs having SNR>%.1f without\n"
4622 "making the network SNR larger that its maximum value %.1f. Setting SNR to %lf.\n",
4630 if (above_threshold<2 && num_ifos>=2)
4634 }
while(!(above_threshold>=2) && num_ifos>=2);
4646 if (SNRs) free(SNRs);
4652 REAL8 proposedSNR=0.0;
4653 proposedSNR=1.0/(maxsnr*maxsnr*maxsnr) +
4655 proposedSNR=1.0/cbrt(proposedSNR);
4661 REAL8 proposedSNR=0.0;
4668 REAL8 proposedlogSNR=0.0;
4669 REAL8 logminsnr=log10(minsnr);
4670 REAL8 logmaxsnr=log10(maxsnr);
4672 return pow(10.0,proposedlogSNR);
const LALVCSInfoList lalAppsVCSInfoList
NULL-terminated list of VCS and build information for LALApps and its dependencies
const LALVCSInfo lalAppsVCSIdentInfo
Identable VCS and build information for LALApps.
lal_errhandler_t lal_errhandler
int LAL_ERR_EXIT(LALStatus *stat, const char *func, const char *file, const int line, volatile const char *id)
#define LAL_CALL(function, statusptr)
int LALExtTriggerTableFromLIGOLw(ExtTriggerTable **eventHead, CHAR *fileName, INT4 startEvent, INT4 stopEvent)
void LALCheckMemoryLeaks(void)
int LALgetopt_long_only(int argc, char *const *argv, const char *options, const struct LALoption *long_options, int *opt_index)
#define required_argument
int XLALCloseLIGOLwXMLFile(LIGOLwXMLStream *xml)
LIGOLwXMLStream * XLALOpenLIGOLwXMLFile(const char *path)
int XLALWriteLIGOLwXMLProcessTable(LIGOLwXMLStream *, const ProcessTable *)
int XLALWriteLIGOLwXMLProcessParamsTable(LIGOLwXMLStream *, const ProcessParamsTable *)
int XLALWriteLIGOLwXMLSimInspiralTable(LIGOLwXMLStream *, const SimInspiralTable *)
SimInspiralTable * XLALSimInspiralTableFromLIGOLw(const char *fileName)
void XLALDestroyREAL4VectorSequence(REAL4VectorSequence *vecseq)
LIGOTimeGPS * XLALGPSTimeNow(LIGOTimeGPS *gpstime)
REAL8FrequencySeries * XLALCreateREAL8FrequencySeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaF, const LALUnit *sampleUnits, size_t length)
void XLALDestroyREAL8FrequencySeries(REAL8FrequencySeries *series)
void XLALRandomInspiralMilkywayLocation(REAL8 *rightAscension, REAL8 *declination, REAL8 *distance, RandomParams *randParams)
SimInspiralTable * XLALFixedInspiralMasses(SimInspiralTable *inj, REAL4 mass1Fix, REAL4 mass2Fix)
SimInspiralTable * XLALRandomInspiralSkyLocation(SimInspiralTable *inj, RandomParams *randParams)
SimInspiralTable * XLALRandomInspiralSpins(SimInspiralTable *inj, RandomParams *randParams, REAL4 spin1Min, REAL4 spin1Max, REAL4 spin2Min, REAL4 spin2Max, REAL4 kappa1Min, REAL4 kappa1Max, REAL4 abskappa1Min, REAL4 abskappa1Max, AlignmentType alignInj, SpinDistribution distribution, REAL4 spin1Mean, REAL4 spin1Std, REAL4 spin2Mean, REAL4 spin2Std)
SimInspiralTable * XLALRandomInspiralDistance(SimInspiralTable *inj, RandomParams *randParams, LoudnessDistribution dDist, REAL4 distMin, REAL4 distMax)
SimInspiralTable * XLALGaussianInspiralMasses(SimInspiralTable *inj, RandomParams *randParams, REAL4 mass1Min, REAL4 mass1Max, REAL4 mass1Mean, REAL4 mass1Std, REAL4 mass2Min, REAL4 mass2Max, REAL4 mass2Mean, REAL4 mass2Std)
lalinspiral_time_distribution
SimInspiralTable * XLALRandomInspiralTime(SimInspiralTable *inj, RandomParams *randParams, LIGOTimeGPS startTime, REAL4 timeWindow)
SimInspiralTable * XLALRandomInspiralTotalMassFraction(SimInspiralTable *inj, RandomParams *randParams, MassDistribution mDist, REAL4 minTotalMass, REAL4 maxTotalMass, REAL4 minMassRatio, REAL4 maxMassRatio)
SimInspiralTable * XLALm1m2SquareGridInspiralMasses(SimInspiralTable *inj, REAL4 mass1Min, REAL4 mass2Min, REAL4 minTotalMass, REAL4 maxTotalMass, REAL4 mass1Delta, REAL4 mass2Delta, INT4 mass1Pnt, INT4 mass2Pnt, INT4 injNum, INT4 *count)
SimInspiralTable * XLALRandomNRInjectTotalMass(SimInspiralTable *inj, RandomParams *randParams, REAL4 minTotalMass, REAL4 maxTotalMass, SimInspiralTable *nrInjParams)
SimInspiralTable * XLALRandomInspiralMasses(SimInspiralTable *inj, RandomParams *randParams, MassDistribution mDistr, REAL4 mass1Min, REAL4 mass1Max, REAL4 mass2Min, REAL4 mass2Max, REAL4 minTotalMass, REAL4 maxTotalMass)
SimInspiralTable * XLALRandomInspiralOrientation(SimInspiralTable *inj, RandomParams *randParams, InclDistribution iDist, REAL4 inclinationPeak)
SimInspiralTable * XLALRandomInspiralTotalMassRatio(SimInspiralTable *inj, RandomParams *randParams, MassDistribution mDist, REAL4 minTotalMass, REAL4 maxTotalMass, REAL4 minMassRatio, REAL4 maxMassRatio)
logMassUniformTotalMassRatio
LALINSPIRAL_UNIFORM_TIME_DIST
LALINSPIRAL_FILE_TIME_DIST
LALINSPIRAL_UNKNOWN_TIME_DIST
LALINSPIRAL_EXPONENTIAL_TIME_DIST
LALINSPIRAL_FIXED_TIME_DIST
LAL_SIM_INSPIRAL_TAPER_START
LAL_SIM_INSPIRAL_TAPER_STARTEND
LAL_SIM_INSPIRAL_TAPER_END
LAL_SIM_INSPIRAL_TAPER_NONE
int XLALOutputVCSInfo(FILE *fp, const LALVCSInfoList vcs_list, const int verbose, const char *prefix)
void LALCreateRandomParams(LALStatus *status, RandomParams **params, INT4 seed)
REAL4 XLALUniformDeviate(RandomParams *params)
void LALDestroyRandomParams(LALStatus *status, RandomParams **params)
void XLALDestroyREAL8TimeSeries(REAL8TimeSeries *series)
const LALUnit lalHertzUnit
REAL8Vector * XLALCreateREAL8Vector(UINT4 length)
void XLALDestroyREAL8Vector(REAL8Vector *vector)
REAL8 XLALGreenwichMeanSiderealTime(const LIGOTimeGPS *gpstime)
LIGOTimeGPS * XLALGPSAdd(LIGOTimeGPS *epoch, REAL8 dt)
int XLALGPSCmp(const LIGOTimeGPS *t0, const LIGOTimeGPS *t1)
SimInspiralTable * injections
void sourceComplete(void)
SpinDistribution spinDistr
LoudnessDistribution dDistr
int main(int argc, char *argv[])
char MW_name[LIGOMETA_SOURCE_MAX]
static RandomParams * randParams
REAL8 probability_redshift(REAL8 rshift)
static REAL8 draw_log10_snr(REAL8 snrmin, REAL8 snrmax)
REAL8 redshift_mass(REAL8 mass, REAL8 z)
struct @3 * old_source_data
SkyLocationDistribution lDistr
void drawLocationFromExttrig(SimInspiralTable *table)
void adjust_snr_with_psds_real8(SimInspiralTable *inj, REAL8 target_snr, int num_ifos, const char **ifo_list, REAL8FrequencySeries **psds, REAL8 *start_freqs)
char name[LIGOMETA_SOURCE_MAX]
void read_nr_data(char *filename)
void read_time_data(char *filename)
void read_mass_data(char *filename)
void read_IPN_grid_from_file(char *fname)
REAL8 drawRedshift(REAL8 zmin, REAL8 zmax, REAL8 pzmax)
REAL8 snr_in_psd_real8(const char *ifo, REAL8FrequencySeries *psd, REAL8 start_freq, SimInspiralTable *inj)
REAL8 network_snr(const char *ifos, SimInspiralTable *inj)
REAL8 single_IFO_SNR_threshold
void drawFromSource(REAL8 *rightAscension, REAL8 *declination, REAL8 *distance, CHAR name[LIGOMETA_SOURCE_MAX])
REAL8 network_snr_with_psds_real8(int num_ifos, const char **ifo_list, REAL8FrequencySeries **psds, REAL8 *start_freqs, SimInspiralTable *inj)
void drawMassFromSource(SimInspiralTable *table)
REAL8 network_snr_real8(const char *ifos, SimInspiralTable *inj)
void read_source_data(char *filename)
void drawMassSpinFromNR(SimInspiralTable *table)
static REAL8 draw_uniform_snr(REAL8 snrmin, REAL8 snrmax)
SimInspiralTable * simTable
static void scale_lalsim_distance(SimInspiralTable *inj, char **IFOnames, REAL8FrequencySeries **psds, REAL8 *start_freqs, LoudnessDistribution dDistr)
int vrbflg
defined in lal/lib/std/LALError.c
REAL8 luminosity_distance(REAL8 rshift)
void adjust_snr(SimInspiralTable *inj, REAL8 target_snr, const char *ifos)
void adjust_snr_real8(SimInspiralTable *inj, REAL8 target_snr, const char *ifos)
lalinspiral_time_distribution tDistr
ExtTriggerTable * exttrigHead
SimInspiralTable ** nrSimArray
static REAL8 draw_volume_snr(REAL8 snrmin, REAL8 snrmax)
REAL8 mean_time_step_sfr(REAL8 zmax, REAL8 rate_local)
LALSimInspiralApplyTaper taperInj
static void print_usage(char *program)
ProcessParamsTable * next_process_param(const char *name, const char *type, const char *fmt,...)
char * IPNSkyPositionsFile
REAL8 snr_in_ifo_real8(const char *ifo, SimInspiralTable *inj)
SimRingdownTable * simRingTable
void drawMassSpinFromNRNinja2(SimInspiralTable *table)
void drawFromIPNsim(REAL8 *rightAscension, REAL8 *declination)
REAL8 snr_in_ifo(const char *ifo, SimInspiralTable *inj)
REAL8 calculate_lalsim_snr(SimInspiralTable *inj, char *IFOname, REAL8FrequencySeries *psd, REAL8 start_freq)
REAL8 calculate_snr_from_strain_and_psd_real8(REAL8TimeSeries *strain, REAL8FrequencySeries *psd, REAL8 startFreq, const CHAR ifo[3])
int XLALPsdFromFile(REAL8FrequencySeries **psd, const CHAR *filename)
void get_FakePsdFromString(REAL8FrequencySeries *PsdFreqSeries, char *FakePsdName, REAL8 StartFreq)
REAL8 calculate_ligo_snr_from_strain_real8(REAL8TimeSeries *strain, const CHAR ifo[3])
REAL8 calculate_ligo_snr_from_strain(REAL4TimeVectorSeries *strain, SimInspiralTable *thisInj, const CHAR ifo[3])
void AddNumRelStrainModes(LALStatus *status, REAL4TimeVectorSeries **outStrain, SimInspiralTable *thisinj)
REAL8 start_freq_from_frame_url(CHAR *url)
REAL8TimeSeries * XLALNRInjectionStrain(const char *ifo, SimInspiralTable *inj)
char name[LIGOMETA_SOURCE_MAX]
const char *const vcsDate
const char *const vcsStatus
CHAR type[LIGOMETA_TYPE_MAX]
CHAR param[LIGOMETA_PARAM_MAX]
CHAR value[LIGOMETA_VALUE_MAX]
struct tagProcessParamsTable * next
CHAR program[LIGOMETA_PROGRAM_MAX]
CHAR comment[LIGOMETA_COMMENT_MAX]
REAL4VectorSequence * data
LIGOTimeGPS geocent_end_time
CHAR source[LIGOMETA_SOURCE_MAX]
struct tagSimInspiralTable * next
CHAR taper[LIGOMETA_INSPIRALTAPER_MAX]
CHAR waveform[LIGOMETA_WAVEFORM_MAX]
CHAR numrel_data[LIGOMETA_STRING_MAX]
struct tagSimRingdownTable * next