예제 #1
0
 def test_plot_profile(self):
     import matplotlib.pyplot as plt
     phase, prof, _ = fold_events(self.event_times,
                                  self.pulse_frequency)
     ax = plot_profile(phase, prof)
     plt.savefig('profile_direct.png')
     plt.close(plt.gcf())
예제 #2
0
 def test_plot_profile_existing_ax(self):
     import matplotlib.pyplot as plt
     fig = plt.figure('Pulse profile')
     ax = plt.subplot()
     phase, prof, _ = fold_events(self.event_times,
                                  self.pulse_frequency, ax=ax)
     ax = plot_profile(phase, prof, ax=ax)
     plt.savefig('profile_existing_ax.png')
     plt.close(fig)
예제 #3
0
 def test_plot_profile_existing_ax(self):
     import matplotlib.pyplot as plt
     fig = plt.figure('Pulse profile')
     ax = plt.subplot()
     phase, prof, _ = fold_events(self.event_times,
                                  self.pulse_frequency,
                                  ax=ax)
     ax = plot_profile(phase, prof, ax=ax)
     plt.savefig('profile_existing_ax.png')
     plt.close(fig)
예제 #4
0
def stingphase(evt_data,
               freq,
               figsize=(10, 10),
               nbins=32,
               save=False,
               pname='stingphase',
               mjd=False):
    '''
    Plots Stingray phaseogram.
    Inputs:
    -------
    evt_data
    freq
    
    figsize
    nbins: number of bins for histogram and phaseogram
    save: bool for whether or not to save plot as png
    pname: string of path and name of output png file to save
    
    TO DO:
    add option to put MJD referencce time
    '''
    plt.figure(figsize=figsize)
    gs = GridSpec(2, 1, height_ratios=(1, 3))
    ax0 = plt.subplot(gs[0])
    ax1 = plt.subplot(gs[1], sharex=ax0)
    plt.subplots_adjust(wspace=0, hspace=0)
    phaseogr, phases, times, additional_info = \
            phaseogram(evt_data['TIME'], freq, return_plot=True,nt=nbins,nph=nbins)
    mean_phases = (phases[:-1] + phases[1:]) / 2
    plot_profile(mean_phases, np.sum(phaseogr, axis=1), ax=ax0)
    _ = plot_phaseogram(phaseogr,
                        phases,
                        times,
                        ax=ax1,
                        vmin=np.median(phaseogr))
    if save:
        plt.savefig(pname + '.png', dpi=200, bbox_inches='tight')
예제 #5
0
 def test_plot_profile(self):
     import matplotlib.pyplot as plt
     phase, prof, _ = fold_events(self.event_times, self.pulse_frequency)
     ax = plot_profile(phase, prof)
     plt.savefig('profile_direct.png')
     plt.close(plt.gcf())