Commit 0dc97ebc authored by megmillhouse's avatar megmillhouse

Add capability to do MDC time slides

parent ac233364
/*
* 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,16 @@ 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;
}
LIGOTimeGPS epoch=IFOdata->timeData->epoch;
REAL8 deltaT=IFOdata->timeData->deltaT ;
int seglen=IFOdata->timeData->data->length;
......@@ -211,6 +223,17 @@ void InjectFromMDC(ProcessParamsTable *commandLine, LALInferenceIFOData *IFOdata
i=0;
UINT4 lower = (UINT4)ceil(data->fLow / injF->deltaF);
UINT4 upper = (UINT4)floor(data->fHigh /injF-> deltaF);
// HACK ALERT: TESTING MDC SHIFTING
printf("WARNING!! SHIFTING MDC DATA !!!!!\n");
LIGOTimeGPS epoch_shift;
double mdc_trigtime = (double)epoch.gpsSeconds + 1.0e-9*(double)epoch.gpsNanoSeconds;
mdc_trigtime = mdc_trigtime + 2.0 + mdc_shift; // The 2 here is for that weird segment thing
printf("Reading in MDC from gps time %f\n", mdc_trigtime);
XLALGPSSetREAL8(&epoch_shift, mdc_trigtime);
// real gps time: 1164714814.0
/* Inject into FD data stream and calculate optimal SNR */
while(data){
......@@ -226,7 +249,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 +1361,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