# BoxLeastSquares¶

class astropy.stats.BoxLeastSquares(*args, **kwargs)[source]

Compute the box least squares periodogram.

This class has been deprecated and will be removed in a future version. Use astropy.timeseries.BoxLeastSquares instead.

Methods Summary

 autoperiod(self, duration[, minimum_period, …]) Determine a suitable grid of periods autopower(self, duration[, objective, …]) Compute the periodogram at set of heuristically determined periods compute_stats(self, period, duration, …) Compute descriptive statistics for a given transit model model(self, t_model, period, duration, …) Compute the transit model at the given period, duration, and phase power(self, period, duration[, objective, …]) Compute the periodogram for a set of periods transit_mask(self, t, period, duration, …) Compute which data points are in transit for a given parameter set

Methods Documentation

autoperiod(self, duration, minimum_period=None, maximum_period=None, minimum_n_transit=3, frequency_factor=1.0)[source]

Determine a suitable grid of periods

This method uses a set of heuristics to select a conservative period grid that is uniform in frequency. This grid might be too fine for some user’s needs depending on the precision requirements or the sampling of the data. The grid can be made coarser by increasing frequency_factor.

Parameters
durationfloat, array-like or Quantity

The set of durations that will be considered.

minimum_period, maximum_periodfloat or Quantity, optional

The minimum/maximum periods to search. If not provided, these will be computed as described in the notes below.

minimum_n_transitsint, optional

If maximum_period is not provided, this is used to compute the maximum period to search by asserting that any systems with at least minimum_n_transits will be within the range of searched periods. Note that this is not the same as requiring that minimum_n_transits be required for detection. The default value is 3.

frequency_factorfloat, optional

A factor to control the frequency spacing as described in the notes below. The default value is 1.0.

Returns
periodarray-like or Quantity

The set of periods computed using these heuristics with the same units as t.

Notes

The default minimum period is chosen to be twice the maximum duration because there won’t be much sensitivity to periods shorter than that.

The default maximum period is computed as

maximum_period = (max(t) - min(t)) / minimum_n_transits


ensuring that any systems with at least minimum_n_transits are within the range of searched periods.

The frequency spacing is given by

df = frequency_factor * min(duration) / (max(t) - min(t))**2


so the grid can be made finer by decreasing frequency_factor or coarser by increasing frequency_factor.

autopower(self, duration, objective=None, method=None, oversample=10, minimum_n_transit=3, minimum_period=None, maximum_period=None, frequency_factor=1.0)[source]

Compute the periodogram at set of heuristically determined periods

This method calls BoxLeastSquares.autoperiod() to determine the period grid and then BoxLeastSquares.power() to compute the periodogram. See those methods for documentation of the arguments.

compute_stats(self, period, duration, transit_time)[source]

Compute descriptive statistics for a given transit model

These statistics are commonly used for vetting of transit candidates.

Parameters
periodfloat or Quantity

The period of the transits.

durationfloat or Quantity

The duration of the transit.

transit_timefloat or Quantity

The mid-transit time of a reference transit.

Returns
statsdict

A dictionary containing several descriptive statistics:

• depth: The depth and uncertainty (as a tuple with two

values) on the depth for the fiducial model.

• depth_odd: The depth and uncertainty on the depth for a

model where the period is twice the fiducial period.

• depth_even: The depth and uncertainty on the depth for a

model where the period is twice the fiducial period and the phase is offset by one orbital period.

• depth_half: The depth and uncertainty for a model with a

period of half the fiducial period.

• depth_phased: The depth and uncertainty for a model with the

fiducial period and the phase offset by half a period.

• harmonic_amplitude: The amplitude of the best fit sinusoidal

model.

• harmonic_delta_log_likelihood: The difference in log

likelihood between a sinusoidal model and the transit model. If harmonic_delta_log_likelihood is greater than zero, the sinusoidal model is preferred.

• transit_times: The mid-transit time for each transit in the

baseline.

• per_transit_count: An array with a count of the number of

data points in each unique transit included in the baseline.

• per_transit_log_likelihood: An array with the value of the

log likelihood for each unique transit included in the baseline.

model(self, t_model, period, duration, transit_time)[source]

Compute the transit model at the given period, duration, and phase

Parameters
t_modelarray-like or Quantity

Times at which to compute the model.

periodfloat or Quantity

The period of the transits.

durationfloat or Quantity

The duration of the transit.

transit_timefloat or Quantity

The mid-transit time of a reference transit.

Returns
y_modelarray-like or Quantity

The model evaluated at the times t_model with units of y.

power(self, period, duration, objective=None, method=None, oversample=10)[source]

Compute the periodogram for a set of periods

Parameters
periodarray-like or Quantity

The periods where the power should be computed

durationfloat, array-like or Quantity

The set of durations to test

objective{‘likelihood’, ‘snr’}, optional

The scalar that should be optimized to find the best fit phase, duration, and depth. This can be either 'likelihood' (default) to optimize the log-likelihood of the model, or 'snr' to optimize the signal-to-noise with which the transit depth is measured.

method{‘fast’, ‘slow’}, optional

The computational method used to compute the periodogram. This is mainly included for the purposes of testing and most users will want to use the optimized 'fast' method (default) that is implemented in Cython. 'slow' is a brute-force method that is used to test the results of the 'fast' method.

oversampleint, optional

The number of bins per duration that should be used. This sets the time resolution of the phase fit with larger values of oversample yielding a finer grid and higher computational cost.

Returns
resultsBoxLeastSquaresResults

The periodogram results as a BoxLeastSquaresResults object.

Raises
ValueError

If oversample is not an integer greater than 0 or if objective or method are not valid.

transit_mask(self, t, period, duration, transit_time)[source]

Compute which data points are in transit for a given parameter set

Parameters
t_modelarray-like or Quantity

Times where the mask should be evaluated.

periodfloat or Quantity

The period of the transits.

durationfloat or Quantity

The duration of the transit.

transit_timefloat or Quantity

The mid-transit time of a reference transit.

Returns
A boolean array where True indicates and in transit point and False indicates and out-of-transit point.