autowisp.light_curves.light_curve_file module — AutoWISP documentation

# autowisp.light_curves.light_curve_file module

## Class Inheritance Diagram

Define a class for working with light curve files.

class autowisp.light_curves.light_curve_file.LightCurveFile(*args, source_ids=None, **kwargs)

  Bases: `HDF5FileDatabaseStructure`

  Interface for working with the pipeline generated light curve files.

  _config_indices

    A dictionary of the already read-in configuration indices (re-used if requested again).

    Type:

      dict

  __init__(*args, source_ids=None, **kwargs)

    Open a lightcurve file.

    Parameters:

      - source_ids (None or dict) – The known identifiers of this source in catalogues. Must be set if the lightcurve file is being created. If it already exists, identifiers already defined in the lightcurve are checked against supplied values, and new identifiers are added if the file is being opened for writing.

      - args – Passed directly to super().__init__()

      - kwargs – Passed directly to super().__init__()

    Returns:

      None

  _get_configurations(component, quantities, **substitutions)

    Return a the configurations for a given component.

    Parameters:

      - component – What to return the configuration of. Should correspond to a configuration index variable (withouth the .cfg_index suffix).

      - quantities – A list of the pipeline keys identifying all quantities belonging to this configuration component. Undefined behavior results if component and quantities are not consistent.

      - substitutions – Substitutions required to fully resolve the paths to the datasets contaning the configurations.

    Returns:

      A dictionary indexed by the hash of a configuration with entries 2-tuples of:

      > - the ID assigned to a configuration.

      > - and frozenset of (name, value) pairs containing the configuration.

      Also stores the extracted list of configurations as self.__configurations[component][set(substitutions.items())]

  _get_hashable_dataset(dataset_key, **substitutions)

    Return the selected dataset with hashable entries.

  classmethod _get_root_tag_name()

    The name of the root tag in the layout configuration.

  add_configurations(component, configurations, config_indices, *, config_index_selection=None, **substitutions)

    Add a list of configurations to the LC, merging with existing ones.

    Also updates the configuration index dataset.

    Parameters:

      - component (str) – The component for which these configurations apply (i.e. it should have an associated configuration index dataset).

      - configurations (iterable) – The configurations to add. Each configuration should be an iterable of 2-tuples formatted like (pipeline_key, value).

      - config_indices (array of int) – For each frame, the corresponding entry is the index within configurations of the configuration that applies for that frame.

      - resolve_size (str) – How to deal with confirm LC length differing from actual? See extend_dataset() for details.

      - config_index_selection – Either None, slice or boolean array for the configuration index dataset to set the new indices. If None, the new indices are appended at the end of the configuration index dataset, otherwise, it must selected exactly the same number of elements as are found in config_indices.

      - substitutions – Any substitutions required to fully resolve the paths to the configuration and configuration index datasets.

    Returns:

      None

  add_corrected_dataset(original_key, corrected_key, corrected_values, corrected_selection, **substitutions)

    Add corrected values for a dataset (e.g. after EPD or TFA).

    Parameters:

      - original_key (str) – The pipeline key identifying the original dataset that was corrected.

      - corrected_key (str) – The pipeline key identifying the dataset where the corrected values should be stored.

      - corrected_values – The resulting values after the correction has been applied.

      - corrected_selection – Some sort of slice on the dataset that identifies the points which were corrected.

      - substitutions – Any arguments that need to be substituted in the paths of the original and corrected datasets to get a unique entry.

    Returns:

      None

  confirm_lc_length(**substitutions)

    Set the confirmed length of the lightcurve to match actual length.

  evaluate_expression(variables, expression)

    Return the values of the given expression at each LC point.

  extend_dataset(dataset_key, new_data, resolve_size=None, is_config=False, **substitutions)

    Add more points to the dataset identified by dataset_key.

    If the given dataset does not exist it is created as unlimited in its first dimension, and matching the shape in new_data for the other dimensions.

    Parameters:

      - dataset_key – The key identifying the dataset to update.

      - new_data – The additional values that should be written, a numpy array with an appropriate data type and shape.

      - resolve_size – Should be either ‘actual’ or ‘confirmed’. Indicating which dataset length to accept when adding new data. If left as None, an error is rasied if the confirmed length does not match the actual length of the dataset.

      - substitututions – Any arguments that should be substituted in the dataset path.

    Returns:

      None

  get_config_indices(dataset_key, **substitutions)

    Return the config index dset for indexing the given config dset.

  get_lc_length(**substitutions)

    Return the number of poinst present in this lightcurve.

  get_num_magfit_iterations(photometry_mode, lc_points, **path_substitutions)

    Return how many magnitude fitting iterations are in the file.

    Parameters:

      path_substitutions – See get_source_count().

    Returns:

      The number of magnitude fitting iterations performed on the set of photometry measurements identified by the path_substitutions argument.

    Return type:

      int

  read_data(dataset_key, **substitutions)

    Similar to get_dataset, except config datasets are expanded.

  read_data_array(variables)

    Return a numpy structured array of the given variables.

    Parameters:

      variables ([dict]) – The variables to read. Each key is a variable name in the resulting array and the corresponding value is a 2-tuple giving the dataset key to use for that variable, along with any substitutions required to fully resolve the dataset path.

    Retuns:
      numpy.array:

        Array with field names the variables specified on input containing the specified data. Configuration datasets are expanded to lightcurve points using the corresponding configuration index.