astrobase.lcmodels.sinusoidal module

This contains models for sinusoidal light curves generated using Fourier expansion.

astrobase.lcmodels.sinusoidal.fourier_sinusoidal_func(fourierparams, times, mags, errs)[source]

This generates a sinusoidal light curve using a Fourier cosine series.

Parameters:
  • fourierparams (list) –

    This MUST be a list of the following form like so:

    [period,
     epoch,
     [amplitude_1, amplitude_2, amplitude_3, ..., amplitude_X],
     [phase_1, phase_2, phase_3, ..., phase_X]]
    

    where X is the Fourier order.

  • times,mags,errs (np.array) – The input time-series of measurements and associated errors for which the 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.sinusoidal.fourier_curvefit_func(times, period, *fourier_coeffs, zerolevel=0.0, epoch=None, fixed_period=None)[source]

This is a function to be used with scipy.optimize.curve_fit.

Parameters:
  • times (np.array) – An array of times at which the model will be evaluated.
  • period (float) – The period of the sinusoidal variability.
  • fourier_coeffs (float) – These should be the amplitudes and phases of the sinusoidal series sum. 2N coefficients are required for Fourier order = N. The first N coefficients will be used as the amplitudes and the second N coefficients will be used as the phases.
  • zerolevel (float) – The base level of the model.
  • epoch (float or None) – The epoch to use to generate the phased light curve. If None, the minimum value of the times array will be used.
  • fixed_period (float or None) – If not None, will indicate that the period is to be held fixed at the provided value.
Returns:

model – Returns the sinusodial series sum model evaluated at each value of times.

Return type:

np.array

astrobase.lcmodels.sinusoidal.fourier_sinusoidal_residual(fourierparams, times, mags, errs)[source]

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

Parameters:
  • fourierparams (list) –

    This MUST be a list of the following form like so:

    [period,
     epoch,
     [amplitude_1, amplitude_2, amplitude_3, ..., amplitude_X],
     [phase_1, phase_2, phase_3, ..., phase_X]]
    

    where X is the Fourier order.

  • times,mags,errs (np.array) – The input time-series of measurements and associated errors for which the 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

astrobase.lcmodels.sinusoidal.sine_series_sum(fourierparams, times, mags, errs)[source]

This generates a sinusoidal light curve using a Fourier sine series.

Parameters:
  • fourierparams (list) –

    This MUST be a list of the following form like so:

    [period,
     epoch,
     [amplitude_1, amplitude_2, amplitude_3, ..., amplitude_X],
     [phase_1, phase_2, phase_3, ..., phase_X]]
    

    where X is the Fourier order.

  • times,mags,errs (np.array) – The input time-series of measurements and associated errors for which the 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