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: corrections.BaseCorrector.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 (TESSLightCurve object) – Lightcurve for target obtained from load_lightcurve().

  • next_star_lc (TESSLightCurve object) – Lightcurve for star to add to ensemble obtained from load_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 (TESSLightCurve object) – Lightcurve object for target obtained from load_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

lc_corr (TESSLightCurve object)

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 (string, 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. corrections.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 (TESSLightCurve object) – Lightcurve object for target obtained from load_lightcurve().

  • n_neighbors (integer) – 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 (string, optional) – Path to directory where to save lightcurve. If None the directory specified in the attribute output_folder is used.

Returns

Path to the generated file.

Return type

string

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
  • search (list of strings or None) – Conditions to apply to the selection of stars from the database

  • order_by (list, string 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 (boolean) – Boolean indicating if the query should return unique elements only.

Returns

Returns all stars retrieved by the call to the database as dicts/tasks that can be consumed directly by load_lightcurve

Return type

list of dicts

Code author: Rasmus Handberg <rasmush@phys.au.dk>

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.ensemble.EnsembleCorrector(*args, **kwargs)[source]

Bases: corrections.BaseCorrector.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 (TESSLightCurve object) – Lightcurve for target obtained from load_lightcurve().

  • next_star_lc (TESSLightCurve object) – Lightcurve for star to add to ensemble obtained from load_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 (TESSLightCurve object) – Lightcurve object for target obtained from load_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

lc_corr (TESSLightCurve object)

Code author: Lindsey Carboneau

Code author: Derek Buzasi

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. corrections.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 (TESSLightCurve object) – Lightcurve object for target obtained from load_lightcurve().

  • n_neighbors (integer) – 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>