Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
dm_list = list(map(np.float32, list(dm_arr)))
time_list = list(map(np.float32, list(time_arr)))
if integrate_spec:
sp_pgplot.ppgplot.pgsvp(0.55, 0.97, 0.1, 0.54)
else:
sp_pgplot.ppgplot.pgsvp(0.48, 0.97, 0.1, 0.54)
dms, times, sigmas, widths, filelist = spio.gen_arrays(dm_arr, spfiles, tar, threshold)
sp_pgplot.dm_time_plot(dms, times, sigmas, dm_list, sigma_arr, time_list, Total_observed_time, xwin)
else:
print("You need a .singlepulse.tgz file to plot DM vs Time plot.")
if integrate_spec:
sp_pgplot.ppgplot.pgsvp(0.55, 0.97, 0.1, 0.54)
else:
sp_pgplot.ppgplot.pgsvp(0.48, 0.97, 0.1, 0.54)
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)")
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.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.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.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.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.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)
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.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.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.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.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('B', 2.5, 0.5, 0.5, "DM (pc cm\\u-3\\d)")
sp_pgplot.ppgplot.pgopen(fn[:-5]+'_DM%.1f_%.1fs.spd.ps/VPS'%(subdm, (start+loc_pulse*duration)))
else:
if rank:
sp_pgplot.ppgplot.pgopen(outfile+'_DM%.1f_%.1fs_rank_%i.spd.ps/VPS'%(subdm, (start+loc_pulse*duration), rank))
else:
sp_pgplot.ppgplot.pgopen(outfile+'_DM%.1f_%.1fs.spd.ps/VPS'%(subdm, (start+loc_pulse*duration)))
if (just_waterfall == False):
sp_pgplot.ppgplot.pgpap(10.25, 8.5/11.0)
# Dedispersed waterfall plot - zerodm - OFF
array = spdobj.data_nozerodm_dedisp.astype(np.float64)
sp_pgplot.ppgplot.pgsvp(0.07, 0.40, 0.50, 0.80)
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)")
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.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.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.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.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)