mirar.processors.astromatic.sextractor package

Module for interfacing with SExtractor.

Submodules

mirar.processors.astromatic.sextractor.background_subtractor module

Module for subtracting the background from an image using Sextractor

class mirar.processors.astromatic.sextractor.background_subtractor.SextractorBkgSubtractor[source]

Bases: BaseImageProcessor

Processor to subtract the background from an image using Sextractor. This processor requires that Sextractor has been run previously with CHECKIMAGE_TYPE -BACKGROUND. This processor loads and returns the background-subtracted image.

base_key = 'sextractorbkgsubtractor'
check_prerequisites()[source]

Check that Sextractor has been run previously with CHECKIMAGE_TYPE -BACKGROUND

description() str[source]

Return a description of the processor

Returns:

A description of the processor

get_sextractor_module() Sextractor[source]

Get the Sextractor module from the preceding steps

mirar.processors.astromatic.sextractor.settings module

Module with sextractor utilities

mirar.processors.astromatic.sextractor.settings.parse_sextractor_config(config_file: str | Path)[source]

Parse a sextractor config file into a dictionary param config_file: path to sextractor config file

mirar.processors.astromatic.sextractor.settings.write_config_file(param_path: str | Path = PosixPath('/home/docs/configs/default.param'), conv_path: str | Path = PosixPath('/home/docs/configs/default.conv'), config_path: str | Path = PosixPath('/home/docs/configs/default.config'), saturation_key: str = 'SATURATE')[source]

Write a default configuration file for sextractor

mirar.processors.astromatic.sextractor.settings.write_conv_file(conv_path: str | Path = PosixPath('/home/docs/configs/default.conv'))[source]

Write a default convolution file for sextractor

mirar.processors.astromatic.sextractor.settings.write_param_file(param_path: str | Path = PosixPath('/home/docs/configs/default.param'), params: list = None)[source]

Write a default parameter file for sextractor param param_path: path to write parameter file param params: list of parameters to write. If None, will write default.

mirar.processors.astromatic.sextractor.settings.write_sextractor_config_to_file(config_dict: dict, config_filename: str | Path)[source]

Write a sextractor config file from a dictionary param config_dict: dictionary of sextractor config parameters param config_filename: path to write config file

mirar.processors.astromatic.sextractor.sextractor module

