FRBs / sigpyproc3

Python3 version of Ewan Barr's sigpyproc library
https://sigpyproc3.readthedocs.io
MIT License
14 stars 11 forks source link

FilReader.bandpass(): Divide by samples read, rather than total samples in the filterbank #7

Closed David-McKenna closed 3 years ago

David-McKenna commented 3 years ago

Currently, calling .bandpass() on a FilReader will divide the output by the total number of samples in the filterbank. However, the function has been setup to allow the readPlan to be configured through passing extra kwargs to the function, so this isn't always the number of samples represented by the output bandpass array

This PR changes the loop to sum up the number of time samples being processed, then use this variable to divide the output bandpass.

Comparisons of before (left) / after (right) with different set ups, plotting the log of the bandpass, note that only the axis labelling is changing.

rdr.bandpass(start = 0, nsamps = int(0.003 * rdr.header.nsamples)) image

rdr.bandpass(start = int(0.5 * rdr.header.nsamples), nsamps = int(0.003 * rdr.header.nsamples)) image

pravirkr commented 3 years ago

Cool. I should check this issue in other functions as well!