25#include <lal/LALStdlib.h>
26#include <lal/LALStdio.h>
27#include <lal/AVFactories.h>
28#include <lal/LALCache.h>
29#include <lal/FrequencySeries.h>
30#include <lal/LALFrStream.h>
31#include <lal/Calibration.h>
33#include <lal/LIGOMetadataRingdownUtils.h>
41static LALUnit strainPerCount = {0,{0,0,0,0,0,1,-1},{0,0,0,0,0,0,0}};
46 const char *cacheName,
53 const char *channel_name
60 dataSampleRate, responseScale );
63 dataSampleRate, responseScale, channel_name );
83 response =
LALCalloc( 1,
sizeof( *response ) );
88 npoints = floor( dataDuration * dataSampleRate + 0.5 );
89 snprintf( response->
name,
sizeof( response->
name ),
90 "%s:CAL-RESPONSE", ifoName );
91 response->
deltaF = 1.0/dataDuration;
108 const char *cacheName,
112 REAL8 dataSampleRate,
114 const char *channel_name
129 memset(&calfacts, 0,
sizeof(calfacts));
132 npoints = floor( dataDuration * dataSampleRate + 0.5 );
141 verbose(
"obtaining calibration information from cache file %s\n", cacheName);
156 strncpy(
ifo, ifoName, 2 );
171 verbose(
"updating reference calibration to epoch %d.%09d\n",
176 verbose(
"calibrating with alpha=%g and alphabeta=%g\n", crealf(calfacts.
alpha),
204 const char *ifoName )
211 refResponse =
LALCalloc( 1,
sizeof( *refResponse ) );
215 snprintf( refResponse->
name,
sizeof( refResponse->
name ),
216 "%s:CAL-RESPONSE", ifoName );
237 const char *ifoName )
244 refSensing =
LALCalloc( 1,
sizeof( *refSensing ) );
248 snprintf( refSensing->
name,
sizeof( refSensing->
name ),
249 "%s:CAL-CAV_GAIN", ifoName );
280 snprintf(
alpha->name,
sizeof(
alpha->name ),
"%s:CAL-CAV_FAC", ifoName );
311 alphabeta =
LALCalloc( 1,
sizeof( *alphabeta ) );
314 snprintf( alphabeta->
name,
sizeof( alphabeta->
name ),
315 "%s:CAL-OLOOP_FAC", ifoName );
#define LAL_CALL(function, statusptr)
COMPLEX8FrequencySeries * get_response(const char *cacheName, const char *ifoName, LIGOTimeGPS *epoch, REAL8 dataDuration, REAL8 dataSampleRate, REAL4 responseScale, int strainData, const char *channel_name)
COMPLEX8TimeSeries * get_open_loop_gain_factor(LALCache *calCache, LIGOTimeGPS *epoch, const char *ifoName)
COMPLEX8FrequencySeries * get_frame_response(const char *cacheName, const char *ifoName, LIGOTimeGPS *epoch, REAL8 dataDuration, REAL8 dataSampleRate, REAL4 responseScale, const char *channel_name)
COMPLEX8FrequencySeries * get_impulse_response(const char *ifoName, LIGOTimeGPS *epoch, REAL8 dataDuration, REAL8 dataSampleRate, REAL4 responseScale)
COMPLEX8TimeSeries * get_cavity_gain_factor(LALCache *calCache, LIGOTimeGPS *epoch, const char *ifoName)
static LALUnit strainPerCount
COMPLEX8FrequencySeries * get_reference_response_function(LALCache *calCache, const char *ifoName)
COMPLEX8FrequencySeries * get_reference_sensing_function(LALCache *calCache, const char *ifoName)
INT8 sec_to_ns(REAL8 sec)
LIGOTimeGPS * ns_to_epoch(LIGOTimeGPS *epoch, INT8 ns)
void LALUpdateCalibration(LALStatus *status, CalibrationFunctions *output, CalibrationFunctions *input, CalibrationUpdateParams *params)
void LALResponseConvert(LALStatus *status, COMPLEX8FrequencySeries *output, COMPLEX8FrequencySeries *input)
COMPLEX8FrequencySeries * XLALCreateCOMPLEX8FrequencySeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaF, const LALUnit *sampleUnits, size_t length)
void XLALDestroyCache(LALCache *cache)
LALCache * XLALCacheImport(const char *fname)
LALCache * XLALCacheDuplicate(const LALCache *cache)
int XLALCacheSieve(LALCache *cache, INT4 t0, INT4 t1, const char *srcregex, const char *dscregex, const char *urlregex)
#define XLAL_INIT_DECL(var,...)
int XLALFrStreamSeek(LALFrStream *stream, const LIGOTimeGPS *epoch)
int XLALFrStreamClose(LALFrStream *stream)
LALFrStream * XLALFrStreamCacheOpen(LALCache *cache)
int XLALFrStreamGetCOMPLEX8TimeSeries(COMPLEX8TimeSeries *series, LALFrStream *stream)
int XLALFrStreamGetCOMPLEX8FrequencySeries(COMPLEX8FrequencySeries *series, LALFrStream *stream)
const LALUnit lalDimensionlessUnit
COMPLEX8Vector * XLALCreateCOMPLEX8Vector(UINT4 length)
void XLALDestroyCOMPLEX8Vector(COMPLEX8Vector *vector)
#define XLAL_ERROR_NULL(...)
COMPLEX8FrequencySeries * responseFunction
COMPLEX8FrequencySeries * sensingFunction
COMPLEX8TimeSeries * sensingFactor
COMPLEX8TimeSeries * openLoopFactor