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 install
For testing in development, you can use
python setup.py build_ext --inplace
to 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
time
is anN
-dimensional array of timestamps for the light curve,flux
is theN
-dimensional light curve array,u
andv
areN
-dimensional empty work arrays,nf
is the number of frequency bins to test,fmin
is the minimum frequency to test,df
is the frequency grid spacing,nb
is the number of bins to use in the folded light curve,qmi
is the minimum transit duration to test, andqma
is the maximum transit duration to test.
The returned values are
power, best_period, best_power, depth, q, in1, in2 = results
where
power
is thenf
-dimensional power spectrum array at frequenciesf = fmin + arange(nf) * df
,best_period
is the best-fit period in the same units astime
,best_power
is the power atbest_period
,depth
is the depth of the transit atbest_period
,q
is the fractional transit duration,in1
is the bin index at the start of transit, andin2
is the bin index at the end of transit.