measurement_images

class ByKeyword(key)

Bases: object

Callable that can be used to split an ImageGroup by a keyword value (i.e. FILTER).

Parameters

key (str) – FITS header keyword (i.e. FILTER)

See also

ImageGroup.split

class ByPattern(key, pattern)

Bases: object

Callable that can be used to split an ImageGroup by a keyword value (i.e. FILTER), applying a regular expression and using the first matching group as key.

Parameters
  • key (str) – FITS header keyword

  • pattern (str) – Regular expression. The first matching group will be used as grouping key.

See also

ImageGroup.split

class DataCubeSlice(*args: Any, **kwargs: Any)

Bases: MeasurementImage

class FitsFile(*args: Any, **kwargs: Any)

Bases: FitsFile

class ImageGroup(**kwargs)

Bases: object

Models the grouping of images. Measurement can not be made directly on instances of this type. The configuration must be “frozen” before creating a MeasurementGroup

See also

MeasurementGroup

add_images(images)

Add new images to the group.

Parameters

images (list of, or a single, MeasurementImage) –

Raises

ValueError – If the group has been split, no new images can be added.

add_subgroup(name, group)

Add a subgroup to a group.

Parameters
  • name (str) – The new of the new group

  • group (ImageGroup) –

is_leaf()
Returns

True if the group is a leaf group

Return type

bool

print(prefix='', show_images=False, file=<_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>)

Print a human-readable representation of the group.

Parameters
  • prefix (str) – Print each line with this prefix. Used internally for indentation.

  • show_images (bool) – Show the images belonging to a leaf group.

  • file (file object) – Where to print the representation. Defaults to sys.stderr

split(grouping_method)

Splits the group in various subgroups, applying a filter on the contained images. If the group has already been split, applies the split to each subgroup.

Parameters

grouping_method (callable) – A callable that receives as a parameter the list of contained images, and returns a list of tuples, with the grouping key value, and the list of grouped images belonging to the given key.

See also

ByKeyword, ByPattern

Raises

ValueError – If some images have not been grouped by the callable.

class MeasurementGroup(image_group, is_subgroup=False)

Bases: object

Once an instance of this class is created from an ImageGroup, its configuration is “frozen”. i.e. no new images can be added, or no new grouping applied.

Parameters

image_group (ImageGroup) –

is_leaf()
Returns

True if the group is a leaf group

Return type

bool

print(prefix='', show_images=False, file=<_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>)

Print a human-readable representation of the group.

Parameters
  • prefix (str) – Print each line with this prefix. Used internally for indentation.

  • show_images (bool) – Show the images belonging to a leaf group.

  • file (file object) – Where to print the representation. Defaults to sys.stderr

class MeasurementImage(*args: Any, **kwargs: Any)

Bases: MeasurementImage

A MeasurementImage is the processing unit for SourceXtractor++. Measurements and model fitting can be done over one, or many, of them. It models the image, plus its associated weight file, PSF, etc.

Parameters
  • fits_file (str or FitsFile object) – The path to a FITS image, or an instance of FitsFile

  • psf_file (str) – The path to a PSF. It can be either a FITS image, or a PSFEx model.

  • weight_file (str or FitsFile) – The path to a FITS image with the pixel weights, or an instance of FitsFile

  • gain (float) – Image gain. If None, gain_keyword will be used instead.

  • gain_keyword (str) – Keyword for the header containing the gain.

  • saturation (float) – Saturation value. If None, saturation_keyword will be used instead.

  • saturation_keyword (str) – Keyword for the header containing the saturation value.

  • flux_scale (float) – Flux scaling. Each pixel value will be multiplied by this. If None, flux_scale_keyword will be used instead.

  • flux_scale_keyword (str) – Keyword for the header containing the flux scaling.

  • weight_type (str) –

    The type of the weight image. It must be one of:

    • none

      The image itself is used to compute internally a constant variance (default)

    • background

      The image itself is used to compute internally a variance map

    • rms

      The weight image must contain a weight-map in units of absolute standard deviations (in ADUs per pixel).

    • variance

      The weight image must contain a weight-map in units of relative variance.

    • weight

      The weight image must contain a weight-map in units of relative weights. The data are converted to variance units.

  • weight_absolute (bool) – If False, the weight map will be scaled according to an absolute variance map built from the image itself.

  • weight_scaling (float) – Apply an scaling to the weight map.

  • weight_threshold (float) – Pixels with weights beyond this value are treated just like pixels discarded by the masking process.

  • constant_background (float) – If set a constant background of that value is assumed for the image instead of using automatic detection

  • image_hdu (int) – For multi-extension FITS file specifies the HDU number for the image. Default 0 (primary HDU)

  • psf_hdu (int) – For multi-extension FITS file specifies the HDU number for the psf. Defaults to the same value as image_hdu

  • weight_hdu (int) – For multi-extension FITS file specifies the HDU number for the weight. Defaults to the same value as image_hdu