From efc75eede683180810e6a88fe7ada15190318c63 Mon Sep 17 00:00:00 2001 From: Ben Kaiser Date: Fri, 2 Feb 2018 12:56:32 -0500 Subject: [PATCH] resolution to issue #14 by casting the steps to float32 before time-binning then recasting to float64 before calculating MJD values. Also the time step is calculated to be the multiple of 0.032 seconds (COS refresh rate) that is just less than the input time bin. --- lightcurve/cos.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lightcurve/cos.py b/lightcurve/cos.py index e8ac980..7fb83f9 100644 --- a/lightcurve/cos.py +++ b/lightcurve/cos.py @@ -82,6 +82,7 @@ def extract(filename, **kwargs): verbosity = kwargs.get('verbosity', 0) step = kwargs.get('step', 1) + step = step - (step% 0.032) #step recalculated as a multiple of the base refresh rate (32 ms) wlim = kwargs.get('wlim', None) #-- If not specific wavlengths, truncate to good wavelengths #-- for each detector @@ -144,7 +145,7 @@ def extract(filename, **kwargs): end = min(end, exptime) - all_steps = np.arange(start, end+step, step) + all_steps = np.float32(np.arange(start, end+step, step)) if all_steps[-1] > end: truncate = True @@ -226,7 +227,7 @@ def extract(filename, **kwargs): gross = gross flux = flux - background_flux background = background - mjd = hdu[1].header['EXPSTART'] + np.array(all_steps[:-1]) * SECOND_PER_MJD + mjd = hdu[1].header['EXPSTART'] + np.float_(np.array(all_steps[:-1])) * SECOND_PER_MJD bins = np.ones(len(gross)) * step times = all_steps[:-1]