Developed by Jamila Taaki (UIUC).
spatial-detrend is a Python library for detrending collections of lightcurves, using spatial (on the sensor) correlations of systematic/instrument noise. The spatial detrending method is described publication 'Robust Detrending of Spatially Correlated Systematics in Kepler Light Curves Using Low-Rank Methods'. The detrending method is built around a low-rank linear model, conditioned on a total-variation spatial constraint. Here systematics are estimated with iterative estimates.
This library is currently in an experimental stage and has been tailored for specific use-cases as detailed in our accompanying Astronomical Journal publication. It may not be highly generalizable across all kinds of datasets or astrophysical applications.
This library is compatible with Python 3.6 and later versions.
A collection of lightcurves is denoted as Y, and the net systematics as L.
A low rank (K) linear systematics model is assumed for L, consisting of linear combinations of shared basis vectors V, weighted by coefficients C.
Each coefficient term c(x, y, k) corresponds to a single light curve (x, y) position and is the weighting for the k'th basis term v(k).
Lightcurves arranged by their (x, y) position exhibit spatial correlation. In our model, we condition the estimation of L on this property.
You can install spatial-detrend using pip:
pip3 install spatial-detrend
Scipy, Numpy, Sklearn, Astropy (if using external data)
- Download a collection of Kepler SAP lightcurves from a single quarter (MAST archive is one way), put these in a folder i.e. 'q2_data' for quarter 2 lightcurves. -- If wish to skip this step, prepped data available for quarters (6, 10, 14) for Kepler magnitude (12-13) stars, see note under Input data.
- Use
spatial_detrend.preproc.kepler_util.open_lc_data
to extract data. Modify and use the scriptpreproc/preprocess_data.py
to callopen_lc_data
and perform filtering of the data. - Run
preproc/grid_data.py
to obtain a discretized sensor and gridded lightcurves (modify relevant parameters). - See the example provided for how to call the spatial detrending method with the
methods.solve.solver
class and choose input parameters.
To use prepped data, use git lfs:
$ git clone https://github.com/xiaziyna/spatial-detrend.git spatial-detrend
$ cd spatial-detrend
$ git lfs pull
See examples folder for a demo.
spatial-detrend/ ├── examples/ │ └── detrend_example.py ├── README.md ├── setup.py └── spatial_detrend/ ├── data/ │ ├── cal_flux_6.p │ ...... │ └── sort_6.p ├── methods/ │ ├── simulate/ │ │ └── sim_signal.py │ ├── solve/ │ │ ├── solver.py │ │ └── solver_weights.py │ └── util.py └── preproc/ ├── grid_data.py ├── kepler_util.py └── preprocess_data.py
If you find this helpful please cite:
Jamila S. Taaki, Athol J. Kemball, and Farzad Kamalabadi. Robust detrending of spatially correlated systematics in Kepler light curves using low-rank methods. The Astronomical Journal, 2024
[spatial-detrend] is released under the GNU General Public License v3.0.