Maintenance will be performed on git.ligo.org, chat.ligo.org, containers.ligo.org, and docs.ligo.org starting 2 March 2020 at approximately 8am MST. It is expected to take around 10 minutes and will include a short period of downtime towards the end of the maintenance window. Please direct any comments, concerns, or questions to computing-help@igwn.org.

Commit dbd73e9a authored by Salvatore Vitale's avatar Salvatore Vitale Committed by John Douglas Veitch

LALInferencePrintInjectionSample to work even without --no-detector-frame

parent d3358b80
......@@ -504,7 +504,7 @@ static REAL8 LALInferenceFusedFreqDomainLogLikelihood(LALInferenceVariables *cur
INT4 SKY_FRAME=0;
if(LALInferenceCheckVariable(currentParams,"SKY_FRAME"))
SKY_FRAME=*(INT4 *)LALInferenceGetVariable(currentParams,"SKY_FRAME");
printf("SKY FRAME IS %d\n\n",SKY_FRAME);
if(SKY_FRAME==0){
/* determine source's sky location & orientation parameters: */
ra = *(REAL8*) LALInferenceGetVariable(currentParams, "rightascension"); /* radian */
......
......@@ -2140,23 +2140,26 @@ void LALInferenceInjectionToVariables(SimInspiralTable *theEventTable, LALInfere
LALInferenceAddVariable(vars, "chirpmass", &chirpmass, LALINFERENCE_REAL8_t, LALINFERENCE_PARAM_FIXED);
LALInferenceAddVariable(vars, "q", &q, LALINFERENCE_REAL8_t, LALINFERENCE_PARAM_FIXED);
LALInferenceAddVariable(vars, "time", &injGPSTime, LALINFERENCE_REAL8_t, LALINFERENCE_PARAM_FIXED);
if (LALInferenceCheckVariable(vars,"distance"))
LALInferenceAddVariable(vars, "distance", &dist, LALINFERENCE_REAL8_t, LALINFERENCE_PARAM_FIXED);
else if (LALInferenceCheckVariable(vars,"logdistance")){
REAL8 logdistance=log(dist);
LALInferenceAddVariable(vars, "logdistance", &logdistance, LALINFERENCE_REAL8_t, LALINFERENCE_PARAM_FIXED);
}
//LALInferenceAddVariable(vars, "costheta_jn", &cosinclination, LALINFERENCE_REAL8_t, LALINFERENCE_PARAM_FIXED);
LALInferenceAddVariable(vars, "polarisation", &(psi), LALINFERENCE_REAL8_t, LALINFERENCE_PARAM_FIXED);
LALInferenceAddVariable(vars, "phase", &phase, LALINFERENCE_REAL8_t, LALINFERENCE_PARAM_FIXED);
/* Those will work even if the user is working with the detector-frame variables because SKY_FRAME is set
to zero while calculating the injected logL in LALInferencePrintInjectionSample */
LALInferenceAddVariable(vars, "declination", &dec, LALINFERENCE_REAL8_t, LALINFERENCE_PARAM_FIXED);
LALInferenceAddVariable(vars, "rightascension", &ra, LALINFERENCE_REAL8_t, LALINFERENCE_PARAM_FIXED);
LALInferenceAddVariable(vars, "time", &injGPSTime, LALINFERENCE_REAL8_t, LALINFERENCE_PARAM_FIXED);
LALInferenceAddVariable(vars, "LAL_APPROXIMANT", &injapprox, LALINFERENCE_UINT4_t, LALINFERENCE_PARAM_FIXED);
LALInferenceAddVariable(vars, "LAL_PNORDER",&order,LALINFERENCE_INT4_t, LALINFERENCE_PARAM_FIXED);
LALInferenceAddVariable(vars, "LAL_AMPORDER", &(theEventTable->amp_order), LALINFERENCE_INT4_t, LALINFERENCE_PARAM_FIXED);
REAL8 thetaJN,phiJL,theta1,theta2,phi12,chi1,chi2;
/* Convert cartesian spin coordinates to system-frame variables*/
......@@ -2239,6 +2242,23 @@ void LALInferencePrintInjectionSample(LALInferenceRunState *runState) {
fprintf(stdout,"Unable to print injection sample: No approximant/PN order set\n");
return;
}
REAL8 fref = 100.;
if(LALInferenceGetProcParamVal(runState->commandLine,"--inj-fref")) {
fref = atoi(LALInferenceGetProcParamVal(runState->commandLine,"--inj-fref")->value);
}
LALInferenceAddVariable(injparams,"f_ref",(void *)&fref,LALINFERENCE_REAL8_t,LALINFERENCE_PARAM_OUTPUT);
UINT4 azero=0;
LALInferenceAddVariable(injparams,"SKY_FRAME",(void *)&azero,LALINFERENCE_REAL8_t,LALINFERENCE_PARAM_OUTPUT);
/* remove eventual SKY FRAME vars since they will contain garbage*/
if (LALInferenceCheckVariable(injparams,"t0"))
LALInferenceRemoveVariable(injparams,"t0");
if (LALInferenceCheckVariable(injparams,"cosalpha"))
LALInferenceRemoveVariable(injparams,"cosalpha");
if (LALInferenceCheckVariable(injparams,"azimuth"))
LALInferenceRemoveVariable(injparams,"azimuth");
/* Fill named variables */
LALInferenceInjectionToVariables(theEventTable, injparams);
......@@ -2265,12 +2285,6 @@ void LALInferencePrintInjectionSample(LALInferenceRunState *runState) {
data=data->next;
}
REAL8 fref = 100.;
if(LALInferenceGetProcParamVal(runState->commandLine,"--inj-fref")) {
fref = atoi(LALInferenceGetProcParamVal(runState->commandLine,"--inj-fref")->value);
}
LALInferenceAddVariable(injparams,"f_ref",(void *)&fref,LALINFERENCE_REAL8_t,LALINFERENCE_PARAM_OUTPUT);
/* Save to file */
outfile=fopen(fname,"w");
if(!outfile) {fprintf(stderr,"ERROR: Unable to open file %s for injection saving\n",fname); exit(1);}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment