Beispiel #1
0
def trapFit(time_days, flux_frac, period_days, phase_bkjd, duration_hrs,
            depth_ppm):
    trapFit = tf.trapezoid_fit(time_days, flux_frac, np.ones(len(time_days)), \
                   period_days, phase_bkjd, duration_hrs, \
                   depth_ppm, fitTrialN=13, fitRegion=10.0, \
                   errorScale=1.0, debugLevel=3, \
                   sampleN=15)
    #print trapFit
    return trapFit
Beispiel #2
0
def trapFit(time_days, flux_frac, period_days, phase_bkjd, duration_hrs, depth_ppm):
    trapFit = tf.trapezoid_fit(
        time_days,
        flux_frac,
        np.ones(len(time_days)),
        period_days,
        phase_bkjd,
        duration_hrs,
        depth_ppm,
        fitTrialN=13,
        fitRegion=10.0,
        errorScale=1.0,
        debugLevel=3,
        sampleN=15,
    )
    # print trapFit
    return trapFit
Beispiel #3
0
def getSnrOfTransit(time_days, flux_frac, unc, flags, period_days, phase_bkjd, \
    duration_hrs, depth_frac):
    """

    Inputs:
    ------------
    flux_frac
        (1d np array) Flux in fractional amplitude. The mean of this array
        should be zero for sane data. The trapezoid fit takes data with
        a mean of 1, the conversion is done within this function
    """

    idx = np.isfinite(time_days) & (np.isfinite(flux_frac))
    idx = idx & ~flags
    ioblk = tf.trapezoid_fit(time_days[idx], 1+flux_frac[idx], unc[idx], \
                  period_days, phase_bkjd, duration_hrs, \
                  1e6*depth_frac, fitTrialN=13, fitRegion=10.0, \
                  errorScale=1.0, debugLevel=0, \
                  sampleN=15)

    #Taken from trapfit.py around lines 434
    out = dict()
    out['period_days'] = period_days
    out['epoch_bkjd'] = ioblk.timezpt + ioblk.bestphysvals[0]
    out['duration_hrs'] = 24 * ioblk.bestphysvals[2]
    out['ingress_hrs'] = out['duration_hrs'] * ioblk.bestphysvals[3]
    out['depth_frac'] = ioblk.bestphysvals[1]

    #compute modelat all input time values
    subSampleN = 15
    time_days[~np.isfinite(time_days)] = 0  #Hide the Nans from one_model
    assert (np.all(np.isfinite(time_days)))
    ioBlock = tf.trapezoid_model_onemodel(time_days, period_days, \
                out['epoch_bkjd'], 1e6*out['depth_frac'], out['duration_hrs'], \
                out['ingress_hrs'], subSampleN)

    out['bestFitModel'] = ioBlock.modellc - 1  #Want mean of zero
    out['snr'] = estimateSnr(time_days, flux_frac, flags, out['period_days'], \
                    out['epoch_bkjd'], out['duration_hrs'], out['depth_frac'])

    #out['bestFitModel'] = time_days*0
    #out['snr'] = -1
    return out
Beispiel #4
0
def getSnrOfTransit(time_days, flux_frac, unc, flags, period_days, phase_bkjd, \
    duration_hrs, depth_frac):
    """

    Inputs:
    ------------
    flux_frac
        (1d np array) Flux in fractional amplitude. The mean of this array
        should be zero for sane data. The trapezoid fit takes data with
        a mean of 1, the conversion is done within this function
    """

    idx = np.isfinite(time_days) & (np.isfinite(flux_frac))
    idx = idx & ~flags
    ioblk = tf.trapezoid_fit(time_days[idx], 1+flux_frac[idx], unc[idx], \
                  period_days, phase_bkjd, duration_hrs, \
                  1e6*depth_frac, fitTrialN=13, fitRegion=10.0, \
                  errorScale=1.0, debugLevel=0, \
                  sampleN=15)

    #Taken from trapfit.py around lines 434
    out = dict()
    out['period_days'] = period_days
    out['epoch_bkjd'] = ioblk.timezpt + ioblk.bestphysvals[0]
    out['duration_hrs'] = 24* ioblk.bestphysvals[2]
    out['ingress_hrs'] = out['duration_hrs'] * ioblk.bestphysvals[3]
    out['depth_frac'] = ioblk.bestphysvals[1]

    #compute modelat all input time values
    subSampleN= 15
    time_days[~np.isfinite(time_days)] = 0  #Hide the Nans from one_model
    assert(np.all(np.isfinite(time_days)))
    ioBlock = tf.trapezoid_model_onemodel(time_days, period_days, \
                out['epoch_bkjd'], 1e6*out['depth_frac'], out['duration_hrs'], \
                out['ingress_hrs'], subSampleN)
    
    out['bestFitModel'] = ioBlock.modellc - 1  #Want mean of zero
    out['snr'] = estimateSnr(time_days, flux_frac, flags, out['period_days'], \
                    out['epoch_bkjd'], out['duration_hrs'], out['depth_frac'])

    #out['bestFitModel'] = time_days*0
    #out['snr'] = -1
    return out