astrobase.lcmodels.eclipses module

This contains a double gaussian model for first order modeling of eclipsing binaries.

astrobase.lcmodels.eclipses.invgauss_eclipses_func(ebparams, times, mags, errs)[source]

This returns a double eclipse shaped function.

Suitable for first order modeling of eclipsing binaries.

Parameters:
  • ebparams (list of float) –

    This contains the parameters for the eclipsing binary:

    ebparams = [period (time),
                epoch (time),
                pdepth: primary eclipse depth (mags),
                pduration: primary eclipse duration (phase),
                psdepthratio: primary-secondary eclipse depth ratio,
                secondaryphase: center phase of the secondary eclipse]
    

    period is the period in days.

    epoch is the time of 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 in the eclipse depths: depth_secondary/depth_primary. This is generally the same as the ratio of the T_effs of the two stars.

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

    All of these will then have fitted values after the fit is done.

  • times,mags,errs (np.array) – The input time-series of measurements and associated errors for which the eclipse model will be generated. The times will be used to generate model mags, and the input times, mags, and errs will be resorted by model phase and returned.
Returns:

(modelmags, phase, ptimes, pmags, perrs) – Returns the model mags and phase values. Also returns the input times, mags, and errs sorted by the model’s phase.

Return type:

tuple

astrobase.lcmodels.eclipses.invgauss_eclipses_curvefit_func(times, period, epoch, pdepth, pduration, psdepthratio, secondaryphase, zerolevel=0.0, fixed_params=None)[source]

This is the inv-gauss eclipses function used with scipy.optimize.curve_fit.

Parameters:
  • times (np.array) – The array of times at which the model will be evaluated.
  • period (float) – The period of the eclipsing binary.
  • epoch (float) – The mid eclipse time of the primary eclipse. In the same units as times.
  • pdepth (float) – The depth of the primary eclipse.
  • pduration (float) – The duration of the primary eclipse. In units of phase.
  • psdepthratio (float) – The ratio between the depths of the primary and secondary eclipse.
  • secondaryphase (float) – The phase of the secondary eclipse.
  • zerolevel (float) – The out of eclipse value of the model.
  • fixed_params (dict or None) –

    If this is provided, must be a dict containing the parameters to fix and their values. Should be of the form below:

    {'period': fixed value,
     'epoch': fixed value,
     'pdepth': fixed value,
     'pduration': fixed value,
     'psdepthratio': fixed value,
     'secondaryphase': fixed value}
    

    Any parameter in the dict provided will have its parameter fixed to the provided value. This is best done with an application of functools.partial before passing the function to the scipy.optimize.curve_fit function, e.g.:

    curvefit_func = functools.partial(
                        eclipses.invgauss_eclipses_curvefit_func,
                        zerolevel=np.median(mags),
                        fixed_params={'secondaryphase':0.5})
    
    fit_params, fit_cov = scipy.optimize.curve_fit(
                            curvefit_func,
                            times, mags,
                            p0=initial_params,
                            sigma=errs,
                            ...)
    
Returns:

model – Returns the transit model as an np.array. This is in the same order as the times input array.

Return type:

np.array

astrobase.lcmodels.eclipses.invgauss_eclipses_residual(ebparams, times, mags, errs)[source]

This returns the residual between the modelmags and the actual mags.

Parameters:
  • ebparams (list of float) –

    This contains the parameters for the eclipsing binary:

    ebparams = [period (time),
                epoch (time),
                pdepth: primary eclipse depth (mags),
                pduration: primary eclipse duration (phase),
                psdepthratio: primary-secondary eclipse depth ratio,
                secondaryphase: center phase of the secondary eclipse]
    

    period is the period in days.

    epoch is the time of 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 in the eclipse depths: depth_secondary/depth_primary. This is generally the same as the ratio of the T_effs of the two stars.

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

    All of these will then have fitted values after the fit is done.

  • times,mags,errs (np.array) – The input time-series of measurements and associated errors for which the eclipse model will be generated. The times will be used to generate model mags, and the input times, mags, and errs will be resorted by model phase and returned.
Returns:

The residuals between the input mags and generated modelmags, weighted by the measurement errors in errs.

Return type:

np.array