def pf_t(eventfile,par_list,tbin_size,f_pulse,shift,no_phase_bins,t1,t2,mode):
    """
    Obtain the pulsed fraction from the pulse profile for a desired time interval.

    eventfile - path to the event file. Will extract ObsID from this for the NICER files.
    par_list - A list of parameters we'd like to extract from the FITS file
    (e.g., from eventcl, PI_FAST, TIME, PI,)
    tbin_size - the size of the time bins (in seconds!)
    >> e.g., tbin_size = 2 means bin by 2s
    >> e.g., tbin_size = 0.05 means bin by 0.05s!
    f_pulse - the frequency of the pulse
    shift - how much to shift the pulse by in the phase axis.
    It only affects how it is presented.
    no_phase_bins - number of phase bins desired
    t1 - lower time boundary
    t2 - upper time boundary
    mode - whether we want to show or save the plot
    """
    if 'TIME' not in par_list:
        raise ValueError("You should have 'TIME' in the parameter list!")
    if type(par_list) != list and type(par_list) != np.ndarray:
        raise TypeError("par_list should either be a list or an array!")
    if t2<t1:
        raise ValueError("t2 should be greater than t1!")
    if mode != 'show' and mode != 'save' and mode != 'overlap':
        raise ValueError("Mode should either be 'show' or 'save' or 'overlap'!")

    phase,counts = Lv2_phase.partial_t(eventfile,par_list,tbin_size,f_pulse,shift,no_phase_bins,t1,t2,mode)

    phase_ave_mean = np.mean(counts)
    variance = np.var(counts)

    return np.sqrt(variance)/phase_ave_mean
Esempio n. 2
0
                                   mode)

        ########################## FOR DESIRED TIME INTERVAL ##########################
        if truncations == 't':
            if lc == True:
                Lv2_lc.partial_t(out_baryfile, par_list, tbin_size, t1, t2,
                                 mode)  #light curve
                time.sleep(1)
            if ps == True:
                Lv2_ps.partial_t(out_baryfile, par_list, tbin_size, t1, t2,
                                 mode, ps_type, oversampling, xlims,
                                 vlines)  #power spectra
                time.sleep(1)
            if phase == True:
                Lv2_phase.partial_t(out_baryfile, par_list, tbin_size,
                                    pulse_pars, shift, no_phase_bins, t1, t2,
                                    mode)
                time.sleep(1)
            if color == True:
                Lv2_color.plotting_t(out_baryfile, par_list, E_bound,
                                     tbin_size, t1, t2, mode)

        ########################### FOR DESIRED ENERGY RANGE ##########################
        # anticipate that this will be used much?
        if truncations == 'E':
            if lc == True:
                Lv2_lc.partial_E(out_baryfile, par_list, tbin_size, Ebin_size,
                                 E1, E2, mode)
                time.sleep(1)
            if ps == True:
                Lv2_ps.partial_E(out_baryfile, par_list, tbin_size, Ebin_size,
Esempio n. 3
0
            Lv2_color.plotting(eventfiles[i], par_list, E_bound, tbin_size,
                               mode)

    ########################## FOR DESIRED TIME INTERVAL ##########################
    if truncations == 't':
        if lc == True:
            Lv2_lc.partial_t(eventfiles[i], par_list, tbin_size, t1, t2,
                             mode)  #light curve
            time.sleep(1)
        if ps == True:
            Lv2_ps.partial_t(eventfiles[i], par_list, tbin_size, t1, t2, mode,
                             ps_type, oversampling, xlims,
                             vlines)  #power spectra
            time.sleep(1)
        if phase == True:
            Lv2_phase.partial_t(eventfiles[i], par_list, tbin_size, pulse_pars,
                                shift, no_phase_bins, t1, t2, mode)
            time.sleep(1)
        if color == True:
            Lv2_color.plotting_t(eventfiles[i], par_list, E_bound, tbin_size,
                                 t1, t2, mode)

    ########################### FOR DESIRED ENERGY RANGE ##########################
    # won't anticipate that this will be used much?
    if truncations == 'E':
        if lc == True:
            Lv2_lc.partial_E(eventfiles[i], par_list, tbin_size, Ebin_size, E1,
                             E2, mode)
            time.sleep(1)
        if ps == True:
            Lv2_ps.partial_E(eventfiles[i], par_list, tbin_size, Ebin_size, E1,
                             E2, mode, ps_type, oversampling, xlims, vlines)