astrobase.varbase.flares module

Contains functions to deal with finding stellar flares in time series.

FIXME: finish this module.

astrobase.varbase.flares.add_flare_model(flareparams, times, mags, errs)[source]

This adds a flare model function to the input magnitude/flux time-series.

Parameters:
  • flareparams (list of float) –

    This defines the flare model:

    [amplitude,
     flare_peak_time,
     rise_gaussian_stdev,
     decay_time_constant]
    

    where:

    amplitude: the maximum flare amplitude in mags or flux. If flux, then amplitude should be positive. If mags, amplitude should be negative.

    flare_peak_time: time at which the flare maximum happens.

    rise_gaussian_stdev: the stdev of the gaussian describing the rise of the flare.

    decay_time_constant: the time constant of the exponential fall of the flare.

  • 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.
  • magsarefluxes (bool) – Sets the correct direction of the flare amplitude (+ve) for fluxes if True and for mags (-ve) if False.
Returns:

A dict of the form below is returned:

{'times': the original times array
 'mags': the original mags + the flare model mags evaluated at times,
 'errs': the original errs array,
 'flareparams': the input list of flare params}

Return type:

dict

astrobase.varbase.flares.simple_flare_find(times, mags, errs, smoothbinsize=97, flare_minsigma=4.0, flare_maxcadencediff=1, flare_mincadencepoints=3, magsarefluxes=False, savgol_polyorder=2, **savgol_kwargs)[source]

This finds flares in time series using the method in Walkowicz+ 2011.

FIXME: finish this.

Parameters:
  • times,mags,errs (np.array) – The input time-series to find flares in.
  • smoothbinsize (int) – The number of consecutive light curve points to smooth over in the time series using a Savitsky-Golay filter. The smoothed light curve is then subtracted from the actual light curve to remove trends that potentially last smoothbinsize light curve points. The default value is chosen as ~6.5 hours (97 x 4 minute cadence for HATNet/HATSouth).
  • flare_minsigma (float) – The minimum sigma above the median LC level to designate points as belonging to possible flares.
  • flare_maxcadencediff (int) – The maximum number of light curve points apart each possible flare event measurement is allowed to be. If this is 1, then we’ll look for consecutive measurements.
  • flare_mincadencepoints (int) – The minimum number of light curve points (each flare_maxcadencediff points apart) required that are at least flare_minsigma above the median light curve level to call an event a flare.
  • magsarefluxes (bool) – If True, indicates that mags is actually an array of fluxes.
  • savgol_polyorder (int) – The polynomial order of the function used by the Savitsky-Golay filter.
  • savgol_kwargs (extra kwargs) – Any remaining keyword arguments are passed directly to the savgol_filter function from scipy.signal.
Returns:

(nflares, flare_indices) – Returns the total number of flares found and their time-indices (start, end) as tuples.

Return type:

tuple