Commit 208b8da3 authored by Tyson Littenberg's avatar Tyson Littenberg

Merge branch 'MDC_timeslides' into 'master'

Mdc timeslides

See merge request lscsoft/bayeswave!157
parents 993a4236 044db518
/*
* Copyright (C) 2018 Neil J. Cornish, Tyson B. Littenberg
* Copyright (C) 2018 Neil J. Cornish, Tyson B. Littenberg, Margaret Millhouse
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -387,6 +387,8 @@ struct Data
char **ifos;
char **PolArray;
char PolModes[10];
double mdc_shift; // time shift for MDCs
ProcessParamsTable *commandLine;
LALDetector **detector;
......
......@@ -134,6 +134,8 @@ void InjectFromMDC(ProcessParamsTable *commandLine, LALInferenceIFOData *IFOdata
REAL8 net_snr=0.0;
while (data) {nIFO++; data=data->next;}
UINT4 Nmdc=0,Nchannel=0;
double mdc_shift = 0.0;
ppt=LALInferenceGetProcParamVal(commandLine,"--MDC-cache");
if (!ppt){
......@@ -188,6 +190,24 @@ void InjectFromMDC(ProcessParamsTable *commandLine, LALInferenceIFOData *IFOdata
}
}
// For shifting MDC time slides to a new time
ppt = LALInferenceGetProcParamVal(commandLine,"--MDC-timeslide");
if (ppt) {
mdc_shift = atof(ppt->value);
}
else{
mdc_shift = 0.0;
}
printf("Shifting MDC by %f seconds.\n",mdc_shift);
// Read in trigtime for MDC shifting
ppt = LALInferenceGetProcParamVal(commandLine,"--trigtime");
double mdc_trigtime = atof(ppt->value);
mdc_trigtime = mdc_trigtime + mdc_shift; // actual time shift it
printf("Reading in MDC from gps time %f\n", mdc_trigtime);
LIGOTimeGPS epoch=IFOdata->timeData->epoch;
REAL8 deltaT=IFOdata->timeData->deltaT ;
int seglen=IFOdata->timeData->data->length;
......@@ -211,6 +231,11 @@ void InjectFromMDC(ProcessParamsTable *commandLine, LALInferenceIFOData *IFOdata
i=0;
UINT4 lower = (UINT4)ceil(data->fLow / injF->deltaF);
UINT4 upper = (UINT4)floor(data->fHigh /injF-> deltaF);
// MM: Update to handle MDC time sliding (i.e. use old MDCs in new noise)
LIGOTimeGPS epoch_shift;
XLALGPSSetREAL8(&epoch_shift, mdc_trigtime);
/* Inject into FD data stream and calculate optimal SNR */
while(data){
......@@ -226,7 +251,8 @@ void InjectFromMDC(ProcessParamsTable *commandLine, LALInferenceIFOData *IFOdata
tmp=0.0;
/* Read MDC frame */
timeData=readTseries(mdc_caches[i],mdc_channels[i],epoch,SegmentLength);
// timeData=readTseries(mdc_caches[i],mdc_channels[i],epoch,SegmentLength);
timeData=readTseries(mdc_caches[i],mdc_channels[i],epoch_shift,SegmentLength); // Hacked for MDC shift
/* downsample */
XLALResampleREAL8TimeSeries(timeData,1.0/SampleRate);
/* window timeData and store it in windTimeData */
......@@ -1337,6 +1363,7 @@ void parse_command_line(struct Data *data, struct Chain *chain, struct Prior *pr
//flag for force-feeding wavelet parameters to start
data->waveletStartFlag = 0;
ppt = LALInferenceGetProcParamVal(commandLine,"--srate");
if(ppt) data->srate = atoi(ppt->value);
else data->srate = 512;
......
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