next up previous contents
Next: Example: locklist program Up: GRASP Routines: Reading/using Caltech Previous: Example: reader program   Contents

Function: find_locked()

0 int find_locked(FILE *fp,int *s_offset,int *s_block,int *e_offset, int *e_block,float *tstart,float *tend,float *srate)
This mid-level function looks in a TTL-locked signal channel (typically, channel.10) and finds the regions of time when the interferometer is locked. The first time it is called, it returns information identifying the start and end times of the first locked region. The second time it is called it returns the start and end times of the second locked region, and so on.

The arguments are:

fp: Input. A pointer to the file containing the TTL lock signal. A typical file name might be ``channel.10".
s_offset: Output. The offset (number of shorts) into the block where the IFO locks. This ranges from 0 to n-1 where the number of data items in block s_block is n. This offset points to the first locked point.
s_block: Output. The number of the data block where the IFO locks. This ranges from 0 to n-1 where the total number of data blocks in the file is n.
e_offset: Output. The offset (number of shorts) into the block where the IFO loses locks. This ranges from 0 to n-1 where the number of data items in the block e_block. This offset points to the last locked point (not to the first unlocked point).
e_block: Output. The number of the data block where the IFO loses lock. This ranges from s_block to n-1 where the total number of data blocks in the file is n.
tstart: Output. The elapsed time in seconds, since the beginning of the run, of the data block in which the first locked point was found. Note: This is not the time of lock acquisition!
tend: Output. The elapsed time in seconds, since the beginning of the run, of the data block in which the last locked point was found. Note: this is not the time at which lock was lost!
srate: Output. The sample rate of the TTL-locked channel, in Hz.

This routine uses read_block() to examine successive sections of the channel.10 data file. It looks for continuous sequences of data points where the value lies between limits (inclusive) LOCKL=1 and LOCKH=10. It returns the start and end points of each successive such sequence. The upper and lower limits can be changed in the code, if desired, however these values appear to be reliable ones.

The integer returned by find_locked() is the actual number of data points in the fast channels, during the locked period. It returns 0 if there are no remaining locked segments.

If there is a gap in the data stream, arising not because the instrument went out of lock, but rather because the tape-writing program was interrupted and then later restarted, find_locked() will print out a warning message, but will otherwise treat this simply as a loss of lock during the period of the missing data.

Author: Bruce Allen, ballen@dirac.phys.uwm.edu
Comments: This function was designed for variable-length blocks. It might be possible to simplify it for fixed-length block sizes.


next up previous contents
Next: Example: locklist program Up: GRASP Routines: Reading/using Caltech Previous: Example: reader program   Contents
Bruce Allen 2000-11-19