gapsim.py
def rebin_txt(times,rates,errors,fracexp,tbin,cmpltness):
    """
    Very similar to rebin_lc, but takes in the 10s-binned light curve from running
    rebin_lc with tbin=10s. This saves time!
    """

    rebinned_time = []
    rebinned_rate = []
    rebinned_errs = []
    rebinned_fracexp = []
    completeness = []

    trunc_times = times-times[0]

    time_bins = np.arange(0,trunc_times[-1]+tbin,tbin)
    print('Rebinning...')
    for i in tqdm(range(len(time_bins)-1)):
        time_interval = trunc_times[(trunc_times>=time_bins[i])&(trunc_times<time_bins[i+1])]
        rate_interval = rates[(trunc_times>=time_bins[i])&(trunc_times<time_bins[i+1])]
        error_interval = errors[(trunc_times>=time_bins[i])&(trunc_times<time_bins[i+1])]
        fracexp_interval = fracexp[(trunc_times>=time_bins[i])&(trunc_times<time_bins[i+1])]

        comp = len(time_interval)/(tbin/10)

        if len(time_interval) != 0 and comp >= cmpltness:
            mean_time = np.mean(time_interval)
            mean_rate = np.mean(rate_interval)
            mean_error = np.sqrt(np.sum(error_interval**2))/np.size(error_interval)
            sum_fracexp = sum(fracexp_interval)

            rebinned_time.append(mean_time)
            rebinned_rate.append(mean_rate)
            rebinned_errs.append(mean_error)
            rebinned_fracexp.append(sum_fracexp)
            completeness.append(len(time_interval)/(tbin/10))

    return np.array(rebinned_time),np.array(rebinned_rate),np.array(rebinned_errs),np.array(rebinned_fracexp)

    Very similar to rebin_lc, but takes in the 10s-binned light curve from running
    rebin_lc with tbin=10s. This saves time!
    
Very similar to rebin_lc, but takes in the 10s-binned light curve from running
rebin_lc with tbin=10s. This saves time!
Very similar to rebin_lc but takes in the 10s - binned light curve from running rebin_lc with tbin = 10s . This saves time!
def rebin_txt(times,rates,errors,fracexp,tbin,cmpltness):
    rebinned_time = []
    rebinned_rate = []
    rebinned_errs = []
    rebinned_fracexp = []
    completeness = []
    trunc_times = times-times[0]
    time_bins = np.arange(0,trunc_times[-1]+tbin,tbin)
    print('Rebinning...')
    for i in tqdm(range(len(time_bins)-1)):
        time_interval = trunc_times[(trunc_times>=time_bins[i])&(trunc_times<time_bins[i+1])]
        rate_interval = rates[(trunc_times>=time_bins[i])&(trunc_times<time_bins[i+1])]
        error_interval = errors[(trunc_times>=time_bins[i])&(trunc_times<time_bins[i+1])]
        fracexp_interval = fracexp[(trunc_times>=time_bins[i])&(trunc_times<time_bins[i+1])]
        comp = len(time_interval)/(tbin/10)
        if len(time_interval) != 0 and comp >= cmpltness:
            mean_time = np.mean(time_interval)
            mean_rate = np.mean(rate_interval)
            mean_error = np.sqrt(np.sum(error_interval**2))/np.size(error_interval)
            sum_fracexp = sum(fracexp_interval)
            rebinned_time.append(mean_time)
            rebinned_rate.append(mean_rate)
            rebinned_errs.append(mean_error)
            rebinned_fracexp.append(sum_fracexp)
            completeness.append(len(time_interval)/(tbin/10))
    return np.array(rebinned_time),np.array(rebinned_rate),np.array(rebinned_errs),np.array(rebinned_fracexp)
def rebin_txt ( times , rates , errors , fracexp , tbin , cmpltness ) : rebinned_time = [ ] rebinned_rate = [ ] rebinned_errs = [ ] rebinned_fracexp = [ ] completeness = [ ] trunc_times = times - times [ 0 ] time_bins = np . arange ( 0 , trunc_times [ - 1 ] + tbin , tbin ) print ( 'Rebinning...' ) for i in tqdm ( range ( len ( time_bins ) - 1 ) ) : time_interval = trunc_times [ ( trunc_times >= time_bins [ i ] ) & ( trunc_times < time_bins [ i + 1 ] ) ] rate_interval = rates [ ( trunc_times >= time_bins [ i ] ) & ( trunc_times < time_bins [ i + 1 ] ) ] error_interval = errors [ ( trunc_times >= time_bins [ i ] ) & ( trunc_times < time_bins [ i + 1 ] ) ] fracexp_interval = fracexp [ ( trunc_times >= time_bins [ i ] ) & ( trunc_times < time_bins [ i + 1 ] ) ] comp = len ( time_interval ) / ( tbin / 10 ) if len ( time_interval ) != 0 and comp >= cmpltness : mean_time = np . mean ( time_interval ) mean_rate = np . mean ( rate_interval ) mean_error = np . sqrt ( np . sum ( error_interval ** 2 ) ) / np . size ( error_interval ) sum_fracexp = sum ( fracexp_interval ) rebinned_time . append ( mean_time ) rebinned_rate . append ( mean_rate ) rebinned_errs . append ( mean_error ) rebinned_fracexp . append ( sum_fracexp ) completeness . append ( len ( time_interval ) / ( tbin / 10 ) ) return np . array ( rebinned_time ) , np . array ( rebinned_rate ) , np . array ( rebinned_errs ) , np . array ( rebinned_fracexp )
Very similar to rebin_lc, but takes in the 10s-binned light curve from running
rebin_lc with tbin=10s.
Very similar to rebin_lc but takes in the 10s - binned light curve from running rebin_lc with tbin = 10s .
"""
    Very similar to rebin_lc, but takes in the 10s-binned light curve from running
    rebin_lc with tbin=10s. This saves time!
    """
times
rates
errors
fracexp
tbin
cmpltness