Loading [MathJax]/extensions/TeX/AMSsymbols.js
LALInference 4.1.9.1-5e288d3
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
LALInferenceInitBurst.c
Go to the documentation of this file.
1/*
2 * LALInferenceBurstInit.c: Bayesian Followup initialisation routines.
3 *
4 * Copyright (C) 2012 Vivien Raymond, John Veitch, Salvatore Vitale
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with with program; see the file COPYING. If not, write to the
18 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 * MA 02110-1301 USA
20 */
21
22
23#include <stdio.h>
24#include <lal/Date.h>
25#include <lal/GenerateInspiral.h>
26#include <lal/LALInference.h>
27#include <lal/FrequencySeries.h>
28#include <lal/Units.h>
29#include <lal/StringInput.h>
30#include <lal/TimeSeries.h>
31#include <lal/LALInferencePrior.h>
32#include <lal/LALInferenceTemplate.h>
33#include <lal/LALInferenceProposal.h>
34#include <lal/LALInferenceLikelihood.h>
35#include <lal/LALInferenceReadData.h>
36#include <lal/LALInferenceReadBurstData.h>
37#include <lal/LALInferenceInit.h>
38#include <lal/GenerateBurst.h>
39#include <lal/LALSimBurst.h>
40#include <lal/LALInferenceCalibrationErrors.h>
41#include <lal/LALInferenceInit.h>
42#include <lal/LIGOLwXMLRead.h>
43
44
47
48
49/*
50 * Initialize threads in memory, using LALInferenceInitBurstModel() to init models.
51 */
54 INT4 t, nifo;
55 LALInferenceIFOData *data = run_state->data;
56 UINT4 randomseed;
57 FILE *devrandom;
58 struct timeval tv;
59 run_state->nthreads = nthreads;
60 run_state->threads = LALInferenceInitThreads(nthreads);
61
62 for (t = 0; t < nthreads; t++) {
63 thread = &(run_state->threads[t]);
64
65 /* Set up CBC model and parameter array */
66 thread->model = LALInferenceInitBurstModel(run_state);
67
68 /* Allocate IFO likelihood holders */
69 nifo = 0;
70 while (data != NULL) {
71 data = data->next;
72 nifo++;
73 }
74 thread->currentIFOLikelihoods = XLALCalloc(nifo, sizeof(REAL8));
75
79
80 /* Use clocktime if seed isn't provided */
82 if (ppt)
83 randomseed = atoi(ppt->value);
84 else {
85 if ((devrandom = fopen("/dev/urandom","r")) == NULL) {
86 gettimeofday(&tv, 0);
87 randomseed = tv.tv_sec + tv.tv_usec;
88 } else {
89 fread(&randomseed, sizeof(randomseed), 1, devrandom);
90 fclose(devrandom);
91 }
92 }
93 thread->GSLrandom=gsl_rng_alloc(gsl_rng_mt19937);
94 gsl_rng_set(thread->GSLrandom, randomseed + t);
95
96 }
97 return;
98}
99
101{
102
103 char help[]="(--approx [SineGaussian,SineGaussianF,Gaussian,GaussianF,RingdownF]\tSpecify approximant to use (default SineGaussianF)\n";
105 ProcessParamsTable *commandLine=runState->commandLine;
106 /* Print command line arguments if help requested */
108
109 ppt=LALInferenceGetProcParamVal(commandLine,"--approx");
110 if(ppt) {
113 }
116 }
117 else {
118 XLALPrintError("Error: unknown template %s\n",ppt->value);
119 XLALPrintError("%s\n",help);
120 //XLAL_ERROR_VOID(XLAL_EINVAL);
121 }
122 }
123 ppt=LALInferenceGetProcParamVal(commandLine,"--fastSineGaussianLikelihood");
124 if (ppt){
126 ppt=LALInferenceGetProcParamVal(commandLine,"--approx");
128 fprintf(stdout,"Using fast sine gaussian frequency domain likelihood.\n WARNING: this disables most of the extra features like marginalization. Also assumes you are using a SineGaussianF template and know what you are doing. Be careful\n");
129 }
130 else{
131 fprintf(stderr,"ERROR: can only use fastSineGaussianLikelihood with SineGaussianF approximants.\n");
132 exit(1);
133 }
134 }
135 return templt;
136}
137
138/* Setup the variables to control Burst template generation */
139/* Includes specification of prior ranges */
140
142{
143 char help[]="\
144 \n\
145 ------------------------------------------------------------------------------------------------------------------\n\
146 --- Injection Arguments ------------------------------------------------------------------------------------------\n\
147 ------------------------------------------------------------------------------------------------------------------\n\
148 (--inj injections.xml) Sim Burst XML file to use.\n\
149 (--event N) Event number from Injection XML file to use.\n\
150 \n\
151 ------------------------------------------------------------------------------------------------------------------\n\
152 --- Template Arguments -------------------------------------------------------------------------------------------\n\
153 ------------------------------------------------------------------------------------------------------------------\n\
154 (--use-hrss) Jump in hrss instead than loghrss.\n\
155 --approx Specify a burst template approximant to use.\n\
156 Available approximants:\n\
157 modeldomain=\"time\": SineGaussian,Gaussian,DumpedSinusoidal.\n\
158 default modeldomain=\"frequency\": SineGaussianF,GaussianF,DumpedSinusoidalF.\n\
159 \n\
160 ------------------------------------------------------------------------------------------------------------------\n\
161 --- Starting Parameters ------------------------------------------------------------------------------------------\n\
162 ------------------------------------------------------------------------------------------------------------------\n\
163 You can generally have MCMC chains to start from a given parameter value by using --parname VALUE. Names currently known to the code are:\n\
164 time Waveform time (overrides random about trigtime).\n\
165 frequency Central frequency [Hz], (not used for Gaussian WF).\n\
166 quality Quality factor for SG and DumpedSin \n\
167 duration Duration [s] (Gaussian WF only)\n\
168 hrss hrss (requires --use-hrss)\n\
169 loghrss Log hrss\n\
170 rightascension Rightascensions\n\
171 declination Declination.\n\
172 polarisation Polarisation angle.\n\
173 \n ------------------------------------------------------------------------------------------------------------------\n\
174 --- Prior Arguments ----------------------------------------------------------------------------------------------\n\
175 ------------------------------------------------------------------------------------------------------------------\n\
176 You can generally use --paramname-min MIN --paramname-max MAX to set the prior range for the parameter paramname\n\
177 The names known to the code are listed below.\n\
178 Time has dedicated options listed here:\n\n\
179 (--trigtime time) Center of the prior for the time variable.\n\
180 (--dt time) Width of time prior, centred around trigger (0.2s).\n\
181 (--malmquistPrior) Rejection sample based on SNR of template \n\
182 \n\
183 (--varyFlow, --flowMin, --flowMax) Allow the lower frequency bound of integration to vary in given range.\n\
184 (--pinparams) List of parameters to set to injected values [frequency,quality,etc].\n\
185 ------------------------------------------------------------------------------------------------------------------\n\
186 --- Fix Parameters ----------------------------------------------------------------------------------------------\n\
187 ------------------------------------------------------------------------------------------------------------------\n\
188 You can generally fix a parameter to be fixed to a given values by using both --paramname VALUE and --fix-paramname\n\
189 where the known names have been listed above\n\
190 ------------------------------------------------------------------------------------------------------------------\n\
191 --- Spline Calibration Model -------------------------------------------------------------------------------------\n\
192 ------------------------------------------------------------------------------------------------------------------\n\
193 (--enable-spline-calibration) Enable cubic-spline calibration error model.\n\
194 (--spline-calibration-nodes N) Set the number of spline nodes per detector (default 5)\n\
195 (--spline-calibration-amp-uncertainty X) Set the prior on relative amplitude uncertainty (default 0.1)\n\
196 (--spline-calibration-phase-uncertainty X) Set the prior on phase uncertanity in degrees (default 5)\n";
197
198
199 /* Print command line arguments if state was not allocated */
200 if(state==NULL)
201 {
202 fprintf(stdout,"%s",help);
203 return(NULL);
204 }
205
206 /* Print command line arguments if help requested */
207 if(LALInferenceGetProcParamVal(state->commandLine,"--help"))
208 {
209 fprintf(stdout,"%s",help);
210 return(NULL);
211 }
212 ProcessParamsTable *commandLine=state->commandLine;
213
214 /* Over-ride prior bounds if analytic test */
215 if (LALInferenceGetProcParamVal(commandLine, "--correlatedGaussianLikelihood"))
216 {
218 }
219 else if (LALInferenceGetProcParamVal(commandLine, "--bimodalGaussianLikelihood"))
220 {
222 }
223
224
225 fprintf(stderr,"Using LALInferenceBurstVariables!\n");
226
228 SimBurst *BinjTable=NULL;
229 SimInspiralTable *inj_table=NULL;
230 REAL8 endtime=-1;
231 REAL8 endtime_from_inj=-1;
233 memset(&status,0,sizeof(LALStatus));
234 INT4 event=0;
235 INT4 i=0;
237 char *pinned_params=NULL;
238
240 model->params = XLALCalloc(1, sizeof(LALInferenceVariables));
241 memset(model->params, 0, sizeof(LALInferenceVariables));
243
244 UINT4 signal_flag=1;
245 ppt = LALInferenceGetProcParamVal(commandLine, "--noiseonly");
246 if(ppt)signal_flag=0;
247
248 LALInferenceAddVariable(model->params, "signalModelFlag", &signal_flag, LALINFERENCE_INT4_t, LALINFERENCE_PARAM_FIXED);
249 if(LALInferenceGetProcParamVal(commandLine,"--malmquistPrior"))
250 {
251 UINT4 malmquistflag=1;
252 LALInferenceAddVariable(model->params, "malmquistPrior",&malmquistflag,LALINFERENCE_UINT4_t, LALINFERENCE_PARAM_FIXED);
253 }
254
255 /* We may have used a CBC injection... test */
256 ppt=LALInferenceGetProcParamVal(commandLine,"--trigtime");
257 if (ppt)
258 endtime=atof(ppt->value);
259 ppt=LALInferenceGetProcParamVal(commandLine,"--binj");
260 if (ppt) {
261 BinjTable=XLALSimBurstTableFromLIGOLw(LALInferenceGetProcParamVal(commandLine,"--binj")->value);
262 if (BinjTable){
263 //burst_inj=1;
264 ppt=LALInferenceGetProcParamVal(commandLine,"--event");
265 if(ppt){
266 event = atoi(ppt->value);
267 while(i<event) {i++; BinjTable = BinjTable->next;}
268 }
269 else
270 fprintf(stdout,"WARNING: You did not provide an event number with you --binj. Using default event=0 which may not be what you want!!!!\n");
271 endtime_from_inj=XLALGPSGetREAL8(&(BinjTable->time_geocent_gps));
272 }
273 }
274 else if ((ppt=LALInferenceGetProcParamVal(commandLine,"--inj"))){
275 inj_table = XLALSimInspiralTableFromLIGOLw(LALInferenceGetProcParamVal(commandLine,"--inj")->value);
276 if (inj_table){
277 ppt=LALInferenceGetProcParamVal(commandLine,"--event");
278 if(ppt){
279 event= atoi(ppt->value);
280 fprintf(stderr,"Reading event %d from file\n",event);
281 i =0;
282 while(i<event) {i++; inj_table=inj_table->next;} /* select event */
283 endtime_from_inj=XLALGPSGetREAL8(&(inj_table->geocent_end_time));
284 }
285 else
286 fprintf(stdout,"WARNING: You did not provide an event number with you --inj. Using default event=0 which may not be what you want!!!!\n");
287 }
288 }
289 if(!(BinjTable || inj_table || endtime>=0.0 )){
290 printf("Did not provide --trigtime or an xml file and event... Exiting.\n");
291 exit(1);
292 }
293 if (endtime_from_inj!=endtime){
294 if(endtime_from_inj>0 && endtime>0)
295 fprintf(stderr,"WARNING!!! You set trigtime %lf with --trigtime but event %i seems to trigger at time %lf\n",endtime,event,endtime_from_inj);
296 else if(endtime_from_inj>0)
297 endtime=endtime_from_inj;
298 }
299
300 if((ppt=LALInferenceGetProcParamVal(commandLine,"--pinparams"))){
301 pinned_params=ppt->value;
302 LALInferenceVariables tempParams;
303 memset(&tempParams,0,sizeof(tempParams));
304 char **strings=NULL;
305 UINT4 N;
306 LALInferenceParseCharacterOptionString(pinned_params,&strings,&N);
307 LALInferenceBurstInjectionToVariables(BinjTable,&tempParams);
308
309 LALInferenceVariableItem *node=NULL;
310 while(N>0){
311 N--;
312 char *name=strings[N];
313 node=LALInferenceGetItem(&tempParams,name);
314 if(node) {LALInferenceAddVariable(currentParams,node->name,node->value,node->type,node->vary); printf("pinned %s \n",node->name);}
315 else {fprintf(stderr,"Error: Cannot pin parameter %s. No such parameter found in injection!\n",name);}
316 }
317 }
318
319 /* Over-ride approximant if user specifies */
320 ppt=LALInferenceGetProcParamVal(commandLine,"--approximant");
321 if(ppt){
323 }
324 ppt=LALInferenceGetProcParamVal(commandLine,"--approx");
325 if(ppt){
327 }
328 /* Set the model domain appropriately */
333 } else {
334 fprintf(stderr,"ERROR. Unknown approximant number %i. Unable to choose time or frequency domain model.",approx);
335 exit(1);
336 }
337
338 /* Handle, if present, requests for calibration parameters. */
340
341 REAL8 psiMin=0.0,psiMax=LAL_PI;
342 REAL8 raMin=0.0,raMax=LAL_TWOPI;
343 REAL8 decMin=-LAL_PI/2.0,decMax=LAL_PI/2.0;
344 REAL8 qMin=3., qMax=100.0;
345 REAL8 ffMin=40., ffMax=1024.0;
346 REAL8 durMin=1.0e-4; // min and max value of duration for gaussian templates
347 REAL8 durMax=.5;
348 REAL8 hrssMin=1.e-23, hrssMax=1.0e-15;
349 REAL8 loghrssMin=log(hrssMin),loghrssMax=log(hrssMax);
350 REAL8 dt=0.1;
351 REAL8 timeMin=endtime-dt;
352 REAL8 timeMax=endtime+dt;
353 REAL8 zero=0.0;
354 gsl_rng *GSLrandom=state->GSLrandom;
355 REAL8 timeParam = timeMin + (timeMax-timeMin)*gsl_rng_uniform(GSLrandom);
356
357 ppt=LALInferenceGetProcParamVal(commandLine,"--dt");
358 if (ppt) dt=atof(ppt->value);
359 timeMin=endtime-dt; timeMax=endtime+dt;
360 timeParam = timeMin + (timeMax-timeMin)*gsl_rng_uniform(GSLrandom);
361 LALInferenceRegisterUniformVariableREAL8(state, model->params, "polarisation", zero, psiMin, psiMax, LALINFERENCE_PARAM_LINEAR);
362
363 /* Option to use the detector-aligned frame */
364 if(LALInferenceGetProcParamVal(commandLine,"--detector-frame"))
365 {
366 printf("Using detector-based sky frame\n");
367 LALInferenceRegisterUniformVariableREAL8(state,model->params,"t0",timeParam,timeMin,timeMax,LALINFERENCE_PARAM_LINEAR);
370 /* add the time parameter then remove it so that the prior is set up properly */
371 LALInferenceRegisterUniformVariableREAL8(state, model->params, "time", timeParam, timeMin, timeMax,LALINFERENCE_PARAM_LINEAR);
372 LALInferenceRemoveVariable(model->params,"time");
373 INT4 one=1;
375 }
376 else
377 {
378 LALInferenceRegisterUniformVariableREAL8(state, model->params, "rightascension", zero, raMin, raMax,LALINFERENCE_PARAM_CIRCULAR);
379 LALInferenceRegisterUniformVariableREAL8(state, model->params, "declination", zero, decMin, decMax, LALINFERENCE_PARAM_LINEAR);
380 LALInferenceRegisterUniformVariableREAL8(state, model->params, "time", timeParam, timeMin, timeMax,LALINFERENCE_PARAM_LINEAR);
381 }
382
383 /* If we are marginalising over the time, remove that variable from the model (having set the prior above) */
384 /* Also set the prior in model->params, since Likelihood can't access the state! (ugly hack) */
385 if(LALInferenceGetProcParamVal(commandLine,"--margtime")){
387 LALInferenceAddVariable(model->params,"time_min",p->value,p->type,p->vary);
388 p=LALInferenceGetItem(state->priorArgs,"time_max");
389 LALInferenceAddVariable(model->params,"time_max",p->value,p->type,p->vary);
390 LALInferenceRemoveVariable(model->params,"time");
391 }
392 if (LALInferenceGetProcParamVal(commandLine, "--margtimephi") || LALInferenceGetProcParamVal(commandLine, "--margphi")) {
393 fprintf(stderr,"ERROR: cannot use margphi or margtimephi with burst approximants. Please use margtime or no marginalization\n");
394 exit(1);
395 }
396
397 ppt=LALInferenceGetProcParamVal(commandLine,"--approx");
398 if (!strcmp("SineGaussian",ppt->value) || !strcmp("SineGaussianF",ppt->value)|| !strcmp("DampedSinusoid",ppt->value) || !strcmp("DampedSinusoidF",ppt->value)){
399 LALInferenceRegisterUniformVariableREAL8(state, model->params, "frequency", zero, ffMin, ffMax, LALINFERENCE_PARAM_LINEAR);
400 LALInferenceRegisterUniformVariableREAL8(state, model->params, "quality", zero,qMin, qMax, LALINFERENCE_PARAM_LINEAR);
401 LALInferenceRegisterUniformVariableREAL8(state, model->params,"polar_eccentricity", zero,0.0,1.0, LALINFERENCE_PARAM_LINEAR);
402 }
403 else if (!strcmp("Gaussian",ppt->value) || !strcmp("GaussianF",ppt->value)){
404 LALInferenceRegisterUniformVariableREAL8(state, model->params,"duration", zero, durMin,durMax, LALINFERENCE_PARAM_LINEAR);
405 }
406
407 if (LALInferenceGetProcParamVal(commandLine,"--use-hrss")){
408 LALInferenceRegisterUniformVariableREAL8(state, model->params, "hrss", zero,hrssMin, hrssMax, LALINFERENCE_PARAM_LINEAR);
409 }
410 else
411 LALInferenceRegisterUniformVariableREAL8(state, model->params, "loghrss", zero,loghrssMin, loghrssMax, LALINFERENCE_PARAM_LINEAR);
412
415
416 /* Store a variable in case we are using a FastSG likelihood */
417 ppt=LALInferenceGetProcParamVal(commandLine,"--fastSineGaussianLikelihood");
418 UINT4 using_sgf=0;
419 if (ppt)
420 using_sgf=1;
421 LALInferenceAddVariable(model->params, "USING_FAST_SGF", &using_sgf, LALINFERENCE_UINT4_t, LALINFERENCE_PARAM_FIXED);
422 /* Set model sampling rates to be consistent with data */
423 model->deltaT = state->data->timeData->deltaT;
424 model->deltaF = state->data->freqData->deltaF;
425 UINT4 nifo=0;
426 LALInferenceIFOData *dataPtr = state->data;
427 while (dataPtr != NULL)
428 {
429 dataPtr = dataPtr->next;
430 nifo++;
431 }
432 /* Initialize waveform buffers */
433 model->timehPlus = XLALCreateREAL8TimeSeries("timehPlus",
434 &(state->data->timeData->epoch),
435 0.0,
436 model->deltaT,
438 state->data->timeData->data->length);
439 model->timehCross = XLALCreateREAL8TimeSeries("timehCross",
440 &(state->data->timeData->epoch),
441 0.0,
442 model->deltaT,
444 state->data->timeData->data->length);
446 &(state->data->freqData->epoch),
447 0.0,
448 model->deltaF,
450 state->data->freqData->data->length);
452 &(state->data->freqData->epoch),
453 0.0,
454 model->deltaF,
456 state->data->freqData->data->length);
457
458 /* Create arrays for holding single-IFO likelihoods, etc. */
459 model->ifo_loglikelihoods = XLALCalloc(nifo, sizeof(REAL8));
460 model->ifo_SNRs = XLALCalloc(nifo, sizeof(REAL8));
461
462 /* Choose proper template */
464
465 /* Use same window and FFT plans on model as data */
466 model->window = state->data->window;
467 model->padding = state->data->padding;
468 model->timeToFreqFFTPlan = state->data->timeToFreqFFTPlan;
469 model->freqToTimeFFTPlan = state->data->freqToTimeFFTPlan;
470 /* Initialize waveform cache */
472
473 return (model);
474}
475
476
477
479{
480 ProcessParamsTable *commandLine=state->commandLine;
482 char **strings=NULL;
483 char *pinned_params=NULL;
484 UINT4 N=0,i,j;
485 if((ppt=LALInferenceGetProcParamVal(commandLine,"--pinparams"))){
486 pinned_params=ppt->value;
487 LALInferenceVariables tempParams;
488 memset(&tempParams,0,sizeof(tempParams));
489 LALInferenceParseCharacterOptionString(pinned_params,&strings,&N);
490 }
492 model->params = XLALCalloc(1, sizeof(LALInferenceVariables));
493
494 UINT4 nifo=0;
495 LALInferenceIFOData *dataPtr = state->data;
496 while (dataPtr != NULL)
497 {
498 dataPtr = dataPtr->next;
499 nifo++;
500 }
501
502 model->ifo_SNRs = XLALCalloc(nifo, sizeof(REAL8));
503 model->ifo_loglikelihoods = XLALCalloc(nifo, sizeof(REAL8));
504
505 i=0;
506
507 struct varSettings {const char *name; REAL8 val, min, max;};
508
509 struct varSettings setup[]=
510 {
511 {.name="time", .val=0.001, .min=-0.006410, .max=0.008410},
512 {.name="frequency", .val=210., .min=205.560916, .max=216.439084},
513 {.name="quality", .val=6.03626, .min=5.252647, .max=6.747353},
514 {.name="loghrss", .val=-46., .min=-46.964458, .max=-45.035542},
515 {.name="polarisation", .val=0.73, .min=0.425622, .max=0.974378},
516 {.name="rightascension", .val=LAL_PI, .min=2.864650, .max=3.418535},
517 {.name="declination", .val=0.04, .min=-0.306437, .max=0.306437},
518 {.name="polar_angle", .val=0.58, .min=0.224279, .max=0.775721},
519 {.name="polar_eccentricity",.val=0.3,.min=0.0760747287,.max=0.4239252713},
520 {.name="END", .val=0., .min=0., .max=0.}
521 };
522
523 while(strcmp("END",setup[i].name))
524 {
526 /* Check if it is to be fixed */
527 for(j=0;j<N;j++) if(!strcmp(setup[i].name,strings[j])) {type=LALINFERENCE_PARAM_FIXED; printf("Fixing parameter %s\n",setup[i].name); break;}
528 LALInferenceRegisterUniformVariableREAL8(state, model->params, setup[i].name, setup[i].val, setup[i].min, setup[i].max, type);
529 i++;
530 }
531 return(model);
532}
533
535{
536 ProcessParamsTable *commandLine=state->commandLine;
538 char **strings=NULL;
539 char *pinned_params=NULL;
540 UINT4 N=0,i,j;
541 if((ppt=LALInferenceGetProcParamVal(commandLine,"--pinparams"))){
542 pinned_params=ppt->value;
543 LALInferenceVariables tempParams;
544 memset(&tempParams,0,sizeof(tempParams));
545 LALInferenceParseCharacterOptionString(pinned_params,&strings,&N);
546 }
548 model->params = XLALCalloc(1, sizeof(LALInferenceVariables));
549 UINT4 nifo=0;
550 LALInferenceIFOData *dataPtr = state->data;
551 while (dataPtr != NULL)
552 {
553 dataPtr = dataPtr->next;
554 nifo++;
555 }
556 model->ifo_SNRs = XLALCalloc(nifo, sizeof(REAL8));
557 model->ifo_loglikelihoods = XLALCalloc(nifo, sizeof(REAL8));
558 i=0;
559
560 struct varSettings {const char *name; REAL8 val, min, max;};
561
562 struct varSettings setup[]=
563 {
564 {.name="time", .val=0.0061, .min= -0.006410, .max=0.020266},
565 {.name="frequency", .val=215., .min=205.560916, .max=225.141619},
566 {.name="quality", .val=6.50, .min=5.252647, .max=7.943119},
567 {.name="loghrss", .val=-45., .min=-46.964458, .max=-43.492410},
568 {.name="polarisation", .val=0.93, .min=0.425622,.max=1.413383},
569 {.name="rightascension", .val=LAL_PI, .min=2.864650, .max=3.861644},
570 {.name="declination", .val=0.0, .min=-0.306437, .max=0.796736},
571 {.name="polar_angle", .val=0.75, .min=0.224279, .max=1.216874},
572 {.name="polar_eccentricity",.val=0.4,.min=0.076075,.max=0.702206},
573 {.name="END", .val=0., .min=0., .max=0.}
574 };
575 while(strcmp("END",setup[i].name))
576 {
578 /* Check if it is to be fixed */
579 for(j=0;j<N;j++) if(!strcmp(setup[i].name,strings[j])) {type=LALINFERENCE_PARAM_FIXED; printf("Fixing parameter %s\n",setup[i].name); break;}
580 LALInferenceRegisterUniformVariableREAL8(state, model->params, setup[i].name, setup[i].val, setup[i].min, setup[i].max, type);
581 i++;
582 }
583 return(model);
584}
int XLALSimBurstImplementedTDApproximants(BurstApproximant approximant)
int XLALGetBurstApproximantFromString(const CHAR *inString)
XLAL function to determine burst approximant from a string.
LALSimBurstWaveformCache * XLALCreateSimBurstWaveformCache(void)
Construct and initialize a waveform cache.
int XLALSimBurstImplementedFDApproximants(BurstApproximant approximant)
Checks whether the given approximant is implemented in lalsimulation's XLALSimInspiralChooseFDWavefor...
BurstApproximant
Enum that specifies the PN approximant to be used in computing the waveform.
void LALInferenceRegisterUniformVariableREAL8(LALInferenceRunState *state, LALInferenceVariables *var, const char *name, REAL8 startval, REAL8 min, REAL8 max, LALInferenceParamVaryType varytype)
Register a variable in vars for the model with given name, and a uniform prior.
void LALInferenceInitCalibrationVariables(LALInferenceRunState *runState, LALInferenceVariables *currentParams)
LALInferenceModel * LALInferenceInitModelReviewBurstEvidence_bimod(LALInferenceRunState *state)
LALInferenceModel * LALInferenceInitBurstModel(LALInferenceRunState *state)
Initialise state variables needed for LALInferenceNest or LALInferenceMCMC to run on a CBC signal.
LALInferenceModel * LALInferenceInitModelReviewBurstEvidence_unimod(LALInferenceRunState *state)
LALInferenceTemplateFunction LALInferenceInitBurstTemplate(LALInferenceRunState *runState)
Initialise the template for a standard burst signal.
void LALInferenceInitBurstThreads(LALInferenceRunState *run_state, INT4 nthreads)
#define max(a, b)
LALInferenceVariables currentParams
ProcessParamsTable * ppt
int j
SimInspiralTable * XLALSimInspiralTableFromLIGOLw(const char *fileName)
SimBurst * XLALSimBurstTableFromLIGOLw(const char *filename)
#define fprintf
const char *const name
sigmaKerr data[0]
COMPLEX16FrequencySeries * XLALCreateCOMPLEX16FrequencySeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaF, const LALUnit *sampleUnits, size_t length)
#define LAL_PI
#define LAL_TWOPI
double REAL8
uint32_t UINT4
int32_t INT4
void LALInferenceAddVariable(LALInferenceVariables *vars, const char *name, const void *value, LALInferenceVariableType type, LALInferenceParamVaryType vary)
Add a variable named name to vars with initial value referenced by value.
Definition: LALInference.c:395
LALInferenceThreadState * LALInferenceInitThreads(INT4 nthreads)
Definition: LALInference.c:138
void LALInferenceRemoveVariable(LALInferenceVariables *vars, const char *name)
Remove name from vars Frees the memory for the name structure and its contents.
Definition: LALInference.c:450
LALInferenceParamVaryType
An enumerated type for denoting the topology of a parameter.
Definition: LALInference.h:127
void LALInferenceCopyVariables(LALInferenceVariables *origin, LALInferenceVariables *target)
Deep copy the variables from one to another LALInferenceVariables structure.
Definition: LALInference.c:558
ProcessParamsTable * LALInferenceGetProcParamVal(ProcessParamsTable *procparams, const char *name)
Returns the element of the process params table with "name".
LALInferenceVariableItem * LALInferenceGetItem(const LALInferenceVariables *vars, const char *name)
Return the list node for "name" - do not rely on this.
Definition: LALInference.c:175
void(* LALInferenceTemplateFunction)(struct tagLALInferenceModel *model)
Type declaration for template function, which operates on a LALInferenceIFOData structure *data.
Definition: LALInference.h:377
void LALInferenceParseCharacterOptionString(char *input, char **strings[], UINT4 *n)
parses a character string (passed as one of the options) and decomposes it into individual parameter ...
@ LALINFERENCE_PARAM_FIXED
A parameter that is cyclic, such as an angle between 0 and 2pi.
Definition: LALInference.h:130
@ LALINFERENCE_PARAM_CIRCULAR
A parameter that simply has a maximum and a minimum.
Definition: LALInference.h:129
@ LALINFERENCE_PARAM_LINEAR
Definition: LALInference.h:128
@ LALINFERENCE_INT4_t
Definition: LALInference.h:105
@ LALINFERENCE_UINT4_t
Definition: LALInference.h:107
void LALInferenceBurstInjectionToVariables(SimBurst *theEventTable, LALInferenceVariables *vars)
Fill the variables passed in vars with the parameters of the injection passed in event will over-writ...
void LALInferenceTemplateXLALSimBurstSineGaussianF(LALInferenceModel *model)
void LALInferenceTemplateXLALSimBurstChooseWaveform(LALInferenceModel *model)
void LALInferenceTemplateXLALSimInspiralChooseWaveform(LALInferenceModel *model)
"XLALSimInspiralChooseWaveform{TD,FD}" wrapper.
void * XLALMalloc(size_t n)
void * XLALCalloc(size_t m, size_t n)
LAL_SIM_DOMAIN_TIME
LAL_SIM_DOMAIN_FREQUENCY
REAL8TimeSeries * XLALCreateREAL8TimeSeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaT, const LALUnit *sampleUnits, size_t length)
const LALUnit lalDimensionlessUnit
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
REAL8 XLALGPSGetREAL8(const LIGOTimeGPS *epoch)
help
type
Structure to contain IFO data.
Definition: LALInference.h:625
struct tagLALInferenceIFOData * next
ROQ data.
Definition: LALInference.h:659
Structure to constain a model and its parameters.
Definition: LALInference.h:436
REAL8 * ifo_loglikelihoods
Network SNR at params
Definition: LALInference.h:445
REAL8 * ifo_SNRs
Array of single-IFO likelihoods at params
Definition: LALInference.h:446
REAL8FFTPlan * timeToFreqFFTPlan
Burst Waveform cache for LIB.
Definition: LALInference.h:460
COMPLEX16FrequencySeries * freqhPlus
Time series model buffers.
Definition: LALInference.h:454
REAL8TimeSeries * timehCross
Definition: LALInference.h:453
LALSimBurstWaveformCache * burstWaveformCache
Waveform cache.
Definition: LALInference.h:459
REAL8TimeSeries * timehPlus
Definition: LALInference.h:453
REAL8 padding
A window.
Definition: LALInference.h:462
LALInferenceVariables * params
Definition: LALInference.h:437
REAL8 deltaT
End frequency for waveform generation.
Definition: LALInference.h:450
COMPLEX16FrequencySeries * freqhCross
Definition: LALInference.h:454
REAL8FFTPlan * freqToTimeFFTPlan
Definition: LALInference.h:460
REAL8Window * window
Pre-calculated FFT plans for forward and reverse FFTs.
Definition: LALInference.h:461
LALInferenceTemplateFunction templt
Domain of model.
Definition: LALInference.h:440
LALSimulationDomain domain
IFO-dependent parameters and buffers.
Definition: LALInference.h:439
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
LALInferenceVariables * proposalArgs
The data from the interferometers.
Definition: LALInference.h:602
INT4 nthreads
Array of live points for Nested Sampling.
Definition: LALInference.h:606
struct tagLALInferenceIFOData * data
Log sample, i.e.
Definition: LALInference.h:601
LALInferenceVariables * priorArgs
Common arguments needed by proposals, to be copied to thread->cycle.
Definition: LALInference.h:603
LALInferenceThreadState * threads
Definition: LALInference.h:612
Structure containing chain-specific variables.
Definition: LALInference.h:541
LALInferenceVariables * currentParams
Prior boundaries, etc.
Definition: LALInference.h:556
LALInferenceVariables * priorArgs
Stope things such as output arrays.
Definition: LALInference.h:553
LALInferenceModel * model
Cycle of proposals to call.
Definition: LALInference.h:548
REAL8 * currentIFOLikelihoods
Array storing single-IFO SNRs of current sample.
Definition: LALInference.h:569
LALInferenceVariables * proposalArgs
Definition: LALInference.h:551
The LALInferenceVariableItem list node structure This should only be accessed using the accessor func...
Definition: LALInference.h:154
char name[VARNAME_MAX]
Definition: LALInference.h:155
LALInferenceVariableType type
Definition: LALInference.h:157
LALInferenceParamVaryType vary
Definition: LALInference.h:158
The LALInferenceVariables structure to contain a set of parameters Implemented as a linked list of LA...
Definition: LALInference.h:170
CHAR value[LIGOMETA_VALUE_MAX]
struct tagSimBurst * next
LIGOTimeGPS time_geocent_gps
LIGOTimeGPS geocent_end_time
struct tagSimInspiralTable * next