autowisp.light_curves.correction module — AutoWISP documentation

# autowisp.light_curves.correction module

## Class Inheritance Diagram

Define base class for all LC de-trend algorithms.

class autowisp.light_curves.correction.Correction(fit_datasets, mark_progress, **iterative_fit_config)

  Bases: `object`

  Functionality and interface shared by all LC de-trending corrections.

  fit_datasets

    See __init__().

  iterative_fit_config

    Configuration to use for iterative fitting. See iterative_fit() for details.

    Type:

      dict

  __init__(fit_datasets, mark_progress, **iterative_fit_config)

    Configure the fitting.

    Parameters:

      - fit_datasets ([]) – A list of 3-tuples of pipeline keys corresponding to each variable identifying a dataset to fit and correct, an associated dictionary of path substitutions, and a pipeline key for the output dataset. Configurations of how the fitting was done and the resulting residual and non-rejected points are added to configuration datasets generated by removing the tail of the destination and adding ‘.cfg.’ + <parameter name> for configurations and just ‘.’ + <parameter name> for fitting statistics. For example, if the output dataset key is

      - 'shapefit.epd.magnitude'

      - look (the configuration datasets will)

      - 'shapefit.epd.cfg.fit_terms' (like)

      - and

      - 'shapefit.epd.residual'.

      - iterative_fit_config – Any other arguments to pass directly to iterative_fit().

    Returns:

      None

  _fix_substitutions(*, light_curve, photometry_mode, fit_points, substitutions, in_place=False)

    Fix magfit iteration in substitutions if negative.

  static _get_config_key_prefix(fit_target)

    Return the prefix of the pipeline key for storing configuration.

  _get_fit_data(light_curve, get_fit_dataset, fit_target, fit_points)

    Return the lightcurve points to detrend.

  _get_io_iterative_fit_config(pipeline_key_prefix)

    Return the iterative fit portion of the configuration to save in the LC.

    Parameters:

      pipeline_key_prefix (str) – The part of the pipeline key specifying which configuration is being defined (i.e. everything except the last item in the key).

    Returns:

      A list of tuples of the configuration options contained in `iterative_fit_config`.

    Return type:

      [()]

  static _process_fit(*, fit_results, raw_values, predictors, fit_index, result, num_extra_predictors)

    Incorporate the results of a single fit in final result of __call__().

    Parameters:

      - fit_results – The return value of the iterative_fit() used to calculate the correction

      - raw_values (1-D array) – The data to apply the correction to. Should already exclude any points not selected for correction.

      - predictors (2-D array) – The predictors to use for the correction (e.g. the templates for TFA fitting).

      - fit_index (int) – The index of the dataset being fit within the list of datasets that will be fit for this lightcurve.

      - result – The result variable for the parent update for this fit.

      - num_extra_predictors (int) – How many extra predictors are there.

    Returns:

      The same structure as fit_results, but ready to pass to self._save_result().

    Return type:

      dict

  _save_result(*, fit_index, corrected_values, fit_residual, non_rejected_points, fit_points, configuration, light_curve)

    Stores the de-treneded results and configuration to the light curve.

    Parameters:

      - fit_index (int) – The index of the dataset for which a correction was applied in within the list of datasets specified at init.

      - corrected_values (array) – The corrected data to save.

      - fit_residual (float) – The residual from the fit, calculated as specified at init.

      - non_rejected_points (int) – The number of points used in the last iteration of the itaritive fit.

      - fit_points (bool array) – Flags indicating for each entry in the input (uncorrected) dataset, whether it is represented in corrected_values.

      - configuration ([]) – The configuration used for the fit, properly formatted to be converted to an entry in the configurations argument to LightCurveFile.add_configurations().

      - light_curve (LightCurveFile) – A light curve file opened for writing.

    Returns:

      None

  static get_result_dtype(num_photometries, extra_predictors=None, id_size=1)

    Return the data type for the result of __call__.