Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
#### Plot Spectrum - Zerodm filter - On
if integrate_spec:
spectrum_window = spec_width*pulse_width
window_width = int(spectrum_window/datasamp)
#burst_bin = int(datanumspectra*loc_pulse/downsamp)
burst_bin = int(nbins*loc_pulse/downsamp)
on_spec = array[..., burst_bin-window_width:burst_bin+window_width]
Dedisp_spec = on_spec.sum(axis=1)
freqs = np.linspace(min_freq, max_freq, len(Dedisp_spec))
sp_pgplot.ppgplot.pgsvp(0.70, 0.90, 0.05, 0.36)
sp_pgplot.ppgplot.pgswin(np.min(Dedisp_spec), 1.05*np.max(Dedisp_spec), min_freq, max_freq)
sp_pgplot.ppgplot.pgsch(0.8)
sp_pgplot.ppgplot.pgslw(3)
sp_pgplot.ppgplot.pgbox("BC", 0, 0, "BC", 0, 0)
sp_pgplot.ppgplot.pgsci(1)
sp_pgplot.ppgplot.pgline(Dedisp_spec,freqs)
sp_pgplot.ppgplot.pgmtxt('R', 1.8, 0.5, 0.5, "Zero-dm filtering - On")
sp_pgplot.ppgplot.pgsch(0.7)
sp_pgplot.ppgplot.pgmtxt('T', 1.8, 0.5, 0.5, "Spectrum")
sp_pgplot.ppgplot.pgsch(0.8)
if disp_pulse:
# Sweeped waterfall plot Zerodm - OFF
array = spdobj.data_nozerodm.astype(np.float64)
sp_pgplot.ppgplot.pgsvp(0.3, 0.70, 0.44, 0.65)
sp_pgplot.ppgplot.pgswin(sweeped_start, sweeped_start+sweep_duration, min_freq, max_freq)
sp_pgplot.ppgplot.pgsch(0.8)
sp_pgplot.ppgplot.pgslw(4)
sp_pgplot.ppgplot.pgbox("BCST", 0, 0, "BCST", 0, 0)
sp_pgplot.ppgplot.pgsch(3)
sp_pgplot.plot_waterfall(array,rangex = [sweeped_start, sweeped_start+sweep_duration],rangey = [min_freq, max_freq],image = 'apjgrey')
delays = spdobj.dmsweep_delays
freqs = spdobj.dmsweep_freqs
sp_pgplot.ppgplot.pgmtxt('R', 1.8, 0.5, 0.5, "Zero-dm filtering - On")
array = spdobj.data_zerodm_dedisp.astype(np.float64)
sp_pgplot.plot_waterfall(array, rangex=[datastart - start, datastart - start + datanumspectra * datasamp],
rangey=[min_freq, max_freq], image='apjgrey')
#### Plot Dedispersed Time series - Zerodm filter - On
dedisp_ts = array[::-1].sum(axis=0)
times = np.arange(datanumspectra) * datasamp
if integrate_ts:
sp_pgplot.ppgplot.pgsvp(0.07, 0.40, 0.40, 0.50)
sp_pgplot.ppgplot.pgswin(datastart - start, datastart - start + duration, np.min(dedisp_ts),
1.05 * np.max(dedisp_ts))
sp_pgplot.ppgplot.pgsch(0.8)
sp_pgplot.ppgplot.pgslw(3)
sp_pgplot.ppgplot.pgbox("BC", 0, 0, "BC", 0, 0)
sp_pgplot.ppgplot.pgsci(1)
sp_pgplot.ppgplot.pgline(times, dedisp_ts)
errx1 = np.array([0.60 * (datastart - start + duration)])
erry1 = np.array([0.60 * np.max(dedisp_ts)])
erry2 = np.array([np.std(dedisp_ts)])
errx2 = np.array([pulse_width])
sp_pgplot.ppgplot.pgerrb(5, errx1, erry1, errx2, 1.0)
sp_pgplot.ppgplot.pgpt(errx1, erry1, -1)
#### Plot Spectrum - Zerodm filter - On
if integrate_spec:
spectrum_window = spec_width * pulse_width
window_width = int(spectrum_window / datasamp)
# burst_bin = int(datanumspectra*loc_pulse/downsamp)
burst_bin = int(nbins * loc_pulse / downsamp)
on_spec = array[..., burst_bin - window_width:burst_bin + window_width]
Dedisp_spec = on_spec.sum(axis=1)
freqs = np.linspace(min_freq, max_freq, len(Dedisp_spec))
sp_pgplot.ppgplot.pgslw(3)
# Sweeped waterfall plot Zerodm - ON
array = spdobj.data_zerodm.astype(np.float64)
sp_pgplot.ppgplot.pgsvp(0.3, 0.70, 0.05, 0.25)
sp_pgplot.ppgplot.pgswin(sweeped_start, sweeped_start + sweep_duration, min_freq, max_freq)
sp_pgplot.ppgplot.pgsch(0.8)
sp_pgplot.ppgplot.pgslw(4)
sp_pgplot.ppgplot.pgbox("BCST", 0, 0, "BCST", 0, 0)
sp_pgplot.ppgplot.pgsch(3)
sp_pgplot.plot_waterfall(array, rangex=[sweeped_start, sweeped_start + sweep_duration],
rangey=[min_freq, max_freq], image='apjgrey')
sp_pgplot.ppgplot.pgslw(5)
sweepstart = sweeped_start - 0.2 * sweep_duration
sp_pgplot.ppgplot.pgsci(0)
sp_pgplot.ppgplot.pgline(delays + sweepstart, freqs)
sp_pgplot.ppgplot.pgsci(1)
#### Figure texts
sp_pgplot.ppgplot.pgsvp(0.05, 0.95, 0.8, 0.9)
sp_pgplot.ppgplot.pgsch(0.65)
sp_pgplot.ppgplot.pgslw(3)
sp_pgplot.ppgplot.pgmtxt('T', -1.1, 0.01, 0.0, "RA: %s" % RA)
sp_pgplot.ppgplot.pgmtxt('T', -2.5, 0.01, 0.0, "DEC: %s" % dec)
sp_pgplot.ppgplot.pgmtxt('T', -3.9, 0.01, 0.0, "MJD: %f" % MJD)
sp_pgplot.ppgplot.pgmtxt('T', -5.3, 0.01, 0.0, "Obs date: %s %s %s" % (date[0], date[1], date[2]))
sp_pgplot.ppgplot.pgmtxt('T', -1.1, 0.35, 0.0, "Telescope: %s" % telescope)
sp_pgplot.ppgplot.pgmtxt('T', -2.5, 0.35, 0.0, "DM: %.2f pc cm\\u-3\\d" % dm)
if sigma:
sp_pgplot.ppgplot.pgmtxt('T', -3.9, 0.35, 0.0, "S/N\\dMAX\\u: %.2f" % sigma)
else:
sp_pgplot.ppgplot.pgmtxt('T', -3.9, 0.35, 0.0, "S/N\\dMAX\\u: N/A")
sp_pgplot.ppgplot.pgbox("BCST", 0, 0, "BCNST", 0, 0)
sp_pgplot.ppgplot.pgslw(3)
sp_pgplot.ppgplot.pgmtxt('L', 1.8, 0.5, 0.5, "Observing Frequency (MHz)")
sp_pgplot.plot_waterfall(array,rangex = [datastart-start, datastart-start+datanumspectra*datasamp], rangey = [min_freq, max_freq], image = 'apjgrey')
#### Plot Dedispersed Time series - Zerodm filter - Off
Dedisp_ts = array[::-1].sum(axis = 0)
times = np.arange(datanumspectra)*datasamp
if integrate_ts:
sp_pgplot.ppgplot.pgsvp(0.1, 0.70, 0.75, 0.83)
sp_pgplot.ppgplot.pgswin(datastart - start, datastart-start+duration, np.min(Dedisp_ts), 1.05*np.max(Dedisp_ts))
sp_pgplot.ppgplot.pgsch(0.8)
sp_pgplot.ppgplot.pgslw(3)
sp_pgplot.ppgplot.pgbox("BC", 0, 0, "BC", 0, 0)
sp_pgplot.ppgplot.pgsci(1)
sp_pgplot.ppgplot.pgline(times,Dedisp_ts)
sp_pgplot.ppgplot.pgslw(3)
sp_pgplot.ppgplot.pgsci(1)
errx1 = np.array([0.60 * (datastart-start+duration)])
erry1 = np.array([0.60 * np.max(Dedisp_ts)])
erry2 = np.array([np.std(Dedisp_ts)])
errx2 = np.array([pulse_width])
sp_pgplot.ppgplot.pgerrb(5, errx1, erry1, errx2, 1.0)
sp_pgplot.ppgplot.pgpt(errx1, erry1, -1)
#### Plot Spectrum - Zerodm filter - Off
if integrate_spec:
spectrum_window = spec_width*pulse_width
window_width = int(spectrum_window/datasamp)
#burst_bin = int(datanumspectra*loc_pulse/downsamp)
burst_bin = int(nbins*loc_pulse/downsamp)
on_spec = array[..., burst_bin-window_width:burst_bin+window_width]
if disp_pulse:
# Sweeped waterfall plot Zerodm - OFF
array = spdobj.data_nozerodm.astype(np.float64)
sp_pgplot.ppgplot.pgsvp(0.20, 0.40, 0.50, 0.70)
sp_pgplot.ppgplot.pgswin(sweeped_start, sweeped_start+sweep_duration, min_freq, max_freq)
sp_pgplot.ppgplot.pgsch(0.8)
sp_pgplot.ppgplot.pgslw(4)
sp_pgplot.ppgplot.pgbox("BCST", 0, 0, "BCST", 0, 0)
sp_pgplot.ppgplot.pgsch(3)
sp_pgplot.plot_waterfall(array,rangex = [sweeped_start, sweeped_start+sweep_duration],rangey = [min_freq, max_freq],image = 'apjgrey')
delays = spdobj.dmsweep_delays
freqs = spdobj.dmsweep_freqs
sp_pgplot.ppgplot.pgslw(5)
sweepstart = sweeped_start- 0.2*sweep_duration
sp_pgplot.ppgplot.pgsci(0)
sp_pgplot.ppgplot.pgline(delays+sweepstart, freqs)
sp_pgplot.ppgplot.pgsci(1)
sp_pgplot.ppgplot.pgslw(3)
# Sweeped waterfall plot Zerodm - ON
array = spdobj.data_zerodm.astype(np.float64)
sp_pgplot.ppgplot.pgsvp(0.20, 0.40, 0.1, 0.3)
sp_pgplot.ppgplot.pgswin(sweeped_start, sweeped_start+sweep_duration, min_freq, max_freq)
sp_pgplot.ppgplot.pgsch(0.8)
sp_pgplot.ppgplot.pgslw(4)
sp_pgplot.ppgplot.pgbox("BCST", 0, 0, "BCST", 0, 0)
sp_pgplot.ppgplot.pgsch(3)
sp_pgplot.plot_waterfall(array,rangex = [sweeped_start, sweeped_start+sweep_duration],rangey = [min_freq, max_freq],image = 'apjgrey')
sp_pgplot.ppgplot.pgslw(5)
sweepstart = sweeped_start- 0.2*sweep_duration
sp_pgplot.ppgplot.pgsci(0)
sp_pgplot.ppgplot.pgline(delays+sweepstart, freqs)
#### Plot Spectrum - Zerodm filter - Off
if integrate_spec:
spectrum_window = spec_width * pulse_width
window_width = int(spectrum_window / datasamp)
# burst_bin = int(datanumspectra*loc_pulse/downsamp)
burst_bin = int(nbins * loc_pulse / downsamp)
on_spec = array[..., burst_bin - window_width:burst_bin + window_width]
Dedisp_spec = on_spec.sum(axis=1)
freqs = np.linspace(min_freq, max_freq, len(Dedisp_spec))
sp_pgplot.ppgplot.pgsvp(0.7, 0.9, 0.44, 0.75)
sp_pgplot.ppgplot.pgswin(np.min(Dedisp_spec), 1.05 * np.max(Dedisp_spec), min_freq, max_freq)
sp_pgplot.ppgplot.pgsch(0.8)
sp_pgplot.ppgplot.pgslw(3)
sp_pgplot.ppgplot.pgbox("BC", 0, 0, "BC", 0, 0)
sp_pgplot.ppgplot.pgsci(1)
sp_pgplot.ppgplot.pgline(Dedisp_spec, freqs)
sp_pgplot.ppgplot.pgmtxt('R', 1.8, 0.5, 0.5, "Zero-dm filtering - Off")
sp_pgplot.ppgplot.pgsch(0.7)
sp_pgplot.ppgplot.pgmtxt('T', 1.8, 0.5, 0.5, "Spectrum")
sp_pgplot.ppgplot.pgsch(0.8)
# Dedispersed waterfall plot - Zerodm ON
array = spdobj.data_zerodm_dedisp.astype(np.float64)
sp_pgplot.ppgplot.pgsvp(0.1, 0.70, 0.05, 0.36)
sp_pgplot.ppgplot.pgswin(datastart - start, datastart - start + datanumspectra * datasamp, min_freq, max_freq)
sp_pgplot.ppgplot.pgsch(0.8)
sp_pgplot.ppgplot.pgslw(3)
sp_pgplot.ppgplot.pgbox("BCNST", 0, 0, "BCNST", 0, 0)
sp_pgplot.ppgplot.pgmtxt('B', 2.5, 0.5, 0.5, "Time - %.2f s" % datastart)
sp_pgplot.ppgplot.pgmtxt('L', 1.8, 0.5, 0.5, "Observing Frequency (MHz)")
sp_pgplot.plot_waterfall(array, rangex=[datastart - start, datastart - start + datanumspectra * datasamp],
rangey=[min_freq, max_freq], image='apjgrey')
sp_pgplot.ppgplot.pgslw(3)
# Sweeped waterfall plot Zerodm - ON
array = spdobj.data_zerodm.astype(np.float64)
sp_pgplot.ppgplot.pgsvp(0.20, 0.40, 0.1, 0.3)
sp_pgplot.ppgplot.pgswin(sweeped_start, sweeped_start + sweep_duration, min_freq, max_freq)
sp_pgplot.ppgplot.pgsch(0.8)
sp_pgplot.ppgplot.pgslw(4)
sp_pgplot.ppgplot.pgbox("BCST", 0, 0, "BCST", 0, 0)
sp_pgplot.ppgplot.pgsch(3)
sp_pgplot.plot_waterfall(array, rangex=[sweeped_start, sweeped_start + sweep_duration],
rangey=[min_freq, max_freq], image='apjgrey')
sp_pgplot.ppgplot.pgslw(5)
sweepstart = sweeped_start - 0.2 * sweep_duration
sp_pgplot.ppgplot.pgsci(0)
sp_pgplot.ppgplot.pgline(delays + sweepstart, freqs)
sp_pgplot.ppgplot.pgsci(1)
#### Figure texts
if integrate_spec:
sp_pgplot.ppgplot.pgsvp(0.81, 0.97, 0.64, 0.909)
sp_pgplot.ppgplot.pgsch(0.62)
else:
sp_pgplot.ppgplot.pgsvp(0.745, 0.97, 0.64, 0.909)
sp_pgplot.ppgplot.pgsch(0.7)
sp_pgplot.ppgplot.pgslw(3)
sp_pgplot.ppgplot.pgmtxt('T', -1.1, 0.01, 0.0, "RA: %s" % RA)
sp_pgplot.ppgplot.pgmtxt('T', -2.6, 0.01, 0.0, "DEC: %s" % dec)
sp_pgplot.ppgplot.pgmtxt('T', -4.1, 0.01, 0.0, "MJD: %f" % MJD)
sp_pgplot.ppgplot.pgmtxt('T', -5.6, 0.01, 0.0, "Obs date: %s %s %s" % (date[0], date[1], date[2]))
sp_pgplot.ppgplot.pgmtxt('T', -7.1, 0.01, 0.0, "Telescope: %s" % telescope)
sp_pgplot.ppgplot.pgmtxt('T', -8.6, 0.01, 0.0, "DM: %.2f pc cm\\u-3\\d" % dm)
sp_pgplot.ppgplot.pgmtxt('R', 1.8, 0.5, 0.5, "Zero-dm filtering - Off")
sp_pgplot.plot_waterfall(array, rangex=[datastart - start, datastart - start + datanumspectra * datasamp],
rangey=[min_freq, max_freq], image='apjgrey')
#### Plot Dedispersed Time series - Zerodm filter - Off
Dedisp_ts = array[::-1].sum(axis=0)
times = np.arange(datanumspectra) * datasamp
if integrate_ts:
sp_pgplot.ppgplot.pgsvp(0.07, 0.40, 0.80, 0.90)
sp_pgplot.ppgplot.pgswin(datastart - start, datastart - start + duration, np.min(Dedisp_ts),
1.05 * np.max(Dedisp_ts))
sp_pgplot.ppgplot.pgsch(0.8)
sp_pgplot.ppgplot.pgslw(3)
sp_pgplot.ppgplot.pgbox("BC", 0, 0, "BC", 0, 0)
sp_pgplot.ppgplot.pgsci(1)
sp_pgplot.ppgplot.pgline(times, Dedisp_ts)
sp_pgplot.ppgplot.pgslw(3)
sp_pgplot.ppgplot.pgsci(1)
errx1 = np.array([0.60 * (datastart - start + duration)])
erry1 = np.array([0.60 * np.max(Dedisp_ts)])
erry2 = np.array([np.std(Dedisp_ts)])
errx2 = np.array([pulse_width])
sp_pgplot.ppgplot.pgerrb(5, errx1, erry1, errx2, 1.0)
sp_pgplot.ppgplot.pgpt(errx1, erry1, -1)
#### Plot Spectrum - Zerodm filter - Off
if integrate_spec:
spectrum_window = spec_width * pulse_width
window_width = int(spectrum_window / datasamp)
# burst_bin = int(datanumspectra*loc_pulse/downsamp)
burst_bin = int(nbins * loc_pulse / downsamp)
#### Plot Spectrum - Zerodm filter - On
if integrate_spec:
spectrum_window = spec_width * pulse_width
window_width = int(spectrum_window / datasamp)
# burst_bin = int(datanumspectra*loc_pulse/downsamp)
burst_bin = int(nbins * loc_pulse / downsamp)
on_spec = array[..., burst_bin - window_width:burst_bin + window_width]
Dedisp_spec = on_spec.sum(axis=1)
freqs = np.linspace(min_freq, max_freq, len(Dedisp_spec))
sp_pgplot.ppgplot.pgsvp(0.70, 0.90, 0.05, 0.36)
sp_pgplot.ppgplot.pgswin(np.min(Dedisp_spec), 1.05 * np.max(Dedisp_spec), min_freq, max_freq)
sp_pgplot.ppgplot.pgsch(0.8)
sp_pgplot.ppgplot.pgslw(3)
sp_pgplot.ppgplot.pgbox("BC", 0, 0, "BC", 0, 0)
sp_pgplot.ppgplot.pgsci(1)
sp_pgplot.ppgplot.pgline(Dedisp_spec, freqs)
sp_pgplot.ppgplot.pgmtxt('R', 1.8, 0.5, 0.5, "Zero-dm filtering - On")
sp_pgplot.ppgplot.pgsch(0.7)
sp_pgplot.ppgplot.pgmtxt('T', 1.8, 0.5, 0.5, "Spectrum")
sp_pgplot.ppgplot.pgsch(0.8)
if disp_pulse:
# Sweeped waterfall plot Zerodm - OFF
array = spdobj.data_nozerodm.astype(np.float64)
sp_pgplot.ppgplot.pgsvp(0.3, 0.70, 0.44, 0.65)
sp_pgplot.ppgplot.pgswin(sweeped_start, sweeped_start + sweep_duration, min_freq, max_freq)
sp_pgplot.ppgplot.pgsch(0.8)
sp_pgplot.ppgplot.pgslw(4)
sp_pgplot.ppgplot.pgbox("BCST", 0, 0, "BCST", 0, 0)
sp_pgplot.ppgplot.pgsch(3)
sp_pgplot.plot_waterfall(array, rangex=[sweeped_start, sweeped_start + sweep_duration],
rangey=[min_freq, max_freq], image='apjgrey')
delays = spdobj.dmsweep_delays