SourceXtractorPlusPlus 1.0.3
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
sourcextractor.config.measurement_config.MeasurementConfig Class Reference

Public Member Functions

 __init__ (self)
 apertures_for_image (self)
 measurement_images (self)
 model_fitting_parameter_columns (self)
 aperture_columns (self)
 model_fitting (self)
 add_measurement_image (self, image)
 load_fits_image (self, image, psf=None, weight=None, **kwargs)
 load_fits_images (self, images, psfs=None, weights=None, **kwargs)
 load_fits_data_cube (self, image, psf=None, weight=None, image_cube_hdu=-1, weight_cube_hdu=-1, **kwargs)
 print_measurement_images (self, file=sys.stderr)
 add_aperture_photometry (self, target, apertures)
 print_output_columns (self, file=sys.stderr)
 add_output_column (self, name, params)

Protected Attributes

dict _measurement_images = {}
dict _apertures_for_image = {}
 _used_names = set()
list _model_fitting_parameter_columns = []
list _aperture_columns = []
dict _column_map
 _model_fitting = ModelFitting()

Detailed Description

Definition at line 29 of file measurement_config.py.

Constructor & Destructor Documentation

◆ __init__()

sourcextractor.config.measurement_config.MeasurementConfig.__init__ ( self)

Definition at line 30 of file measurement_config.py.

Member Function Documentation

◆ add_aperture_photometry()

sourcextractor.config.measurement_config.MeasurementConfig.add_aperture_photometry ( self,
target,
apertures )
Flux measurement from the image above the background inside a circular aperture.

Parameters
----------
target : MeasurementImage object, or leaf MeasurementGroup object with a single image, or a list of either
    Target images on which to measure the aperture photometry. Leaf MeasurementGroup with a single image
    are accepted as a convenience.

apertures : float, or list of float
    Diameter of the aperture. As different MeasurementImage may not be aligned, nor have equivalent pixel size,
    the aperture is interpreted as diameter in pixels of a circle on the detection image.
    A transformation will be applied for each frame, so the covered area is equivalent.

Returns
-------
list of Aperture objects
    An Aperture object is an internal representation of a property on the measurement frame that contains the
    apertures. To actually get the measurements on the output catalog, you need to add explicitly them to the
    output.

See Also
--------
add_output_column

Notes
-----
This property will generate five columns with the prefix specified by `add_output_column`:
- ``_flux`` and ``_flux_err``, for the flux and its associated error
- ``_mag`` and ``_mag_err``, for the magnitude and its associated error
- ``_flags``, to mark, for instance, saturation, boundary conditions, etc.

For M apertures and N images, the cells on the output column will be an array of MxN fluxes.

Examples
--------
>>> context = MeasurementConfig()
>>> measurement_group = MeasurementGroup(load_fits_images(frames, psfs))
>>> all_apertures = []
>>> for img in measurement_group:
>>>     all_apertures.extend(context.add_aperture_photometry(img, [5, 10, 20]))
>>> context.add_output_column('aperture', all_apertures)

Definition at line 292 of file measurement_config.py.

References _apertures_for_image.

◆ add_measurement_image()

sourcextractor.config.measurement_config.MeasurementConfig.add_measurement_image ( self,
image )

Definition at line 62 of file measurement_config.py.

References _measurement_images, and add_measurement_image().

Referenced by add_measurement_image().

Here is the call graph for this function:

◆ add_output_column()

sourcextractor.config.measurement_config.MeasurementConfig.add_output_column ( self,
name,
params )
Add a new set of columns to the output catalog.

Parameters
----------
name : str
    Name/prefix of the new set of columns
params : list of columns
    List of properties to add to the output with the given name/prefix. They must be subtype
    of one of the known ones: ParameterBase for model fitting, or Aperture for aperture photometry.

Raises
------
ValueError
    If the name has already been used
TypeError
    If any of the parameters are not of a known type (see params)

See Also
--------
aperture.add_aperture_photometry
model_fitting.ParameterBase

Definition at line 381 of file measurement_config.py.

References _column_map, _used_names, and model_fitting().

Here is the call graph for this function:

◆ aperture_columns()

sourcextractor.config.measurement_config.MeasurementConfig.aperture_columns ( self)

Definition at line 55 of file measurement_config.py.

References _aperture_columns.

◆ apertures_for_image()

sourcextractor.config.measurement_config.MeasurementConfig.apertures_for_image ( self)

Definition at line 43 of file measurement_config.py.

References _apertures_for_image.

◆ load_fits_data_cube()

sourcextractor.config.measurement_config.MeasurementConfig.load_fits_data_cube ( self,
image,
psf = None,
weight = None,
image_cube_hdu = -1,
weight_cube_hdu = -1,
** kwargs )
Creates an image group with the images of a data cube.

weight can be a matching datacube, multi-hdu or list of individual images
psf can be a multi-hdu or list of individual images to be matched

In any case, they are matched in order and HDUs not containing images are ignored.

