/***************************************************************************** * Johns Hopkins University * Center For Astrophysical Sciences * FUSE ***************************************************************************** * * Synopsis: cf_fifo_dead_time(fitsfile *header, long nevents, * float *ptime, long nseconds, float *ttime, float *aic_rate, * float *ids_dtc) * * Description: Searches high-count-rate observations for data drop-outs * due to FIFO overflows. If found, calculates time-dependent * scale factor to correct for lost photon events. * * Arguments: fitsfile *header Pointer to FITS file containing the * header of the intermediate data file * long nevents Number of photon events in the file * float *ptime Detection time for each photon * long nseconds The number of timeline values * float *ttime Tabulated times in the timeline * float *aic_rate Active Image Counter array * float *ids_dtc IDS dead-time correction array * (modified) * * Calls: * * Return: 0 on success * * History of cf_screen_fifo_overflow: * * 02/10/04 1.1 wvd Begin work * 02/17/05 1.2 wvd Place parentheses around assignment * used as truth value. * 11/09/05 1.3 wvd In the current scheme, the rate_lif * and rate_sic arrays contain values * from the housekeeping file and do * not reflect data loss due to FIFO * overflows. Now we calculate the * count-rate array directly from the * photon time array. * 02/23/06 1.4 wvd Change length of data_rate array * from nevents to nseconds. * * History: 12/29/06 1.1 wvd Derived from cf_screen_fifo_overflow. * 01/15/07 1.2 wvd When count rate is zero, correct one * second before to two seconds after. * 02/08/07 1.3 wvd If TTPERIOD = 0, set it to 1. * 04/07/07 1.4 wvd Clean up compiler warnings. * ****************************************************************************/ #include #include "calfuse.h" int compute_count_rate(long nevents, float *ptime, long nseconds, float *ttime, long **data_rate) { float delta_max = 1.0 + FRAME_TOLERANCE; long j,k; *data_rate = (long *) cf_calloc(nseconds, sizeof(long)); for (j=k=0; j 3200, look for data drop-outs. */ if (mean_ids_rate > 3200 && nseconds > 4) { compute_count_rate(nevents, ptime, nseconds, ttime, &data_rate); flag_array = (int *) cf_calloc(nseconds, sizeof(int)); /* If count rate goes to zero, set flag_array. Where possible, set flags from one second before to two seconds after. */ for (k=0; k<1; k++) if (data_rate[k] == 0) flag_array[k] = flag_array[k+1] = flag_array[k+2] = TRUE; for ( ; k