Module to run :func:`~mirar.processors.astromatic.sextractor.sourceextractor.run_sextractor_single

as a processor.

class mirar.processors.astromatic.sextractor.sextractor.Sextractor(output_sub_dir: str, config_path: str, parameter_path: str, filter_path: str, starnnw_path: str, saturation: float = None, verbose_type: str = 'QUIET', checkimage_name: str | list | None = None, checkimage_type: str | list | None = None, gain: float | None = None, cache: bool = False, mag_zp: float | None = None, write_regions_bool: bool = False, use_psfex: bool = False, psf_path: str | None = None, catalog_purifier: Callable[[Table, Image], Table] = None)[source]

Bases: BaseImageProcessor

Processor to run sextractor on images

base_key = 'sextractor'
check_psf_prerequisite()[source]

Check that the PSF-related parameters are in the given .param file

description() str[source]

Return a description of the processor

Returns:

A description of the processor

get_sextractor_output_dir() Path[source]

Get the directory to output

Returns:

output directory

max_n_cpu: int = 1
mirar.processors.astromatic.sextractor.sextractor.check_sextractor_prerequisite(processor: BaseProcessor)[source]

Check that the preceding steps of a given processor contain Sextractor

mirar.processors.astromatic.sextractor.sourceextractor module

Module to run source extractor

exception mirar.processors.astromatic.sextractor.sourceextractor.SextractorError[source]

Bases: ExecutionError

Sextractor processing error

mirar.processors.astromatic.sextractor.sourceextractor.parse_checkimage(checkimage_type: str | list | None = None, checkimage_name: str | list | None = None, image: str | None = None)[source]

Function to parse the “checkimage” component of Sextractor configuration.

Parameters

checkimage_type: The ‘CHECKIMAGE_TYPE’ files for sextractor. The default is None. To quote sextractor, available types are: ‘NONE, BACKGROUND, BACKGROUND_RMS, MINIBACKGROUND, MINIBACK_RMS, -BACKGROUND, FILTERED, OBJECTS, -OBJECTS, SEGMENTATION, or APERTURES’. Multiple arguments should be specified in a list. checkimage_name: The name(s) of the checkput images to be output. image: The name of the image in question. If specified, the name of each checkimage will include the name of the original base image.

Returns

cmd: A string containing the partial sextractor command relating to checkimages. The default is an empty string.

mirar.processors.astromatic.sextractor.sourceextractor.run_sextractor(images: str | list, output_dir: str, *args, **kwargs)[source]

Wrapper function to run sextractor Args:

images: output_dir: *args: **kwargs:

Returns:

mirar.processors.astromatic.sextractor.sourceextractor.run_sextractor_dual(det_image: str, measure_image: str, output_dir: str | Path, catalog_name: str | None = None, config: str = '/home/docs/checkouts/readthedocs.org/user_builds/mirar/checkouts/latest/mirar/processors/astromatic/config/astrom.sex', parameters_name: str = '/home/docs/checkouts/readthedocs.org/user_builds/mirar/checkouts/latest/mirar/processors/astromatic/config/astrom.param', filter_name: str = '/home/docs/checkouts/readthedocs.org/user_builds/mirar/checkouts/latest/mirar/processors/astromatic/config/default.conv', starnnw_name: str = '/home/docs/checkouts/readthedocs.org/user_builds/mirar/checkouts/latest/mirar/processors/astromatic/config/default.nnw', saturation: float = None, weight_image: str | None = None, verbose_type: str = 'QUIET', checkimage_name: str | list | None = None, checkimage_type: str | list | None = None, gain: float | None = None, mag_zp: float | None = None)[source]

Run sextractor in the dual mode Args:

det_image: measure_image: output_dir: catalog_name: config: parameters_name: filter_name: starnnw_name: saturation: weight_image: verbose_type: checkimage_name: checkimage_type: gain: mag_zp:

Returns:

mirar.processors.astromatic.sextractor.sourceextractor.run_sextractor_single(img: str | Path, output_dir: str | Path, catalog_name: Path | None = None, config: str = '/home/docs/checkouts/readthedocs.org/user_builds/mirar/checkouts/latest/mirar/processors/astromatic/config/astrom.sex', parameters_name: str = '/home/docs/checkouts/readthedocs.org/user_builds/mirar/checkouts/latest/mirar/processors/astromatic/config/astrom.param', filter_name: str = '/home/docs/checkouts/readthedocs.org/user_builds/mirar/checkouts/latest/mirar/processors/astromatic/config/default.conv', starnnw_name: str = '/home/docs/checkouts/readthedocs.org/user_builds/mirar/checkouts/latest/mirar/processors/astromatic/config/default.nnw', saturation: float = None, weight_image: str | Path | None = None, verbose_type: str = 'QUIET', checkimage_name: str | list | None = None, checkimage_type: str | list | None = None, gain: float | None = None, mag_zp: float | None = None, write_regions: bool = False, psf_name: Path | None = None)[source]

Function to run sextractor in single mode Args:

img: The image to run sextractor on output_dir: The directory to output the catalog to catalog_name: The name of the catalog to output. config: path to sextractor config file parameters_name: path to sextractor parameter file filter_name: path to sextractor filter file starnnw_name: path to sextractor starnnw file saturation: saturation level for sextractor. Leave to None if not known, no saturation will be applied weight_image: path to sextractor weight image verbose_type: verbose type for sextractor checkimage_name: name of checkimage to output. Leave to None to use pipeline defaults in sextractor_checkimage_map for output name (recommended). checkimage_type: type of checkimage to output gain: The gain to use for the catalog mag_zp: The magnitude zero point to use for the catalog write_regions: Whether to write ds9 regions for the objects in the catalog psf_name: PSFex model path, used to calculate PSF magnitudes

Returns: