Commit aea2b4d5 authored by John Douglas Veitch's avatar John Douglas Veitch

Add option to analyse length of time to lalinference pipeline

Original: 206f8f7d39427327aea9e5be0bd4918cde774dfe
parent 537454e9
......@@ -55,7 +55,11 @@ padding=16
# all will analyze all the events in the injetion table. Ranges and/or single events can also be specified. E.g. events=[0,4,5,10-12] will analyze the event 0,4,5,10,11,12.
events=all
# Can manually over-ride time limits here
# Overlap between segments when analysing a continuous span of time
# segment-overlap = 32
# Can manually over-ride time limits here - must use these when analysing
# a stretch of time, i.e. when no other input files are given
#gps-start-time=
#gps-end-time=
......
......@@ -58,6 +58,13 @@ class Event():
self.trig_time=self.coinctrigger.end_time + 1.0e-9 * self.coinctrigger.end_time_ns
if self.GID is not None:
self.event_id=int(''.join(i for i in self.GID if i.isdigit()))
self.engine_opts={}
def set_engine_option(self,opt,val):
"""
Can set event-specific options for the engine nodes
using this option, e.g. ev.set_engine_option('time-min','1083759273')
"""
self.engine_opts[opt]=val
dummyCacheNames=['LALLIGO','LALVirgo','LALAdLIGO','LALAdVirgo']
......@@ -541,9 +548,15 @@ class LALInferencePipelineDAG(pipeline.CondorDAG):
"""
gpsstart=None
gpsend=None
inputnames=['gps-time-file','injection-file','sngl-inspiral-file','coinc-inspiral-file','pipedown-db','gid']#,'lvalert-file']
if sum([ 1 if self.config.has_option('input',name) else 0 for name in inputnames])!=1:
if self.config.has_option('input','gps-start-time'):
gpsstart=self.config.getfloat('input','gps-start-time')
if self.config.has_option('input','gps-end-time'):
gpsend=self.config.getfloat('input','gps-end-time')
inputnames=['gps-time-file','injection-file','sngl-inspiral-file','coinc-inspiral-file','pipedown-db','gid']
ReadInputFromList=sum([ 1 if self.config.has_option('input',name) else 0 for name in inputnames])
if ReadInputFromList!=1 and (gpsstart is None or gpsend is None):
print 'Plese specify only one input file'
print 'Or specify gps-start-time and gps-end-time in the ini file'
sys.exit(1)
if self.config.has_option('input','events'):
selected_events=self.config.get('input','events')
......@@ -555,10 +568,30 @@ class LALInferencePipelineDAG(pipeline.CondorDAG):
selected_events=self.select_events()
else:
selected_events=None
if self.config.has_option('input','gps-start-time'):
gpsstart=self.config.getfloat('input','gps-start-time')
if self.config.has_option('input','gps-end-time'):
gpsend=self.config.getfloat('input','gps-end-time')
# No input file given, analyse the entire time stretch between gpsstart and gpsend
if ReadInputFromList!=1:
seglen=self.config.getfloat('engine','seglen')
if(self.config.has_option('input','segment-overlap'):
overlap=self.config.getfloat('input','segment-overlap')
else:
overlap=32.;
if(overlap>seglen):
print 'ERROR: segment-overlap is greater than seglen'
sys.exit(1)
# Now divide gpsstart - gpsend into jobs of seglen - overlap length
t=gpsstart
events=[]
while(t<gpsend):
ev=Event()
ev.set_engine_option('segment-start',str(t-overlap))
ev.set_engine_option('time-min',str(t))
tMax=t + seglen - overlap
if tMax>=gpsend:
tMax=gpsend
ev.set_engine_option('time-max',str(tMax))
events.append(ev)
t=tMax
# ASCII list of GPS times
if self.config.has_option('input','gps-time-file'):
times=scan_timefile(self.config.get('input','gps-time-file'))
......@@ -869,6 +902,8 @@ class LALInferencePipelineDAG(pipeline.CondorDAG):
out_dir=os.path.join(self.basepath,'engine')
mkdirs(out_dir)
node.set_output_file(os.path.join(out_dir,node.engine+'-'+str(event.event_id)+'-'+node.get_ifos()+'-'+str(node.get_trig_time())+'-'+str(node.id)))
for( (opt,arg) in event.engine_opts):
node.add_var_opt(opt,arg)
return node
def add_results_page_node(self,resjob=None,outdir=None,parent=None,extra_options=None,gzip_output=None):
......
......@@ -291,9 +291,6 @@ LALInferenceVariables *LALInferenceInitCBCVariables(LALInferenceRunState *state)
(--distance-max MAX) Maximum distance in Mpc (100).\n\
(--dt time) Width of time prior, centred around trigger (0.1s).\n\
(--malmquistPrior) Rejection sample based on SNR of template \n\
(--analyse-segment) Analyse whole segment (for margtime)\n\
(--time-pad-start T) Skip T seconds at start of segment when --analyse-segment given (default 10)\n\
(--time-pad-end T) Skip T seconds at end of segment when --analyse-segment given (default 0)\n\
Equation of state parameters:\n\
(--lambda1-min) Minimum lambda1 (0).\n\
(--lambda1-max) Maximum lambda1 (3000).\n\
......@@ -727,23 +724,6 @@ LALInferenceVariables *LALInferenceInitCBCVariables(LALInferenceRunState *state)
timeParam = timeMin + (timeMax-timeMin)*gsl_rng_uniform(GSLrandom);
}
/* Option to analyse entire segment with margtime likelihoods */
if(LALInferenceGetProcParamVal(commandLine,"--analyse-segment"))
{
/* Default padding times at start and end */
REAL8 timeSkipStart=10.0;
REAL8 timeSkipEnd=0.0;
if((ppt=LALInferenceGetProcParamVal(commandLine,"--time-pad-start")))
timeSkipStart=atof(ppt->value);
if((ppt=LALInferenceGetProcParamVal(commandLine,"--time-pad-end")))
timeSkipEnd=atof(ppt->value);
REAL8 seglen=atof(LALInferenceGetProcParamVal(commandLine,"--seglen")->value);
REAL8 segStart=XLALGPSGetREAL8(&(state->data->epoch));
timeMin=segStart+timeSkipStart;
timeMax=segStart+seglen-timeSkipEnd;
}
/* Non-standard names for backward compatibility */
if((ppt=LALInferenceGetProcParamVal(commandLine,"--phi"))) start_phase=atof(ppt->value);
if((ppt=LALInferenceGetProcParamVal(commandLine,"--dist"))) start_dist=atof(ppt->value);
......
......@@ -319,7 +319,8 @@ static INT4 getDataOptionsByDetectors(ProcessParamsTable *commandLine, char ***i
--psdstart GPStime GPS start time of PSD estimation data\n\
--psdlength length length of PSD estimation data in seconds\n\
--seglen length length of segments for PSD estimation and analysis in seconds\n\
--trigtime GPStime GPS time of the trigger to analyse\n\
(--trigtime GPStime) GPS time of the trigger to analyse (optional when using --margtime or --margtimephi)\n\
(--segment-start) GPS time of the start of the segment (optional when --trigtime given, default is seglen-2 s before --trigtime)\n\
(--srate rate) Downsample data to rate in Hz (4096.0,)\n\
(--injectionsrate rate) Downsample injection signal to rate in Hz (--srate)\n\
(--IFO1-flow freq1 [--IFO2-flow freq2 ...]) Specify lower frequency cutoff for overlap integral (40.0)\n\
......@@ -515,7 +516,7 @@ LALInferenceIFOData *LALInferenceReadData(ProcessParamsTable *commandLine)
}
else{
if(injTable) memcpy(&GPStrig,&(injTable->geocent_end_time),sizeof(GPStrig));
else {
else if(!LALInferenceGetProcParamVal(commandLine,"--segment-start")){
XLALPrintError("Error: No trigger time specifed and no injection given \n");
XLAL_ERROR_NULL(XLAL_EINVAL);
}
......@@ -766,9 +767,18 @@ LALInferenceIFOData *LALInferenceReadData(ProcessParamsTable *commandLine)
if(!IFOdata[i].window) XLAL_ERROR_NULL(XLAL_EFUNC);
}
/* Trigger time = 2 seconds before end of segment (was 1 second, but Common Inputs for The Events are -6 +2*/
memcpy(&segStart,&GPStrig,sizeof(LIGOTimeGPS));
XLALGPSAdd(&segStart,-SegmentLength+2);
if(!(ppt=LALInferenceGetProcParamVal(commandLine,"--segment-start")))
{
/* Trigger time = 2 seconds before end of segment (was 1 second, but Common Inputs for The Events are -6 +2*/
memcpy(&segStart,&GPStrig,sizeof(LIGOTimeGPS));
XLALGPSAdd(&segStart,-SegmentLength+2);
}
else
{
/* Segment starts at given time */
REAL8 segstartR8 = atof(ppt->value);
XLALGPSSetREAL8(&segStart,segstartR8);
}
/* Read the PSD data */
......@@ -902,10 +912,7 @@ LALInferenceIFOData *LALInferenceReadData(ProcessParamsTable *commandLine)
if(LALInferenceGetProcParamVal(commandLine, "--binFit")) {
LIGOTimeGPS GPStime;
GPStime.gpsSeconds = GPStrig.gpsSeconds - SegmentLength;
GPStime.gpsNanoSeconds = GPStrig.gpsNanoSeconds;
LIGOTimeGPS GPStime=segStart;
const UINT4 nameLength=256;
char filename[nameLength];
......
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