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 84f77eba authored by John Douglas Veitch's avatar John Douglas Veitch

Store injection sample in HDF5 file

parent b657ecbb
......@@ -21,6 +21,7 @@
#include <lal/LALInferencePrior.h>
#include <lal/LALInferenceLikelihood.h>
#include <lal/LALInferenceProposal.h>
#include <lal/LALInferenceReadData.h>
#include <lal/LALInferenceHDF5.h>
#include <lal/LALInferencePriorVolumes.h>
......@@ -1209,6 +1210,13 @@ void LALInferenceNestedSamplingAlgorithm(LALInferenceRunState *runState)
XLALH5FileAddScalarAttribute(groupPtr, "cpu_time", &execution_time, LAL_D_TYPE_CODE);
}
LALInferenceVariables *injParams = NULL;
if ( (injParams=LALInferencePrintInjectionSample(runState)) )
{
LALInferenceH5VariablesArrayToDataset(groupPtr, &injParams, 1, "injection_params");
LALInferenceClearVariables(injParams);
XLALFree(injParams);
}
XLALH5FileClose(h5file);
}
......
......@@ -2189,7 +2189,7 @@ void LALInferenceInjectionToVariables(SimInspiralTable *theEventTable, LALInfere
}
void LALInferencePrintInjectionSample(LALInferenceRunState *runState) {
LALInferenceVariables *LALInferencePrintInjectionSample(LALInferenceRunState *runState) {
int errnum=0;
char *fname=NULL;
char defaultname[]="injection_params.dat";
......@@ -2208,7 +2208,7 @@ void LALInferencePrintInjectionSample(LALInferenceRunState *runState) {
ProcessParamsTable *ppt = LALInferenceGetProcParamVal(runState->commandLine,"--inj");
if (!ppt)
return;
return(NULL);
SimInspiralTableFromLIGOLw(&injTable, ppt->value, 0, 0);
......@@ -2239,7 +2239,7 @@ void LALInferencePrintInjectionSample(LALInferenceRunState *runState) {
if (!(approx && order)){
fprintf(stdout,"Unable to print injection sample: No approximant/PN order set\n");
return;
return(NULL);
}
/* Fill named variables */
LALInferenceInjectionToVariables(theEventTable, injparams);
......@@ -2275,9 +2275,8 @@ void LALInferencePrintInjectionSample(LALInferenceRunState *runState) {
LALInferencePrintSample(outfile, injparams);
fclose(outfile);
LALInferenceClearVariables(injparams);
XLALFree(injparams);
return;
//LALInferenceClearVariables(injparams);
return(injparams);
}
int enforce_m1_larger_m2(SimInspiralTable* injEvent){
......
......@@ -66,7 +66,7 @@ void LALInferenceInjectionToVariables(SimInspiralTable *theEventTable, LALInfere
* \brief Function to output a sample with logL values etc for the injection, if one is made.
* Requires --inj, --outfile and optionally --event (if not 0).
*/
void LALInferencePrintInjectionSample(LALInferenceRunState *runState);
LALInferenceVariables *LALInferencePrintInjectionSample(LALInferenceRunState *runState);
void LALInferenceInjectFromMDC(ProcessParamsTable *commandLine, LALInferenceIFOData *IFOdata);
/*@}*/
......
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