:param image: The filename of the FITS file containing the image datacube
:param psf: psf file or list of psf files
:param weight: FITS file contianing a weight datacube, a MEF contianing the weights
     or a list of such files
:param image_cube_hdu: hdu containing the image datacube, default = first HDU containing image data
:param weight_cube_hdu: hdu containing the weight datacube, default = first HDU containing image data

:return: A ImageGroup representing the images

Definition at line 185 of file measurement_config.py.

References _measurement_images.

◆ load_fits_image()

sourcextractor.config.measurement_config.MeasurementConfig.load_fits_image ( self,
image,
psf = None,
weight = None,
** kwargs )
Creates an image group with the images of a (possibly multi-HDU) single FITS file.

If image is multi-hdu, psf and weight can either be multi hdu or lists of individual files.

In any case, they are matched in order and HDUs not containing images (two dimensional arrays) are ignored.

:param image: The filename of the FITS file containing the image(s)
:param psf: psf file or list of psf files
:param weight: FITS file for the weight image or a list of such files

:return: A ImageGroup representing the images

Definition at line 73 of file measurement_config.py.

References _measurement_images.

Referenced by load_fits_images().

◆ load_fits_images()

sourcextractor.config.measurement_config.MeasurementConfig.load_fits_images ( self,
images,
psfs = None,
weights = None,
** kwargs )
Creates an image group for the given images.

Parameters
----------
images : list of str
    A list of relative paths to the images FITS files. Can also be single string in which case,
     this function acts like load_fits_image
psfs : list of str
    A list of relative paths to the PSF FITS files (optional). It must match the length of image_list or be None.
weights : list of str
    A list of relative paths to the weight files (optional). It must match the length of image_list or be None.

Returns
-------
ImageGroup
    A ImageGroup representing the images

Raises
------
ValueError
    In case of mismatched list of files

Definition at line 135 of file measurement_config.py.

References _measurement_images, and load_fits_image().

Here is the call graph for this function:

◆ measurement_images()

sourcextractor.config.measurement_config.MeasurementConfig.measurement_images ( self)

Definition at line 47 of file measurement_config.py.

References _measurement_images.

◆ model_fitting()

sourcextractor.config.measurement_config.MeasurementConfig.model_fitting ( self)

Definition at line 59 of file measurement_config.py.

References _model_fitting.

Referenced by add_output_column().

◆ model_fitting_parameter_columns()

sourcextractor.config.measurement_config.MeasurementConfig.model_fitting_parameter_columns ( self)

Definition at line 51 of file measurement_config.py.

References _model_fitting_parameter_columns.

◆ print_measurement_images()

sourcextractor.config.measurement_config.MeasurementConfig.print_measurement_images ( self,
file = sys.stderr )
Print a human-readable representation of the configured measurement images.

Parameters
----------
file : file object
    Where to print the representation. Defaults to sys.stderr

Definition at line 275 of file measurement_config.py.

References _measurement_images.

◆ print_output_columns()

sourcextractor.config.measurement_config.MeasurementConfig.print_output_columns ( self,
file = sys.stderr )
Print a human-readable representation of the configured output columns.

Parameters
----------
file : file object
    Where to print the representation. Defaults to sys.stderr

Definition at line 363 of file measurement_config.py.

References _aperture_columns, and _model_fitting_parameter_columns.

Member Data Documentation

◆ _aperture_columns

list sourcextractor.config.measurement_config.MeasurementConfig._aperture_columns = []
protected

Definition at line 35 of file measurement_config.py.

Referenced by aperture_columns(), and print_output_columns().

◆ _apertures_for_image

dict sourcextractor.config.measurement_config.MeasurementConfig._apertures_for_image = {}
protected

Definition at line 32 of file measurement_config.py.

Referenced by add_aperture_photometry(), and apertures_for_image().

◆ _column_map

dict sourcextractor.config.measurement_config.MeasurementConfig._column_map
protected
Initial value:
= {
ParameterBase: self._model_fitting_parameter_columns,
cpp.Aperture: self._aperture_columns
}

Definition at line 36 of file measurement_config.py.

Referenced by add_output_column().

◆ _measurement_images

dict sourcextractor.config.measurement_config.MeasurementConfig._measurement_images = {}
protected

◆ _model_fitting

sourcextractor.config.measurement_config.MeasurementConfig._model_fitting = ModelFitting()
protected

Definition at line 40 of file measurement_config.py.

Referenced by model_fitting().

◆ _model_fitting_parameter_columns

list sourcextractor.config.measurement_config.MeasurementConfig._model_fitting_parameter_columns = []
protected

Definition at line 34 of file measurement_config.py.

Referenced by model_fitting_parameter_columns(), and print_output_columns().

◆ _used_names

sourcextractor.config.measurement_config.MeasurementConfig._used_names = set()
protected

Definition at line 33 of file measurement_config.py.

Referenced by add_output_column().


The documentation for this class was generated from the following file: