Detrending algorithms
Project description
Wōtan...
...offers free and open source algorithms to automagically remove stellar trends from light curves for exoplanet transit detection.
In Germanic mythology, Odin (/ˈoːðinː/ Old High German: Wōtan) is a widely revered god. He gave one of his eyes to Mimir in return for wisdom. Thus, in order to achieve a goal, one sometimes has to turn a blind eye. In Richard Wagner's "Der Ring des Nibelungen", Wotan is the King of the Gods (god of light, air, and wind) and a bass-baritone. According to Wagner, he is the "pinnacle of intelligence".
Example usage
from wotan import flatten
flatten_lc, trend_lc = flatten(time, flux, window_length=0.5, method='biweight')
For more details, have a look at the interactive playground, the documentation and tutorials.
Available detrending algorithms
- Time-windowed sliders with robust location estimates:
biweight
Tukey's biweightandrewsinewave
Andrew's sine wavehodges
Hodges-Lehmann-Senwelsch
Welsch-Leclerchuber
Huber's M-estimator (1981)median
the most robust (but least efficient)medfilt
a cadence-based median filter (not time-windowed) for comparisonmean
the least robust (but most efficient for white noise)trim_mean
trimmed mean with adjustable capswinsorize
outliers are winsorized to a specified percentile
- Splines:
untrendy
Spline with iterative sigma-clipping (based on the "untrendy" package)hspline
Spline with a robust Huber estimator (Huber 1981)pspline
Penalized spline to automatically select the knot distance (Eilers 1996), with iteratively sigma-clipping
- Polynomials and others:
lowess
Locally weighted scatterplot smoothing (Cleveland 1979)cofiam
Cosine Filtering with Autocorrelation Minimization (Kipping et al. 2013)savgol
sliding segments are fit with polynomials (Savitzky & Golay 1964), cadence-basedsupersmoother
Friedman's (1984) Super-Smoother, a local linear regression with adaptive bandwidth
gp
Gaussian Processes offering:squared_exp
Squared-exponential kernelmatern
Matern 3/2 kernelperiodic
Periodic kernel informed by a user-specified periodperiodic_auto
Periodic kernel informed by a Lomb-Scargle periodogram pre-search
Available features
window_length
The length of the filter window in units oftime
(usually days).break_tolerance
If there are large gaps in time, especially with corresponding flux level offsets, the detrending is much improved when splitting the data into several sub-lightcurves and applying the filter to each individually. Comes with an empirical default and is fully adjustable.edge_cutoff
Trends near edges are less robust. Depending on the data, it may be beneficial to remove edges.cval
Tuning parameter for the robust estimators (see documentation)return_trend
IfTrue
, the method will return a tuple of two elements (flattened_flux
,trend_flux
) wheretrend_flux
is the removed trend. Otherwise, it will only returnflattened_flux
.
Installation
To install the released version, type
$ pip install wotan
which automatically installs numpy
, numba
and scipy
if not present. Depending on the algorithm, additional dependencies exist:
lowess
andhuber
depend onstatsmodels
hspline
andgp
depend on `sklearnpspline
depends onpygam
supersmoother
depends onsupersmoother
untrendy
depends onuntrendy
To install all additional dependencies, type $ pip install statsmodels sklearn supersmoother untrendy pygam
.
Attribution
Please cite Hippke et al. (2019, XXX) if you find this code useful in your research. The BibTeX entry for the paper is:
@ARTICLE{XXX,
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}
Originality
As all scientific work, wōtan is standing on the shoulders of giants. Particularly, many detrending methods are wrapped from existing packages. Original contributions include:
- A time-windowed detrending master module with edge treatments and segmentation options
- Robust location estimates using Newton-Raphson iteration to a precision threshold for Tukey's biweight, Andrew's sine wave, and the Welsch-Leclerc. This is probably a "first", which reduces jitter in the location estimate by ~10 ppm
- Robustified penalized splines for automatic knot distance determination and outlier resistance
- Bringing together many methods in one place in a common interface, with sensible defaults
- Providing documentation, tutorials, and a paper which compares and benchmarks the methods
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file wotan-1.0.tar.gz
.
File metadata
- Download URL: wotan-1.0.tar.gz
- Upload date:
- Size: 17.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.31.1 CPython/3.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | abbde74b3470480a0a7c3817187b758aeb05fcc3ce066bfc2d4007574ac8f00c |
|
MD5 | 5191b461d886ae827fb48601c18e14c0 |
|
BLAKE2b-256 | 4ee90f7c584e5f536e1e66361a403d0255fc624bbd287f79d2fb9f73c598af53 |
File details
Details for the file wotan-1.0-py3-none-any.whl
.
File metadata
- Download URL: wotan-1.0-py3-none-any.whl
- Upload date:
- Size: 18.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.31.1 CPython/3.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff93c5f982ac1998a868ac1eacf1718e397eaf3f51f4d8b8212f21d30975e185 |
|
MD5 | 4bef8b0f490b730eaabb8dbcf0e0b2a1 |
|
BLAKE2b-256 | c6ed2b426f0a6686a2ae7fd90fdbbcbe15f06ac74a151f9aacf2f3c1f7936278 |