autowisp.data_reduction.utils module — AutoWISP documentation

# autowisp.data_reduction.utils module

## Class Inheritance Diagram

Convenience functions for interacting with DR files.

autowisp.data_reduction.utils._add_shapefit_map(dr_file, fit_terms_expression, shape_fit_result_tree, **path_substitutions)

  Add the coefficients defining the PSF/PRF map to DR file.

  Parameters:

    - shape_fit_result_tree – See same name argument to add_star_shape_fit().

    - path_substitutions – See same name argument to _add_shapefit_sources().

  Returns:

    None

autowisp.data_reduction.utils._auto_add_tree_quantities(dr_file, result_tree, num_sources, skip_quantities, image_index=0, **path_substitutions)

  Best guess for how to add tree quantities to DR file.

  Parameters:

    - result_tree (astrowisp.IOTree) – The tree to extract quantities to add.

    - num_sources (int) – The number of sources (assumed to be ththe length of all datasets).

    - skip_quantities (compiled rex matcher) – Quantities matching this regular expression will not be added to the DR file by this function.

    - image_index (int) – For quantities which are split by image, only the values associated to this image index will be added.

  Returns:

    None

autowisp.data_reduction.utils._auto_delete_tree_quantities(dr_file, skip_quantities, **path_substitutions)

  Remove all elements from the DR file not matching skip_quantities rex.

autowisp.data_reduction.utils._get_shapefit_map(dr_file, **path_substitutions)

  Read the map of the shapes of point sources from this DR file.

  Parameters:

    path_substitutions – See get_aperture_photometry_inputs().

  Returns:

    The grid used to represent source shapes.

    4-D numpy.array(dtype=numpy.float64):

      The coefficients of the shape map. See the C++ documentation for more details of the layout.

    str:

      The expression specifying the terms to include in the PSF/PRF dependence.

  Return type:

    2-D numpy.array(dtype=numpy.float64)

autowisp.data_reduction.utils._get_shapefit_map_grid(dr_file, **path_substitutions)

  Return the grid used to represent star shape from this DR file.

autowisp.data_reduction.utils._parse_grid_str(grid_str)

  Parse the grid string entry from the astrowisp.IOTree.

autowisp.data_reduction.utils.add_aperture_photometry(dr_file, apphot_result_tree, num_sources, num_apertures, **path_substitutions)

  Add the results of aperture photometry to the DR file.

  Parameters:

    - apphot_result_tree – (astrowisp.IOTree): The tree which was passed to the :class:astrowisp.SubPixPhot instance which did the aperture photometry (i.e. where the results were added).

    - num_sources (int) – The number of sources for which aperture photometry was done. The same as the number of sources the star shape fitting which was used by the aperture photometry was performed on for the photometered image.

    - num_apertures (int) – The number of apertures for which photometry was extracted.

  Returns:

    None

autowisp.data_reduction.utils.add_star_shape_fit(dr_file, *, fit_terms_expression, shape_fit_result_tree, num_sources, image_index=0, **path_substitutions)

  Add the results of a star shape fit to the DR file.

  Parameters:

    - shape_fit_result_tree (astrowisp.IOTree) – The return value of a successful call of astrowisp.FitStarShape.fit().

    - num_sources (int) – The number of surces used in the fit (used to determine the expected size of datasets).

    - image_index (int) – The index of the image whose DR file is being filled within the input list of images passed to PSF/PRF fitting.

    - fit_variables (iterable) – The variables that were used in the fit in the order in which they appear in the tree.

  Returns:

    None

autowisp.data_reduction.utils.delete_aperture_photometry(dr_file, num_apertures, **path_substitutions)

  Delete all DR elements of an aperture photometry.

autowisp.data_reduction.utils.delete_star_shape_fit(dr_file, **path_substitutions)

  Delete all DR elements added by add_star_shape_fit().

autowisp.data_reduction.utils.fill_aperture_photometry_input_tree(dr_file, tree, shapefit_version=0, srcproj_version=0, background_version=0)

  Fill a astrowisp.IOTree with shape fit info for aperture photometry.

  Parameters:

    - tree (astrowisp.IOTree) – The tree to fill.

    - shapefit_version (int) – The version of the star shape fit results stored in the file to use when initializing the tree.

    - srcproj_version (int) – The version of the projected sources to assume was used for shape fitting, and to use for aperture photometry.

    - background_vesrion (int) – The version of the background extraction to assume was used for shape fitting, and to use for aperture photometry.

  Returns:

    The number of sources added to the tree.

  Return type:

    int

autowisp.data_reduction.utils.get_aperture_photometry_inputs(dr_file, **path_substitutions)

  Return all required information for aperture photometry from PSF fit DR.

  Parameters:

    path_substitutions – Values to substitute in the paths to the datasets and attributes containing shape fit informaiton (usually versions of various components).

  Returns:

    All parameters required by

      astrowisp.IOTree.set_aperture_photometry_inputs() directly passable to that method through dict unpacking.

    str:

      The expression defining which terms the PSF/PRF depends on.

  Return type:

    dict

autowisp.data_reduction.utils.get_source_extracted_psf_map(dr_file, **path_substitutions)

  Return functions giving the source extraction PSF map in dr_file.

  Parameters:

    path_substitutions – Substitution arguments required to resolve the path to the relevant datasets/attributes.

  Returns:

    The PSF map derived from extracted sources stored in this DR file.

  Return type:

    SourceExtractedPSFMap