added downsampling to plotter
This commit is contained in:
parent
e6903cd188
commit
14dc9acf57
12
signalgen.py
12
signalgen.py
|
@ -13,6 +13,7 @@ from scipy.stats import median_abs_deviation
|
||||||
from your import Your, Writer
|
from your import Your, Writer
|
||||||
from your.formats.filwriter import make_sigproc_object
|
from your.formats.filwriter import make_sigproc_object
|
||||||
from will import create, inject
|
from will import create, inject
|
||||||
|
from scipy import signal
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,8 +44,13 @@ def show_dynamic(
|
||||||
|
|
||||||
save - Save the plot as `title` + `.png`
|
save - Save the plot as `title` + `.png`
|
||||||
"""
|
"""
|
||||||
spectra_mads = median_fitter(np.median(dynamic_spectra, axis=0))
|
|
||||||
flat = dynamic_spectra - spectra_mads
|
#downsample the spectra first
|
||||||
|
downFac = max(np.shape(dynamic_spectra)) // 8096
|
||||||
|
decSpectra = signal.decimate(dynamic_spectra, downFac, axis=1)
|
||||||
|
|
||||||
|
spectra_mads = median_fitter(np.median(decSpectra, axis=0))
|
||||||
|
flat = decSpectra - spectra_mads
|
||||||
std = median_abs_deviation(flat, axis=None)
|
std = median_abs_deviation(flat, axis=None)
|
||||||
med = np.median(flat)
|
med = np.median(flat)
|
||||||
plt.figure(figsize=(20, 10))
|
plt.figure(figsize=(20, 10))
|
||||||
|
@ -198,7 +204,7 @@ if __name__ == "__main__":
|
||||||
logging.info(f"Running with file {values.file}")
|
logging.info(f"Running with file {values.file}")
|
||||||
if values.plot:
|
if values.plot:
|
||||||
filterbankObj = Your(values.file)
|
filterbankObj = Your(values.file)
|
||||||
spectra = filterbankObj.get_data(0, 8096)
|
spectra = filterbankObj.get_data(0, 524288)
|
||||||
show_dynamic(spectra, f"{values.file} Dynamic Spectra", save=True)
|
show_dynamic(spectra, f"{values.file} Dynamic Spectra", save=True)
|
||||||
else:
|
else:
|
||||||
addBurst(values)
|
addBurst(values)
|
||||||
|
|
Loading…
Reference in a new issue