A convenient wrapper for outputs from BLS.



  • t - input time grid
  • y - input data
  • yerr - input data uncertainty
  • periods - the input periods
  • duration_in - the input durations
  • objective - the objective that was maximized
  • power - the power calculated at each period
  • duration - the best duration at each period
  • t0 - the best transit time at each period
  • depth - the best transit depth at each period
  • snr - the signal-to-noise ratio at each period
  • loglike - the log-likeilhood at each period


Plotting recipes are provided for BLSPeriodogram which automatically plots the period and the power

BLS(t, y, [yerr];
    duration, periods=autoperiod(t, duration, kwargs...), 
    objective=:likelihood, oversample=10, kwargs...)

Compute the box-least-squares periodogram.


  • t - the time for each observation. Units are irrelevant, except that they must be consistent for all temporal parameters (e.g., duration). Unitful.jl units work seamlessly without needing to convert.
  • y - the flux value for each observation
  • yerr, optional - the uncertainty for each observation, if not provided, will default to ones
  • duration - The duration or durations to consider. Same units as t
  • periods, optional - The period grid to computer the BLS power over. If not provided, autoperiod will be called along with any extra keyword arguments (like minimum_period)
  • objective, optional - Choose between maximizing the likeilhood (:likeilhood, default) or the signal-to-noise ratio (:snr).
  • oversample, optional - The number of bins per duration that should be used. Larger values of oversample will lead to a finer grid.

The returned values are wrapped into a convenience type BoxLeastSquares.BLSPeriodogram

autoperiod(t, duration;
    minimum_n_transit=3, frequency_factor=1.0,
    [minimum_period, maximum_period])

Automatically determine a period grid from the given times and duration(s). Periods are selected such that at least minimum_n_trasnit transits occur. The default minimum period is twice the maximum duration. The default maximum period is (maximum(t) - minimum(t)) / (minimum_n_transit - 1). The frequency factor changes the granularity in frequency space- a smaller frequency factor will create a finer period grid.

BoxLeastSquares.model(t, y, [yerr]; period, duration, t0)

Evaluate the transit model on the given time grid. If yerr is not provided, it will default to 1. The following transit parameters must be set:

  • period orbital period in the same units as t
  • duration the transit duration in the same units as t
  • t0 the transit time (middle of transit) in the same units as t

If you are using Unitful.jl, the unit conversions will be made automatically.

BoxLeastSquares.model(::BLSPeriodogram; kwargs...)

Create a transit model using the data and best-fitting parameters from the given BLS periodogram. Any keyword parameters can be overriden.


Return the transit parameters for the best fitting period. Returns period, duration, t0, and power as well as the index of the max-power period.


Return the period grid for the periodogram


Return the power calculated for each period for the periodogram