Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
sp_pgplot.ppgplot.pgsvp(0.07, 0.7, 0.01, 0.05)
sp_pgplot.ppgplot.pgmtxt('T', -2.1, 0.01, 0.0, "%s" % fn)
# DM vs SNR
if not man_params:
dm_arr = np.float32(spdobj.dmVt_this_dms)
sigma_arr = np.float32(spdobj.dmVt_this_sigmas)
time_arr = np.float32(spdobj.dmVt_this_times)
if integrate_spec:
sp_pgplot.ppgplot.pgsvp(0.55, 0.80, 0.65, 0.90)
else:
sp_pgplot.ppgplot.pgsvp(0.48, 0.73, 0.65, 0.90)
sp_pgplot.ppgplot.pgswin(np.min(dm_arr), np.max(dm_arr), 0.95 * np.min(sigma_arr), 1.05 * np.max(sigma_arr))
sp_pgplot.ppgplot.pgsch(0.8)
sp_pgplot.ppgplot.pgslw(3)
sp_pgplot.ppgplot.pgbox("BCNST", 0, 0, "BCNST", 0, 0)
sp_pgplot.ppgplot.pgslw(3)
sp_pgplot.ppgplot.pgmtxt('B', 2.5, 0.5, 0.5, "DM (pc cm\\u-3\\d)")
sp_pgplot.ppgplot.pgmtxt('L', 1.8, 0.5, 0.5, "Signal-to-noise")
sp_pgplot.ppgplot.pgpt(dm_arr, sigma_arr, 20)
else:
dm_arr = np.array([])
sigma_arr = np.array([])
time_arr = np.array([])
if integrate_spec:
sp_pgplot.ppgplot.pgsvp(0.55, 0.80, 0.65, 0.90)
else:
sp_pgplot.ppgplot.pgsvp(0.48, 0.73, 0.65, 0.90)
sp_pgplot.ppgplot.pgsch(0.8)
sp_pgplot.ppgplot.pgslw(3)
sp_pgplot.ppgplot.pgbox("BCNST", 0, 0, "BCNST", 0, 0)
sp_pgplot.ppgplot.pgslw(3)
sp_pgplot.ppgplot.pgmtxt('L', 1.8, 0.5, 0.5, "Observing Frequency (MHz)")
if not integrate_spec:
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)
sp_pgplot.ppgplot.pgsch(0.8)
sp_pgplot.ppgplot.pgslw(3)
sp_pgplot.ppgplot.pgbox("BCNST", 0, 0, "BCNST", 0, 0)
sp_pgplot.ppgplot.pgslw(3)
sp_pgplot.ppgplot.pgmtxt('B', 2.5, 0.5, 0.5, "Time (s)")
sp_pgplot.ppgplot.pgmtxt('L', 1.8, 0.5, 0.5, "DM (pc cm\u-3\d)")
else:
#sp_pgplot.ppgplot.pgpap(10.25, 10.0/5.0)
sp_pgplot.ppgplot.pgpap(8.0, 1.5)
# Dedispersed waterfall plot - zerodm - OFF
array = spdobj.data_nozerodm_dedisp.astype(np.float64)
sp_pgplot.ppgplot.pgsvp(0.1, 0.70, 0.44, 0.75)
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("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.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.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.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.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.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')
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.pgsvp(0.4, 0.47, 0.1, 0.4)
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.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.ppgplot.pgsch(0.8)
sp_pgplot.ppgplot.pgslw(3)
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)
sp_pgplot.ppgplot.pgsch(0.8)
sp_pgplot.ppgplot.pgslw(3)
sp_pgplot.ppgplot.pgbox("BCNST", 0, 0, "BCNST", 0, 0)
sp_pgplot.ppgplot.pgslw(3)
sp_pgplot.ppgplot.pgmtxt('B', 2.5, 0.5, 0.5, "Time (s)")
sp_pgplot.ppgplot.pgmtxt('L', 1.8, 0.5, 0.5, "DM (pc cm\\u-3\\d)")
else:
# sp_pgplot.ppgplot.pgpap(10.25, 10.0/5.0)
sp_pgplot.ppgplot.pgpap(8.0, 1.5)
# Dedispersed waterfall plot - zerodm - OFF
array = spdobj.data_nozerodm_dedisp.astype(np.float64)
sp_pgplot.ppgplot.pgsvp(0.1, 0.70, 0.44, 0.75)
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("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.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
sp_pgplot.ppgplot.pgsvp(0.07, 0.40, 0.1, 0.40)
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)")
if not integrate_spec:
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)