How to use the presto.singlepulse.sp_pgplot.ppgplot.pgsvp function in presto

To help you get started, we’ve selected a few presto examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github scottransom / presto / bin / plot_spd.py View on Github external
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")

        # DM vs Time
        print("Making arrays for DM vs time plot")
        spfiles = singlepulsefiles
        threshold = 5.0
        if len(spfiles) > 2:
            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)")
github scottransom / presto / bin / plot_spd.py View on Github external
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.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
github scottransom / presto / python / presto / singlepulse / plot_spd.py View on Github external
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)
            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:
github scottransom / presto / python / presto / singlepulse / plot_spd.py View on Github external
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.pgmtxt('L', 1.8, 0.5, 0.5, "Signal-to-noise")

        # DM vs Time
        print("Making arrays for DM vs time plot")
        spfiles = singlepulsefiles
        threshold = 5.0
        if len(spfiles) > 2:
            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)
github scottransom / presto / bin / plot_spd.py View on Github external
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)")
        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)
github scottransom / presto / bin / plot_spd.py View on Github external
else:
        if (outfile == "spdplot"): # default filename
            if rank:
                sp_pgplot.ppgplot.pgopen(fn[:-5]+'_DM%.1f_%.1fs_rank_%i.spd.ps/VPS'%(subdm, (start+loc_pulse*duration), rank))
            else:
                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))
github scottransom / presto / bin / plot_spd.py View on Github external
sp_pgplot.ppgplot.pgmtxt('T', -13.1, 0.01, 0.0, "Number of subbands: %i" %nsub)
        sp_pgplot.ppgplot.pgmtxt('T', -14.6, 0.01, 0.0, "Pulse width: %.2f ms" %(pulse_width*1e3))
        sp_pgplot.ppgplot.pgmtxt('T', -16.1, 0.01, 0.0, "Sampling time: %.3f \gms" %(tsamp*1e6))
        sp_pgplot.ppgplot.pgmtxt('T', -17.6, 0.0, 0.0, "Bary pulse peak time: %.2f s" %(bary_start))
        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)
github scottransom / presto / bin / plot_spd.py View on Github external
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]
            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.5, 0.8)
            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
        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)
github scottransom / presto / python / presto / singlepulse / plot_spd.py View on Github external
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.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)
github scottransom / presto / python / presto / singlepulse / plot_spd.py View on Github external
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.pgmtxt('T', -5.3, 0.35, 0.0, "Number of samples: %i" % nbins)
        sp_pgplot.ppgplot.pgmtxt('T', -1.1, 0.65, 0.0, "Number of subbands: %i" % nsub)
        sp_pgplot.ppgplot.pgmtxt('T', -2.5, 0.65, 0.0, "Pulse width: %.2f ms" % (pulse_width * 1e3))
        sp_pgplot.ppgplot.pgmtxt('T', -3.9, 0.65, 0.0, "Sampling time: %.3f \gms" % (tsamp * 1e6))