astrobase.lcfit.eclipses module

Light curve fitting routines for eclipsing binaries:

astrobase.lcfit.eclipses.gaussianeb_fit_magseries(times, mags, errs, ebparams, param_bounds=None, scale_errs_redchisq_unity=True, sigclip=10.0, plotfit=False, magsarefluxes=False, verbose=True, curve_fit_kwargs=None)[source]

This fits a double inverted gaussian EB model to a magnitude time series.

Parameters:
  • times,mags,errs (np.array) – The input mag/flux time-series to fit the EB model to.
  • period (float) – The period to use for EB fit.
  • ebparams (list of float) –

    This is a list containing the eclipsing binary parameters:

    ebparams = [period (time),
                epoch (time),
                pdepth (mags),
                pduration (phase),
                psdepthratio,
                secondaryphase]
    

    period is the period in days.

    epoch is the time of primary minimum in JD.

    pdepth is the depth of the primary eclipse:

    • for magnitudes -> pdepth should be < 0
    • for fluxes -> pdepth should be > 0

    pduration is the length of the primary eclipse in phase.

    psdepthratio is the ratio of the secondary eclipse depth to that of the primary eclipse.

    secondaryphase is the phase at which the minimum of the secondary eclipse is located. This effectively parameterizes eccentricity.

    If epoch is None, this function will do an initial spline fit to find an approximate minimum of the phased light curve using the given period.

    The pdepth provided is checked against the value of magsarefluxes. if magsarefluxes = True, the ebdepth is forced to be > 0; if magsarefluxes = False, the ebdepth is forced to be < 0.

  • param_bounds (dict or None) –

    This is a dict of the upper and lower bounds on each fit parameter. Should be of the form:

    {'period':         (lower_bound_period, upper_bound_period),
     'epoch':          (lower_bound_epoch, upper_bound_epoch),
     'pdepth':         (lower_bound_pdepth, upper_bound_pdepth),
     'pduration':      (lower_bound_pduration, upper_bound_pduration),
     'psdepthratio':   (lower_bound_psdepthratio,
                        upper_bound_psdepthratio),
     'secondaryphase': (lower_bound_secondaryphase,
                        upper_bound_secondaryphase)}
    
    • To indicate that a parameter is fixed, use ‘fixed’ instead of a tuple providing its lower and upper bounds as tuple.
    • To indicate that a parameter has no bounds, don’t include it in the param_bounds dict.

    If this is None, the default value of this kwarg will be:

    {'period':(0.0,np.inf),      # period is between 0 and inf
     'epoch':(0.0, np.inf),      # epoch is between 0 and inf
     'pdepth':(-np.inf,np.inf),  # pdepth is between -np.inf and np.inf
     'pduration':(0.0,1.0),      # pduration is between 0.0 and 1.0
     'psdepthratio':(0.0,1.0),   # psdepthratio is between 0.0 and 1.0
     'secondaryphase':(0.0,1.0), # secondaryphase is between 0.0 and 1.0
    
  • scale_errs_redchisq_unity (bool) – If True, the standard errors on the fit parameters will be scaled to make the reduced chi-sq = 1.0. This sets the absolute_sigma kwarg for the scipy.optimize.curve_fit function to False.
  • sigclip (float or int or sequence of two floats/ints or None) –

    If a single float or int, a symmetric sigma-clip will be performed using the number provided as the sigma-multiplier to cut out from the input time-series.

    If a list of two ints/floats is provided, the function will perform an ‘asymmetric’ sigma-clip. The first element in this list is the sigma value to use for fainter flux/mag values; the second element in this list is the sigma value to use for brighter flux/mag values. For example, sigclip=[10., 3.], will sigclip out greater than 10-sigma dimmings and greater than 3-sigma brightenings. Here the meaning of “dimming” and “brightening” is set by physics (not the magnitude system), which is why the magsarefluxes kwarg must be correctly set.

    If sigclip is None, no sigma-clipping will be performed, and the time-series (with non-finite elems removed) will be passed through to the output.

  • magsarefluxes (bool) – If True, will treat the input values of mags as fluxes for purposes of plotting the fit and sig-clipping.
  • plotfit (str or False) – If this is a string, this function will make a plot for the fit to the mag/flux time-series and writes the plot to the path specified here.
  • ignoreinitfail (bool) – If this is True, ignores the initial failure to find a set of optimized Fourier parameters using the global optimization function and proceeds to do a least-squares fit anyway.
  • verbose (bool) – If True, will indicate progress and warn of any problems.
  • curve_fit_kwargs (dict or None) – If not None, this should be a dict containing extra kwargs to pass to the scipy.optimize.curve_fit function.
Returns:

This function returns a dict containing the model fit parameters, the minimized chi-sq value and the reduced chi-sq value. The form of this dict is mostly standardized across all functions in this module:

{
    'fittype':'gaussianeb',
    'fitinfo':{
        'initialparams':the initial EB params provided,
        'finalparams':the final model fit EB params,
        'finalparamerrs':formal errors in the params,
        'fitmags': the model fit mags,
        'fitepoch': the epoch of minimum light for the fit,
    },
    'fitchisq': the minimized value of the fit's chi-sq,
    'fitredchisq':the reduced chi-sq value,
    'fitplotfile': the output fit plot if fitplot is not None,
    'magseries':{
        'times':input times in phase order of the model,
        'phase':the phases of the model mags,
        'mags':input mags/fluxes in the phase order of the model,
        'errs':errs in the phase order of the model,
        'magsarefluxes':input value of magsarefluxes kwarg
    }
}

Return type:

dict