Loading [MathJax]/extensions/TeX/AMSsymbols.js
LALInference 4.1.9.1-8a6b96f
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
LALInferenceInjectedLike.c
Go to the documentation of this file.
1/*
2 * LALInferenceInjectedLike.c: Util bin to create an *injection file with the true parameters and the injected logL/P
3 *
4 * Copyright (C) 2018 salvatore vitale
5 *
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with with program; see the file COPYING. If not, write to the
19 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20 * MA 02110-1301 USA
21 */
22
23
24#include <stdio.h>
25#include <lal/Date.h>
26#include <lal/GenerateInspiral.h>
27#include <lal/LALInference.h>
28#include <lal/FrequencySeries.h>
29#include <lal/Units.h>
30#include <lal/StringInput.h>
31#include <lal/TimeSeries.h>
32#include <lal/LALInferencePrior.h>
33#include <lal/LALInferenceReadData.h>
34#include <lal/LALInferenceLikelihood.h>
35#include <lal/LALInferenceTemplate.h>
36#include <lal/LALInferenceProposal.h>
37#include <lal/LALInferenceInit.h>
38#include <lal/LALInferenceCalibrationErrors.h>
39#include <lal/LALInferenceVCSInfo.h>
40
41/*************** MAIN **********************/
42
43
44int main(int argc, char *argv[]){
45 int helpflag=0;
46 char help[]="\
47 LALInferenceInjectedLike:\n\
48 Print the injected values of parameters and (delta)LogL/P \n";
49
51 ProcessParamsTable *procParams=NULL;
53
54 /* Read command line and parse */
55 procParams=LALInferenceParseCommandLine(argc,argv);
56 if(LALInferenceGetProcParamVal(procParams,"--help"))
57 {
58 helpflag=1;
59 fprintf(stdout,"%s",help);
60 }
61 /* write down git information */
63
64 /* initialise runstate based on command line */
65 /* This includes reading in the data */
66 /* And performing any injections specified */
67 /* And allocating memory */
68 state = LALInferenceInitRunState(procParams);
69 /* Create header */
70 if (state!=NULL && !helpflag){
73 if(!ppt){
75 if(!ppt){
76 fprintf(stderr,"Must specify --outfile <filename.dat> or --outhdf <filename.h5>\n");
77 exit(1);
78 }
79 }
80
81 }
82 if (state == NULL) {
83 if (!helpflag) {
84 fprintf(stderr, "run state not allocated (%s, line %d).\n",
85 __FILE__, __LINE__);
86 }
87 } else {
88 data = state->data;
89 }
90
91 /* Perform injections if data successful read or created */
92 if (state&&!helpflag){
94 }
95
96 /* Simulate calibration errors.
97 * NOTE: this must be called after both ReadData and (if relevant)
98 * injectInspiralTD/FD are called! */
100
101
102 if (!helpflag && LALInferenceGetProcParamVal(state->commandLine, "--roqtime_steps")){
103
105 fprintf(stderr, "done LALInferenceSetupROQdata\n");
106
107 }
108
109 /* Set up the threads */
111
112 /* Init the prior */
114
115 /* Choose the likelihood and set some auxiliary variables */
117
118 /* Exit since we printed all command line arguments */
119 if(state == NULL || LALInferenceGetProcParamVal(state->commandLine,"--help"))
120 {
121 exit(0);
122 }
123
124 /* write injection with noise evidence information from algorithm */
126
127 /* end */
128 return(0);
129}
ProcessParamsTable * LALInferenceParseCommandLine(int argc, char *argv[])
void LALInferenceApplyCalibrationErrors(LALInferenceIFOData *IFOdata, ProcessParamsTable *commandLine)
LALInferenceRunState * LALInferenceInitRunState(ProcessParamsTable *command_line)
void LALInferenceInitCBCThreads(LALInferenceRunState *run_state, INT4 nthreads)
int main(int argc, char *argv[])
void LALInferenceInjectInspiralSignal(LALInferenceIFOData *IFOdata, ProcessParamsTable *commandLine)
ProcessParamsTable * ppt
const LALVCSInfo lalInferenceVCSInfo
VCS and build information for LALInference.
#define fprintf
sigmaKerr data[0]
ProcessParamsTable * LALInferenceGetProcParamVal(ProcessParamsTable *procparams, const char *name)
Returns the element of the process params table with "name".
void LALInferenceInitLikelihood(LALInferenceRunState *runState)
Initialisation function which reads runState->commaneLine and sets up the likelihood function accordi...
void LALInferenceInitCBCPrior(LALInferenceRunState *runState)
Initialize the prior based on command line arguments.
void LALInferenceSetupROQdata(LALInferenceIFOData *IFOdata, ProcessParamsTable *commandLine)
LALInferenceVariables * LALInferencePrintInjectionSample(LALInferenceRunState *runState)
Function to output a sample with logL values etc for the injection, if one is made.
help
Structure to contain IFO data.
Definition: LALInference.h:625
Structure containing inference run state This includes pointers to the function types required to run...
Definition: LALInference.h:592
ProcessParamsTable * commandLine
Definition: LALInference.h:593
struct tagLALInferenceIFOData * data
Log sample, i.e.
Definition: LALInference.h:601
const char *const vcsDate
const char *const vcsStatus
const char *const vcsAuthor
const char *const vcsId
const char *const vcsBranch