Ensemble Corrector (corrections.EnsembleCorrector)
The ensemble photometry detrending class.
Code author: Derek Buzasi
Code author: Oliver J. Hall
Code author: Lindsey Carboneau
Code author: Filipe Pereira
Code author: Rasmus Handberg <rasmush@phys.au.dk>
- class corrections.EnsembleCorrector(*args, **kwargs)[source]
Bases:
BaseCorrector- __init__(*args, **kwargs)[source]
Initialize the correction object.
- Parameters:
*args – Arguments for the BaseCorrector class
**kwargs – Keyword Arguments for the BaseCorrector class
- add_ensemble_member(lc, next_star_lc)[source]
Add a given target to the ensemble list
- Parameters:
lc (
lightkurve.TessLightCurve) – Lightcurve for target obtained fromload_lightcurve().next_star_lc (
lightkurve.TessLightCurve) – Lightcurve for star to add to ensemble obtained fromload_lightcurve().
- Returns:
ndarray: Lightcurve (flux) to add to ensemble.
float: Fitted background correction (B_zeta).
- Return type:
tuple
Code author: Lindsey Carboneau
Code author: Derek Buzasi
- apply_ensemble(lc, lc_ensemble, lc_corr)[source]
Apply the ensemble correction method to the target light curve
- Parameters:
lc (
lightkurve.TessLightCurve) – Lightcurve object for target obtained fromload_lightcurve().lc_ensemble (list) – List of ensemble members flux as ndarrays
lc_corr (TESSLightCurve object) – Lightcurve object which stores the ensemble corrected flux values.
- Returns:
The updated object with corrected flux values.
- Return type:
lightkurve.TessLightCurve
Code author: Lindsey Carboneau
Code author: Derek Buzasi
- close()
Close correction object.
- correct(task, output_folder=None)
Run correction.
- Parameters:
task (dict) – Dictionary defining a task/lightcurve to process.
output_folder (str, optional) – Path to directory where lightcurve should be saved.
- Returns:
Result dictionary containing information about the processing.
- Return type:
dict
Code author: Rasmus Handberg <rasmush@phys.au.dk>
- do_correction(lc)[source]
Function that takes all input stars for a sector and uses them to find a detrending function using ensemble photometry for a star ‘star_names[ifile]’, where ifile is the index for the star in the star_array and star_names list.
- Parameters:
lc (
lightkurve.TessLightCurve) – Raw lightcurve stored in a TessLightCurve object.- Returns:
Corrected lightcurve stored in a TessLightCurve object.
STATUS: The status of the correction.- Return type:
lightkurve.TessLightCurve
- get_nearest_neighbors(lc, n_neighbors)[source]
Find the nearest neighbors to the given target in pixel-space.
- Parameters:
lc (
lightkurve.TessLightCurve) – Lightcurve object for target obtained fromload_lightcurve().n_neighbors (int) – Number of targets to return.
- Returns:
- List of priority identifiers of the n_neighbors nearest stars.
These values can be passed directly to
load_lightcurve()to load the lightcurves of the targets.
- Return type:
list
Code author: Rasmus Handberg <rasmush@phys.au.dk>
- load_lightcurve(task)
Load lightcurve from task ID or full task dictionary.
- Parameters:
task (integer or dict)
- Returns:
Lightcurve for the star in question.
- Return type:
lightkurve.TessLightCurve- Raises:
ValueError – On invalid file format.
Code author: Rasmus Handberg <rasmush@phys.au.dk>
- plot_folder(lc)
Return folder path where plots for a given lightcurve should be saved.
- Parameters:
lc (
lightkurve.TessLightCurve) – Lightcurve to return plot path for.- Returns:
Path to directory where plots should be saved.
- Return type:
string
Code author: Rasmus Handberg <rasmush@phys.au.dk>
- save_lightcurve(lc, output_folder=None)
Save generated lightcurve to file.
- Parameters:
output_folder (str, optional) – Path to directory where to save lightcurve. If
Nonethe directory specified in the attributeoutput_folderis used.- Returns:
Path to the generated file.
- Return type:
str
Code author: Rasmus Handberg <rasmush@phys.au.dk>
Code author: Mikkel N. Lund <mikkelnl@phys.au.dk>
- search_database(select=None, join=None, search=None, order_by=None, limit=None, distinct=False)
Search list of lightcurves and return a list of tasks/stars matching the given criteria.
Returned rows are restricted to things not marked as
STATUS.SKIPPED, since these have been deemed too bad to not require corrections, they are definitely also too bad to use in any kind of correction.- Parameters:
select (list of strings or None) – List of table columns to return.
search (list of strings or None) – Conditions to apply to the selection of stars from the database
order_by (list, str or None) – Column to order the database output by.
limit (int or None) – Maximum number of rows to retrieve from the database. If limit is None, all the rows are retrieved.
distinct (bool) – Boolean indicating if the query should return unique elements only.
join (list) – Table join commands to merge several database tables together.
- Returns:
All stars retrieved by the call to the database as dicts/tasks that can be consumed directly by load_lightcurve
- Return type:
list
Code author: Rasmus Handberg <rasmush@phys.au.dk>