autowisp.light_curves.apply_correction module

Class Inheritance Diagram

Inheritance diagram of DataReductionFile, EPDCorrection, LightCurveFile, ReconstructiveCorrectionTransit

Unified interface to the detrending algorithms.

autowisp.light_curves.apply_correction.apply_parallel_correction(lc_fnames, correct, num_parallel_processes, **config)[source]

Correct LCs running one of the detrending algorithms in parallel.

Parameters:
  • lc_fnames ([str]) – The filenames of the light curves to correct.

  • correct (Correction) – The underlying correction to apply in parallel.

  • num_parallel_processes (int) – The maximum number of parallel processes to use.

  • statistics_fname (str) – Filename to use for saving the statistics.

Returns:

The return values of correct.__call__() in the same order as lc_fnames.

Return type:

numpy.array

autowisp.light_curves.apply_correction.apply_reconstructive_correction_transit(lc_fname, correct, *, transit_model, transit_parameters, fit_parameter_flags, num_limbdark_coef)[source]

Perform a reconstructive correction on a LC assuming it contains a transit.

The corrected lightcurve, preserving the best-fit transit is saved in the lightcurve just like for non-reconstructive corrections.

Parameters:
  • transit_model – Object which supports the transit model intefrace of pytransit.

  • transit_parameters (scipy float array) – The full array of parameters required by the transit model’s evaluate() method.

  • fit_parameter_flags (scipy bool array) – Flags indicating parameters whose values should be fit for (by having a corresponding entry of True). Must match exactly the shape of transit_parameters.

  • num_limbdark_coef (int) – How many of the transit parameters are limb darkening coefficinets? Those need to be passed to the model separately.

  • correct (Correction) – Instance of one of the correction algarithms to make adaptive.

Returns:

  • The best fit transit parameters

  • The return value of ReconstructiveCorrectionTransit.__call__() for the best-fit transit parameters.

Return type:

(scipy array, scipy array)

autowisp.light_curves.apply_correction.calculate_iterative_rejection_scatter(values, calculate_average, calculate_scatter, outlier_threshold, max_outlier_rejections, *, return_average=False)[source]

Calculate the scatter for a dataset, with outlier rejectio iterations.

Parameters:
  • values (numpy array like) – The data to calculate the scatter of.

  • calculate_average (callable) – A callable that returns the average of the data aroung which the scatter will be calculated.

  • calculate_scatter (callable) – The scatter is defined as the square root of whatever get_scatter calculates from the square deviations of the data from the average.

  • outlier_threshold (float) – In units of the scatter, how far away should a point be from the average to be considered an outlier.

  • max_outlier_rejections (int) – The maximum number of iterations between outlier rejection and re-calculating the scatter to perform.

  • return_average (bool) – Should the average of the poinst also be returned?

Returns:

The scatter in values and the number of non-rejected points in the last scatter calculation.

Return type:

float, int

autowisp.light_curves.apply_correction.load_correction_statistics(filename, add_catalog=False)[source]

Read a previously stored statistics from a file.

autowisp.light_curves.apply_correction.pool_init(config)[source]

Setup pool process.

autowisp.light_curves.apply_correction.recalculate_correction_statistics(lc_fnames, fit_datasets, variables, lc_points_filter_expression, **calculate_scatter_config)[source]

Extract the performance metrics for a de-trending step directly from LCs.

Parameters:
  • lc_fnames ([str]) – The filenames of the light curves that were corrected.

  • fit_datasets – See Correction.__init__().

  • extra_predictors – See EPDCorrection.__init__().

  • calculate__scatter_config – Arguments passed directly to calculate_iterative_rejection_scatter().

Returns:

See apply_parallel_correction’s return value.

autowisp.light_curves.apply_correction.save_correction_statistics(correction_statistics, filename)[source]

Save the given statistics (result of apply_parallel_correction).