38#include <lal/LALStdio.h>
39#include <lal/LALgetopt.h>
40#include <lal/LALStdlib.h>
41#include <lal/LALConstants.h>
42#include <lal/LIGOLwXML.h>
43#include <lal/LIGOMetadataTables.h>
44#include <lal/LIGOMetadataUtils.h>
45#include <lal/LIGOMetadataInspiralUtils.h>
46#include <lal/LIGOMetadataRingdownUtils.h>
49#include <lal/InspiralInjectionParams.h>
50#include <lal/GenerateInspiral.h>
51#include <lal/GenerateInspRing.h>
52#include <lal/FindChirp.h>
53#include <lal/RingUtils.h>
54#include <lal/LALNoiseModels.h>
55#include <lal/RealFFT.h>
56#include <lal/FrequencySeries.h>
57#include <lal/TimeSeries.h>
58#include <lal/TimeFreqFFT.h>
59#include <lal/VectorOps.h>
62#define CVS_ID_STRING "$Id$"
63#define CVS_NAME_STRING "$Name$"
64#define CVS_REVISION "$Revision$"
65#define CVS_SOURCE "$Source$"
66#define CVS_DATE "$Date$"
67#define PROGRAM_NAME "blindinj"
70 "lalapps_blindinj [options]\n"\
71"\nDefaults are shown in brackets\n\n" \
72" --help display this message\n"\
73" --version print version information and exit\n"\
74" --verbose be verbose\n"\
75" --gps-start-time TIME start time of injection\n"\
76" --injection-type TYPE type of injection, must be one of \n"\
77" (strain, etmx, etmy)\n"\
78" --seed SEED seed random number generator with SEED (1)\n"\
93typedef struct actuationparameters {
106 const char *fmt, ... );
162 const char *fmt, ... )
166 pp = calloc( 1,
sizeof( *
pp ) );
170 perror(
"next_process_param" );
174 if ( ! strcmp(
name,
"userTag" ) || ! strcmp(
name,
"user-tag" ) )
233 INT8 waveformStartTime;
239 const LALUnit strainPerCount = {0,{0,0,0,0,0,1,-1},{0,0,0,0,0,0,0}};
241 char fileName[FILENAME_MAX];
255 thisRingdownEvent = ringdownevents;
267 ppnParams.
ppn = NULL;
280 fprintf( stderr,
"Failed to generate the waveform \n" );
283 fprintf( stderr,
"Too much merger\n");
297 "Writing out A+, Ax, f, phi, shift for waveform "
298 "to file named INSPIRAL_WAVEFORM.dat\n");
299 snprintf( fileName, FILENAME_MAX,
"INSPIRAL_WAVEFORM.dat");
300 fp = fopen(fileName,
"w");
325 switch ( responseType )
328 fprintf( stderr,
"Must specify the response function\n" );
384 unity->
data[
k] = 1.0;
392 waveformStartTime -= (
INT8) ( 1000000000.0 * ppnParams.
tc );
418int main(
int argc,
char *argv[] )
430 REAL4 desiredSnr = 0;
431 REAL4 snrsqAt1Mpc = 0;
523 int option_index = 0;
538 if ( long_options[option_index].
flag != 0 )
544 fprintf( stderr,
"error parsing option %s with argument %s\n",
552 if ( gpsinput < 441417609 )
554 fprintf( stderr,
"invalid argument to --%s:\n"
555 "GPS start time is prior to "
556 "Jan 01, 1994 00:00:00 UTC:\n"
558 long_options[option_index].
name, gpsinput );
563 this_proc_param = this_proc_param->
next =
570 this_proc_param = this_proc_param->
next =
581 else if ( ! strcmp(
"etmx",
LALoptarg ) )
585 else if ( ! strcmp(
"etmy",
LALoptarg ) )
591 fprintf( stderr,
"invalid argument to --%s:\n"
592 "unknown injection type specified: "
593 "%s (must be strain, etmx or etmy)\n",
603 fprintf( stdout,
"blind hardware injection generation routine\n"
604 "Stephen Fairhurst\n");
616 fprintf( stderr,
"unknown error while parsing options\n" );
624 fprintf( stderr,
"extraneous command line arguments:\n" );
635 fprintf( stderr,
"Must specify the --injection-type\n" );
641 fprintf( stderr,
"Must specify the --gps-start-time\n" );
683 "Random variable to determine inj type = %f\n",
694 if (
vrbflg )
fprintf( stdout,
"Generating a BNS injection\n" );
698 maxNSSpin,
minNSSpin,
maxNSSpin, -1.0, 1.0, 0.0, 0.1, 0,
uniformSpinDist, 0.0, 0.0, 0.0, 0.0);
703 if (
vrbflg )
fprintf( stdout,
"Generating a BBH injection\n" );
707 maxBHSpin,
minBHSpin,
maxBHSpin , -1.0, 1.0, 0.0, 0.1, 0,
uniformSpinDist, 0.0, 0.0, 0.0, 0.0);
712 if (
vrbflg )
fprintf( stdout,
"Generating an NS - BH injection\n" );
716 maxNSSpin,
minBHSpin,
maxBHSpin , -1.0, 1.0, 0.0, 0.1, 0,
uniformSpinDist, 0.0, 0.0, 0.0, 0.0);
745 "mass 1 = %.2f;\t spin 1 = (%.2f, %.2f, %.2f)\n"
746 "mass 2 = %.2f;\t spin 2 = (%.2f, %.2f, %.2f)\n"
747 "Hanford effective distance = %.2f Mpc\n"
748 "Livingston effective distance = %.2f Mpc\n",
754 for ( ifoNumber = 0; ifoNumber <
LAL_NUM_IFO; ifoNumber++ )
768 "Unable to generate a realistic merger for this inspiral\n"
769 "Trying again with different parameters\n" );
802 thisSnrsq *= 4*fftData->
deltaF;
808 snrsqAt1Mpc += 5.0/4.0 * thisSnrsq;
812 snrsqAt1Mpc += thisSnrsq;
819 "For %s, the SNR at distance of 1 Mpc is %.2f\n",
ifo,
820 pow(thisSnrsq, 0.5));
830 inj->
distance = 1.0 * pow( snrsqAt1Mpc, 0.5 ) / desiredSnr;
833 "Rescaling the distance to %.2f to give a combined snr of %.2f\n",
842 for ( ifoNumber = 0; ifoNumber <
LAL_NUM_IFO; ifoNumber++ )
857 "Generating h(t) injection for %s\n",
ifo );
863 "Generating ETMX hardware injection for %s\n",
ifo );
869 "Generating ETMY hardware injection for %s\n",
ifo );
875 snprintf(
fname, FILENAME_MAX,
876 "%s-HARDWARE-INJECTION_%d_%s-%d-%d.txt",
909 snprintf(
fname,
sizeof(
fname),
"HL-INJECTIONS_%d-%d-%d.xml",
912 if (
vrbflg )
fprintf( stdout,
"Writing the injection details to %s\n",
925 this_proc_param = procparams;
926 procparams = procparams->
next;
927 free( this_proc_param );
935 this_proc_param = procparams;
936 procparams = this_proc_param->
next;
937 free( this_proc_param );
943 if ( inspInjections )
949 if ( ringInjections )
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)
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 XLALWriteLIGOLwXMLSimRingdownTable(LIGOLwXMLStream *xml, const SimRingdownTable *sim_ringdown)
int XLALWriteLIGOLwXMLSimInspiralTable(LIGOLwXMLStream *, const SimInspiralTable *)
void LALSimulateCoherentGW(LALStatus *status, REAL4TimeSeries *output, CoherentGW *input, DetectorResponse *detector)
int main(int argc, char *argv[])
static REAL4TimeSeries * injectWaveform(LALStatus *status, SimInspiralTable *inspInj, SimRingdownTable *ringdownevents, ResponseFunction responseType, InterferometerNumber ifoNumber, LIGOTimeGPS epoch)
ActuationParameters actuationParams[LAL_NUM_IFO]
int vrbflg
defined in lal/lib/std/LALError.c
static void destroyCoherentGW(CoherentGW *waveform)
static ProcessParamsTable * next_process_param(const char *name, const char *type, const char *fmt,...)
static LALUnit strainPerCount
void XLALDestroyREAL4VectorSequence(REAL4VectorSequence *vecseq)
LIGOTimeGPS * XLALGPSTimeNow(LIGOTimeGPS *gpstime)
void XLALDestroyCOMPLEX8FrequencySeries(COMPLEX8FrequencySeries *series)
COMPLEX8FrequencySeries * XLALCreateCOMPLEX8FrequencySeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaF, const LALUnit *sampleUnits, size_t length)
CoherentGW * XLALGenerateInspRing(CoherentGW *waveform, SimInspiralTable *thisEvent, SimRingdownTable *thisRingEvent, int injectSignalType)
void LALGenerateInspiral(LALStatus *status, CoherentGW *waveform, SimInspiralTable *params, PPNParamStruc *ppnParamsInputOutput)
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 * XLALRandomInspiralTime(SimInspiralTable *inj, RandomParams *randParams, LIGOTimeGPS startTime, REAL4 timeWindow)
COMPLEX8FrequencySeries * generateActuation(COMPLEX8FrequencySeries *resp, REAL4 ETMcal, REAL4 pendF, REAL4 pendQ)
SimInspiralTable * XLALPopulateSimInspiralSiteInfo(SimInspiralTable *inj)
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)
#define XLAL_INIT_DECL(var,...)
void LALLIGOIPsd(LALStatus UNUSED *status, REAL8 *psd, REAL8 f)
int XLALOutputVCSInfo(FILE *fp, const LALVCSInfoList vcs_list, const int verbose, const char *prefix)
RandomParams * XLALCreateRandomParams(INT4 seed)
REAL4 XLALUniformDeviate(RandomParams *params)
void XLALDestroyRandomParams(RandomParams *params)
int XLALNormalDeviates(REAL4Vector *deviates, RandomParams *params)
REAL4FFTPlan * XLALCreateForwardREAL4FFTPlan(UINT4 size, int measurelvl)
void XLALDestroyREAL4FFTPlan(REAL4FFTPlan *plan)
int XLALREAL4TimeFreqFFT(COMPLEX8FrequencySeries *freq, const REAL4TimeSeries *tser, const REAL4FFTPlan *plan)
REAL4TimeSeries * XLALCreateREAL4TimeSeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaT, const LALUnit *sampleUnits, size_t length)
void XLALDestroyREAL4TimeSeries(REAL4TimeSeries *series)
const LALUnit lalADCCountUnit
const LALUnit lalDimensionlessUnit
LALUnit * XLALUnitInvert(LALUnit *output, const LALUnit *input)
REAL4Vector * XLALCreateREAL4Vector(UINT4 length)
void XLALDestroyVector(REAL4Vector *vector)
void XLALDestroyREAL4Vector(REAL4Vector *vector)
COMPLEX8Vector * XLALCreateCOMPLEX8Vector(UINT4 length)
void XLALDestroyREAL8Vector(REAL8Vector *vector)
void XLALDestroyCOMPLEX8Vector(COMPLEX8Vector *vector)
COMPLEX8Vector * XLALCCVectorDivide(COMPLEX8Vector *out, const COMPLEX8Vector *in1, const COMPLEX8Vector *in2)
LIGOTimeGPS * XLALGPSAdd(LIGOTimeGPS *epoch, REAL8 dt)
LIGOTimeGPS * XLALINT8NSToGPS(LIGOTimeGPS *epoch, INT8 ns)
INT8 XLALGPSToINT8NS(const LIGOTimeGPS *epoch)
char name[LIGOMETA_SOURCE_MAX]
RandomParams * randParams
const char *const vcsDate
const char *const vcsStatus
struct tagProcessParamsTable * next
CHAR ifos[LIGOMETA_IFOS_MAX]
CHAR comment[LIGOMETA_COMMENT_MAX]
LIGOTimeGPS geocent_end_time
CHAR source[LIGOMETA_SOURCE_MAX]
CHAR waveform[LIGOMETA_WAVEFORM_MAX]