These are Python bindings for the original Fortran implementation of Box Least Squares (BLS) algorithm from Kovács et al. (2002).
Clone the source code from the GitHub repository and install using the standard python tools:
git clone https://github.com/dfm/python-bls.git
cd python-bls
python setup.py installFor testing in development, you can use
python setup.py build_ext --inplaceto build the bindings directly in the bls directory.
These Python bindings were developed—building directly on the code released by Kovács—at the SAMSI workshop Modern Statistical and Computational Methods for Analysis of Kepler by
The Python bindings are licensed under the MIT License.
TODO: describe Pythonic binding.
You can get direct access to the Fortran subroutine provided by Kovács through the eebls()
function:
import bls
results = bls.eebls(time, flux, u, v, nf, fmin, df, nb, qmi, qma)where
timeis anN-dimensional array of timestamps for the light curve,fluxis theN-dimensional light curve array,uandvareN-dimensional empty work arrays,nfis the number of frequency bins to test,fminis the minimum frequency to test,dfis the frequency grid spacing,nbis the number of bins to use in the folded light curve,qmiis the minimum transit duration to test, andqmais the maximum transit duration to test.
The returned values are
power, best_period, best_power, depth, q, in1, in2 = resultswhere
poweris thenf-dimensional power spectrum array at frequenciesf = fmin + arange(nf) * df,best_periodis the best-fit period in the same units astime,best_poweris the power atbest_period,depthis the depth of the transit atbest_period,qis the fractional transit duration,in1is the bin index at the start of transit, andin2is the bin index at the end of transit.