Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1from scipy import fftpack 

2from .baseMetric import BaseMetric 

3 

4__all__ = ['FftMetric'] 

5 

6class FftMetric(BaseMetric): 

7 """Calculate a truncated FFT of the exposure times.""" 

8 def __init__(self, timesCol='expmjd', metricName='Fft', 

9 nCoeffs=100, **kwargs): 

10 """Instantiate metric. 

11 

12 'timesCol' = column with the time of the visit (default expmjd), 

13 'nCoeffs' = number of coefficients of the (real) FFT to keep.""" 

14 self.times = timesCol 

15 super(FftMetric, self).__init__(col=[self.times], metricName=metricName, **kwargs) 

16 # Set up length of return values. 

17 self.nCoeffs = nCoeffs 

18 return 

19 

20 def run(self, dataSlice, slicePoint=None): 

21 fft = fftpack.rfft(dataSlice[self.times]) 

22 return fft[0:self.nCoeffs] 

23 

24 def reducePeak(self, fftCoeff): 

25 pass