import numpy as np from sigpyproc.Readers import FilReader import sys from DM_calculate import time_delay import matplotlib.pyplot as plt if __name__ == '__main__': DM_range = [50, 100] f_dir = '../data/' f_name = 'noise_level_test.fil' f = FilReader(f_dir + f_name) data = f.dedisperse(100) std = data[:2000].std() mean = data[:2000].mean() # snr = (data.max()-mean)/std snr = (data.max() - data.mean()) / data.std() lo = np.where(data == data.max()) flag = 0 for i in range(len(lo[0])): if 2490 < lo[i][0] < 2505: flag = 1 print 'True' else: print 'False' print snr plt.plot(data) plt.show() exit(1) hdr = f.header ftop = hdr['ftop'] nsample = hdr['nsamples']
import numpy as np import matplotlib.pyplot as plt from sigpyproc.Readers import FilReader import time t1 = time.time() f_dir = '../data/' f_name = 'out.fil' f = FilReader(f_dir + f_name) #dm = np.linspace(1,2000,1000) DM = 100 snr = [] dd = f.dedisperse(DM) snr = (dd.max() - dd.mean()) / dd.std() t2 = time.time() t_tol = t2 - t1 print "Time Total:", t_tol, " s = ", t_tol / 60., " m" plt.title("SNR:" + str(snr)) plt.xlabel("SRC:" + f.header['source_name']) plt.plot(dd) plt.show()
from sys import argv from sigpyproc.Readers import FilReader fil = FilReader(argv[1]) tim = fil.dedisperse(float(argv[2])).toFile("%s_DM%s.tim"%(fil.header.basename,argv[2]))
import numpy as np import matplotlib.pyplot as plt from sigpyproc.Readers import FilReader import time import sys f_dir = '../data/' f_name = 'fake_test.fil' f = FilReader(f_dir + f_name) DM = float(sys.argv[1]) t1 = time.time() d = f.dedisperse(DM) t2 = time.time() t_c = (t2 - t1) / 60 d0 = f.dedisperse(0) snr = (d.max() - d.mean()) / d.std() lo = np.where(d == d.max()) print 'SNR:', snr print 'DM:', DM print 'Location:', lo[0] print 'Dedispersion cost:', t_c, '(min)' print 'Data length(at DM:' + str(DM) + '): ', d.shape[0] print 'Data length(at DM0): ', d0.shape[0] plt.figure(figsize=[14, 8]) plt.plot(d, label='DM at ' + str(DM) + ', SNR:' + str(int(snr))) plt.plot(d0, label='DM at 0') plt.plot(lo[0], d[lo[0]], 'ro', label='Max loc:' + str(lo[0])) plt.grid() plt.legend(loc='best') plt.show()
from sys import argv from sigpyproc.Readers import FilReader fil = FilReader(argv[1]) tim = fil.dedisperse(float( argv[2])).toFile(f"{fil.header.basename}_DM{argv[2]}.tim")
from sys import argv from sigpyproc.Readers import FilReader fil = FilReader(argv[1]) tim = fil.dedisperse(float(argv[2])).toFile("%s_DM%s.tim" % (fil.header.basename, argv[2]))
#!/usr/bin/python from sigpyproc.Readers import FilReader import sigpyproc.Filterbank import matplotlib.pyplot as plt import numpy as np import pandas as pd #compute the bandpass and frequency of each channel fil = FilReader("test500.fil") tim = fil.dedisperse(56.75).toFile(filename="test500.tim") print(tim)