gapsim.py
def phase_folding(t,y,T,T0,f,nbins):
    """
    Calculating the folded profile
    Goes from 0 to 2.

    x - array of time values
    y - flux array
    T - sum of all the GTIs
    T0 - reference epoch in MJD
    f - folding frequency
    nbins - number of phase bins desired
    """
    MJDREFI = 51910
    MJDREFF = 7.428703700000000E-04
    TIMEZERO = 0

    t_MJDs =  MJDREFI + MJDREFF + (TIMEZERO+t)/86400

    tau = (t_MJDs-T0)*86400
    #phase = (f*tau + fdot/2 *tau**2 + fdotdot/6*tau**3)%1
    phase = (f*tau)%1

    phase_bins = np.linspace(0,1,nbins+1)
    summed_profile,bin_edges,binnumber = stats.binned_statistic(phase,y,statistic='mean',bins=phase_bins)
    error = np.sqrt(summed_profile*100)/100

    phase_bins_total = np.array(list(phase_bins[:-1]) + list(phase_bins+1))
    summed_profile_total = np.array(list(summed_profile)*2)
    error_total = np.array(list(error)*2) #the 100 should change!!!

    return phase_bins_total, summed_profile_total, error_total

    Calculating the folded profile
    Goes from 0 to 2.

    x - array of time values
    y - flux array
    T - sum of all the GTIs
    T0 - reference epoch in MJD
    f - folding frequency
    nbins - number of phase bins desired
    
Calculating the folded profile
Goes from 0 to 2.


Calculating the folded profile Goes from 0 to 2 .
def phase_folding(t,y,T,T0,f,nbins):
    MJDREFI = 51910
    MJDREFF = 7.428703700000000E-04
    TIMEZERO = 0
    t_MJDs =  MJDREFI + MJDREFF + (TIMEZERO+t)/86400
    tau = (t_MJDs-T0)*86400
    phase = (f*tau)%1
    phase_bins = np.linspace(0,1,nbins+1)
    summed_profile,bin_edges,binnumber = stats.binned_statistic(phase,y,statistic='mean',bins=phase_bins)
    error = np.sqrt(summed_profile*100)/100
    phase_bins_total = np.array(list(phase_bins[:-1]) + list(phase_bins+1))
    summed_profile_total = np.array(list(summed_profile)*2)
    error_total = np.array(list(error)*2) 
    return phase_bins_total, summed_profile_total, error_total
def phase_folding ( t , y , T , T0 , f , nbins ) : MJDREFI = 51910 MJDREFF = 7.428703700000000E-04 TIMEZERO = 0 t_MJDs = MJDREFI + MJDREFF + ( TIMEZERO + t ) / 86400 tau = ( t_MJDs - T0 ) * 86400 phase = ( f * tau ) % 1 phase_bins = np . linspace ( 0 , 1 , nbins + 1 ) summed_profile , bin_edges , binnumber = stats . binned_statistic ( phase , y , statistic = 'mean' , bins = phase_bins ) error = np . sqrt ( summed_profile * 100 ) / 100 phase_bins_total = np . array ( list ( phase_bins [ : - 1 ] ) + list ( phase_bins + 1 ) ) summed_profile_total = np . array ( list ( summed_profile ) * 2 ) error_total = np . array ( list ( error ) * 2 ) return phase_bins_total , summed_profile_total , error_total
Calculating the folded profile
Goes from 0 to 2.
Calculating the folded profile Goes from 0 to 2 .
"""
    Calculating the folded profile
    Goes from 0 to 2.

    x - array of time values
    y - flux array
    T - sum of all the GTIs
    T0 - reference epoch in MJD
    f - folding frequency
    nbins - number of phase bins desired
    """ #phase = (f*tau + fdot/2 *tau**2 + fdotdot/6*tau**3)%1 #the 100 should change!!!
t
y
T
T0
f
nbins