The Matlab interface
To simplify its manipulation, a frame is organized as a set of C structures described by a header holding pointers to additional structures and values of parameters expected to be stable over the integrated time interval: the starting time of the frame, its duration, values produced by the slow monitoring. This header is followed by an arbitrary number of additional structures, each holding the values of a rapidly varying parameter like the main signal, the seismic noise, etc...
This frame structure is a standard which has to be conserved over the various stages of the analysis. Thus Frame history, detector geometry, trigger results, monitoring data, reconstructed data, simulation results just lead to additional structures. It is always possible to add new structures or to drop old ones.
This standard format is the one used by the LIGO and VIRGO Gravitational Wave Detectors. This Document described the software used to manipulate the frames. The definition of the various structures as well as their representation on tape is described in specification document.
Remark: The copy utility is a convenient way to change the frame size. Example: See the file exampleReshape.c
void FrameTag (FrameH *frame, char *tag);
void FrameTagAdc (FrameH *frame, char *tag);
void FrameTagProc (FrameH *frame, char *tag);
void FrameTagSer (FrameH *frame, char *tag);
void FrameTagSim (FrameH *frame, char *tag);
void FrameTagStat (FrameH *frame, char *tag);
void FrameTagSum (FrameH *frame, char *tag);
void FrameTagTrig (FrameH *frame, char *tag);
void FrameTagAdc(myframe, "Lr* SaDb2")will keep from the frame myframe the SaDb2 ADC and all ADC with a name starting with Lr.The function FrameTag call all the other function. It performed a 'global tag' Remarks:
void FrDetectorDump (FrDetector *detector, FILE *fp, int debugLvl); Dump a detector structure. FrDetector *FrDetectorNew (char *name); Allocate a detector structure void FrDetectorFree (FrDetector *detector); Free a detector structure and associated data.
- To find all the events within a given time range and with some selection on the event amplitude:
FrEvent *FrEventReadT (FrFile *iFile, char *name, double tStart, double length, double amplitudeMin, double amplitudeMax);
This function perform a random read access on the file *iFile. It returns all FrEvent structure (as a linked list) which have a time between tStart and tStart+length and with an amplitude in the [amplitudeMin, amplitudeMax] range. It does NOT returns the associated vector nor the associated tables (this could be added later on using FrEVentReadData). The string name could contain several names and wild cards. The function returns a pointer to the first FrEvent structure of the linked list or NULL in case of error (frame not in file, not Table Of Content, malloc failed).- To find all the events within a given time range and with some selection on several parameters.:
FrEvent *FrEventReadTF (FrFile *iFile, char *name, double tStart, double length, int readData, int nParam, ...);
the additional parameters are: char* paramName1, double min1, double max1, char* paramName2, ...) where the paramName* are "amplitude", "timeBefore", "timeAfter" or one of the extra event parameterThis function perform a random read access on the file *iFile. It returns all FrEvent structure (as a linked list) which have a time between tStart and tStart+length and with the extra parameters in the required range.The associated vector is read if the readData flag is set to 1 (or not read if set to 0). The string name could contain several names and wild cards. The function returns a pointer to the first FrEvent structure of the linked list or NULL in case of error (frame not in file, not Table Of Content, malloc failed).
Example of use: event = FrEventReadTF(iFile,"Inspiral*",t0,50.,1, 2, "M1", 2., 3., "M2", 1., 3.); will return the linked list of all events with a name starting by Inspiral, with a time in the t0, t0+5à range, with a parameter M1 (and M2) in the range 2.;3. (1.;3.).- To read the associated vector for one event:
int FrEventReadData (FrFile *iFile, FrEvent *event);
iFile->compress = 1;Then all the vectors will remain compressed.
- This function write on or more vectors in a file. It automatically create a frame and attach an FrProcData channel that own the vector as data member.
- Syntax:
int FrFileOPutV (FrFile *oFile, FrVect *vect);
- This function returns 0 in case of succes or an error code.
- The GPS time of the vector (vect->GTime) needs to be properly set if more than one vector is put in the file.
FrProcDataAddHistory(proc, "FFT(V1:Pr_B1_ACq)", 0) will add only one history record
FrProcDataAddHistory(proc, "A+B", 2, procA->history, procB->history) will add one history record and will copy the history records from procA and procB where procA and procB are FrProcData structures
- Add a parameter to an FrProcData structure: FrProcData *FrProcDataAddParam (FrProcData *proc, char* paramName, double value); This function returns NULL in case of error (bad input parameters or malloc failed).
- Get parameter value: double FrProcDataGetParam (FrProcData *proc, char* paramName);
This function returns -1. if the parameter could not be found.- Get parameter id: int FrProcDataGetParamId (FrProcData *proc, char* paramName);
This function returns the parameter number in the list or -1 if the parameter could not be found. The parameter value could then be access at proc->auxParam[id].
- Add one more parameter to an event: FrSimEvent *FrSimEventAddParam (FrSimEvent *event, char* paramName, double value); This function returns NULL in case of error (bad input parameters of malloc failed).
- Add one vector parameter to an event:
int FrSimEventAddVect (FrSimEvent *event, FrVect* vect, char* newName);
int FrSimEventAddVectF (FrSimEvent *event, FrVect* vect, char* newName);- This function attach a copy of a vector (cast to a vector of float for ...AddVectF) to an event. If newName is not NULL, the vector name is changed. It returns 0 in case of success.Get the value for one parameter: double FrSimEventGetParam (FrSimEvent *event, char* paramName); This function returns -1. if the parameter could not be found.
- Get event the parameter id: int FrSimEventGetParamId (FrSimEvent *event, char* paramName); This function returns the parameter number in the list or -1 if the parameter could not be found. The parameter value could then be access at event->parameters[id].
- To find the pointer to a vector attached to the event:
FrVect* FrSimEventFindVect (FrEvent *event, char* vectName);
This function returns a pointer to the vector or NULL if not found. The user should NOT free the vector.- To return a copy of a vector attached to the event:
FrVect* FrSimEventGetVect D(FrEvent *event, char* vectName);
FrVect* FrSimEventGetVect F(FrEvent *event, char* vectName);- This function returns a pointer to a copy of type double (..VectD) or float (...VectF) of a vector or NULL if not found. The user MUST free the vector after its use.
- To find all the events within a given time range and with some selection on the event amplitude:
FrSimEvent *FrSimEventReadT (FrFile *iFile, char *name, double tStart, double length, double amplitudeMin, double amplitudeMax);
This function perform a random read access on the file *iFile. It returns all FrEvent structure (as a linked list) which have a time between tStart and tStart+length and with an amplitude in the [amplitudeMin, amplitudeMax] range. It does NOT returns the associated vector nor the associated tables. The string name could contain several names and wild cards. The function returns a pointer to the first FrEvent structure of the linked list or NULL in case of error (frame not in file, not Table Of Content, malloc failed).- To find all the events within a given time range and with some selection on several parameters.:
FrSimEvent *FrSimEventReadTF (FrFile *iFile, char *name, double tStart, double length, int readData, int nParam, ...);
the additional parameters are: char* paramName1, double min1, double max1, char* paramName2, ...) where the paramName* are "amplitude", "timeBefore", "timeAfter" or one of the extra event parameter
This function perform a random read access on the file *iFile. It returns all FrEvent structure (as a linked list) which have a time between tStart and tStart+length and with the extra parameters in the required range.The associated vector is read if the readData flag is set to 1 (or not read if set to 0). The string name could contain several names and wild cards. The function returns a pointer to the first FrEvent structure of the linked list or NULL in case of error (frame not in file, not Table Of Content, malloc failed).
Example of use: event = FrEventReadTF(iFile,"Inspiral*",t0,50.,1, 2, "M1", 2., 3., "M2", 1., 3.); will return the linked list of all events with a name starting by Inspiral, with a time in the t0, t0+5à range, with a parameter M1 (and M2) in the range 2.;3. (1.;3.).
name the name of the vector
sampleRate: sampling frequency
nData The number of elements (0 is a valid value)
nBits: number of bits.