mirar.processors package

This module contains the processors that are used to process the raw data

Subpackages

Submodules

mirar.processors.base_catalog_xmatch_processor module

Base processor for any functionality requiring cross-matching a reference catalog to a Sextractor catalog

class mirar.processors.base_catalog_xmatch_processor.BaseProcessorWithCrossMatch(ref_catalog_generator: Callable[[Image], BaseCatalog], crossmatch_radius_arcsec: float, required_parameters: list[str], sextractor_catalog_purifier: Callable[[Table, Image], Table], write_regions: bool = False, cache: bool = False, temp_output_sub_dir: str = 'astrom_stats')[source]

Bases: BaseImageProcessor

Photometric calibrator processor Attributes:

ref_catalog_generator: function to generate reference catalog temp_output_sub_dir: subdirectory to store temporary files sextractor_catalog_purifier: function to purify photometric catalog crossmatch_radius_arcsec: crossmatch radius in arcsec write_regions: whether to write regions file cache: whether to cache the temporary files made by this processor

base_key = 'astrometrystatswriter'
check_prerequisites()[source]

Check to see if any prerequisite processors are missing

Returns:

None

get_sextractor_apertures() list[float][source]

Function to extract sextractor aperture sizes from config file Returns:

get_sextractor_module() Sextractor[source]

Get the Sextractor module from the preceding steps

setup_catalogs(image)[source]

Setup the reference catalog and image catalog

write_regions_files(image: Image, ref_cat: Table, img_cat: Table)[source]

Write regions files for the reference catalog and the image catalog

xmatch_catalogs(ref_cat: ~astropy.table.table.Table, image_cat: ~astropy.table.table.Table, crossmatch_radius_arcsec: float) -> (<class 'astropy.table.table.Table'>, <class 'astropy.table.table.Table'>, <class 'astropy.coordinates.angles.Angle'>)[source]

Cross-match the reference catalog to the image catalog

mirar.processors.base_catalog_xmatch_processor.default_image_sextractor_catalog_purifier(catalog: Table, image: Image, edge_width_pixels: float = 100.0, fwhm_threshold_arcsec: float = 4.0) Table[source]

Default function to purify the photometric image catalog

mirar.processors.base_processor module

Module containing the BaseProcessor

class mirar.processors.base_processor.BaseImageProcessor[source]

Bases: BaseProcessor, ImageHandler, ABC

Base processor handling images in/images out

class mirar.processors.base_processor.BaseProcessor[source]

Bases: object

Base processor class, to be inherited from for all processors

apply(batch: DataBatch)[source]

Function applying the processor to a DataBatch. Also updates the processing history.

Parameters:

batch – input data batch

Returns:

updated data batch

apply_to_batch(queue, cache_id: int)[source]

Function to run self.apply on a batch in the queue, catch any errors, and then update the internal cache with the results.

Parameters:
  • queue – python threading queue

  • cache_id – key for cache

Returns:

None

base_apply(dataset: Dataset) tuple[Dataset, ErrorStack][source]

Core function to act on a dataset, and return an updated dataset

Parameters:

dataset – Input dataset

Returns:

Updated dataset, and any caught errors

property base_key

Unique key for the processor, to be used e.g in processing history tracking

Returns:

None

check_prerequisites()[source]

Check to see if any prerequisite processors are missing

Returns:

None

clean_cache(cache_id: int)[source]

Function to clean the internal cache filled by base_apply

Parameters:

cache_id – key for cache

Returns:

None

generate_error_report(exception: Exception, batch: DataBatch) ErrorReport[source]

Generates an error report based on a python Exception

Parameters:
  • exception – exception raised

  • batch – batch which generated exception

Returns:

error report

max_n_cpu: int = 1
set_night(night_sub_dir: str | int = '')[source]

Sets the night subdirectory for the processor to read/write data

Parameters:

night_sub_dir – String/int subdirectory for night

Returns:

None

set_preceding_steps(previous_steps: list)[source]

Provides processor with the list of preceding processors, and saves this

Parameters:

previous_steps – list of processors

Returns:

None

subclasses = {'APERPHOT': <class 'mirar.processors.photometry.aperture_photometry.AperturePhotometry'>, 'AVRO': <class 'mirar.processors.avro.ipac_avro_exporter.IPACAvroExporter'>, 'DETCANDS': <class 'mirar.processors.sources.source_detector.ZOGYSourceDetector'>, 'DETSOURC': <class 'mirar.processors.sources.sextractor_source_detector.SextractorSourceDetector'>, 'PSFPHOT': <class 'mirar.processors.photometry.psf_photometry.PSFPhotometry'>, 'REFPREP': <class 'mirar.processors.reference.ProcessReference'>, 'REGWRIT': <class 'mirar.processors.sources.utils.regions_writer.RegionsWriter'>, 'SRCLOAD': <class 'mirar.processors.sources.source_loader.SourceLoader'>, 'SRCWRITE': <class 'mirar.processors.sources.source_exporter.SourceWriter'>, 'XMATCH': <class 'mirar.processors.xmatch.XMatch'>, 'ZOGY': <class 'mirar.processors.zogy.zogy.ZOGY'>, 'ZOGYPREP': <class 'mirar.processors.zogy.zogy.ZOGYPrepare'>, 'a-net': <class 'mirar.processors.astrometry.anet.anet_processor.AstrometryNet'>, 'astrometry_from_file': <class 'mirar.processors.astrometry.utils.AstrometryFromFile'>, 'astrometrystatswriter': <class 'mirar.processors.astrometry.validate.AstrometryStatsWriter'>, 'autoastrometry': <class 'mirar.processors.astrometry.autoastrometry.autoastrometry_processor.AutoAstrometry'>, 'batch': <class 'mirar.processors.utils.image_selector.ImageBatcher'>, 'bias': <class 'mirar.processors.bias.MasterBiasCalibrator'>, 'calhunt': <class 'mirar.processors.utils.cal_hunter.CalHunter'>, 'catlimmagcalc': <class 'mirar.processors.catalog_limiting_mag.CatalogLimitingMagnitudeCalculator'>, 'csvlog': <class 'mirar.processors.csvlog.CSVLog'>, 'custom_image_modifier': <class 'mirar.processors.utils.image_modifier.CustomImageBatchModifier'>, 'custom_source_modifier': <class 'mirar.processors.sources.source_table_modifier.CustomSourceTableModifier'>, 'dark': <class 'mirar.processors.dark.MasterDarkCalibrator'>, 'dbinserter': <class 'mirar.processors.database.database_inserter.DatabaseImageBatchInserter'>, 'dbselector': <class 'mirar.processors.database.database_selector.DatabaseHistorySelector'>, 'dbupdater': <class 'mirar.processors.database.database_updater.ImageDatabaseMultiEntryUpdater'>, 'debatch': <class 'mirar.processors.utils.image_selector.ImageDebatcher'>, 'egdemask': <class 'mirar.processors.sources.edge_mask.EdgeSourcesMask'>, 'errorannotate': <class 'mirar.processors.utils.error_annotator.ErrorStackAnnotator'>, 'filter': <class 'mirar.processors.sources.source_filter.BaseSourceFilter'>, 'flat': <class 'mirar.processors.flat.MasterFlatCalibrator'>, 'forcedphot': <class 'mirar.processors.sources.forced_photometry.ForcedPhotometryDetector'>, 'header_annotator': <class 'mirar.processors.utils.header_annotate.HeaderAnnotator'>, 'header_editor': <class 'mirar.processors.utils.header_annotate.HeaderEditor'>, 'header_reader': <class 'mirar.processors.utils.header_reader.HeaderReader'>, 'lacosmic': <class 'mirar.processors.cosmic_rays.LACosmicCleaner'>, 'load': <class 'mirar.processors.utils.multi_ext_parser.MultiExtParser'>, 'load_from_header': <class 'mirar.processors.utils.image_loader.LoadImageFromHeader'>, 'load_mef': <class 'mirar.processors.utils.image_loader.MEFLoader'>, 'maskdatasec': <class 'mirar.processors.mask.MaskDatasecPixels'>, 'maskfromfunction': <class 'mirar.processors.mask.MaskPixelsFromFunction'>, 'maskfrompath': <class 'mirar.processors.mask.MaskPixelsFromPath'>, 'maskfrompathinverted': <class 'mirar.processors.mask.MaskPixelsFromPathInverted'>, 'maskthresh': <class 'mirar.processors.mask.MaskAboveThreshold'>, 'maskwcs': <class 'mirar.processors.mask.MaskPixelsFromWCS'>, 'namer': <class 'mirar.processors.sources.namer.CandidateNamer'>, 'photcalibrator': <class 'mirar.processors.photcal.PhotCalibrator'>, 'psfex': <class 'mirar.processors.astromatic.psfex.psfex.PSFex'>, 'refimg_returner': <class 'mirar.processors.reference.GetReferenceImage'>, 'reject': <class 'mirar.processors.utils.image_rejector.ImageRejector'>, 'save': <class 'mirar.processors.utils.image_saver.ImageSaver'>, 'scamp': <class 'mirar.processors.astromatic.scamp.scamp.Scamp'>, 'select': <class 'mirar.processors.utils.image_selector.ImageSelector'>, 'sextractor': <class 'mirar.processors.astromatic.sextractor.sextractor.Sextractor'>, 'sextractorbkgsubtractor': <class 'mirar.processors.astromatic.sextractor.background_subtractor.SextractorBkgSubtractor'>, 'simrealtime': <class 'mirar.processors.utils.simulate_realtime.RealtimeImageSimulator'>, 'sky': <class 'mirar.processors.sky.MasterSkyCalibrator'>, 'skyportalsender': <class 'mirar.processors.skyportal.skyportal_candidate.SkyportalCandidateUploader'>, 'split': <class 'mirar.processors.split.SplitImage'>, 'swarp': <class 'mirar.processors.astromatic.swarp.swarp.Swarp'>, 'swarp_component_images': <class 'mirar.processors.astromatic.swarp.component_images.ReloadSwarpComponentImages'>, 'writemaskedcoords': <class 'mirar.processors.mask.WriteMaskedCoordsToFile'>, <property object>: <class 'mirar.processors.photometry.base_photometry.BasePhotometryProcessor'>}
update_dataset(dataset: Dataset) Dataset[source]

Update a dataset after processing

Parameters:

dataset – Initial dataset

Returns:

Updated dataset

class mirar.processors.base_processor.BaseSourceGenerator[source]

Bases: CleanupProcessor, ImageHandler, ABC

Base CandidateGenerator processor (image batch in, source batch out)

get_metadata(image: Image) dict[source]

Get metadata from image

Parameters:

image – Image to get metadata from

Returns:

Metadata dictionary

class mirar.processors.base_processor.BaseSourceProcessor[source]

Bases: BaseProcessor, ABC

Base dataframe processor (Source batch in, source batch out)

static generate_super_dict(metadata: dict, source_row: Series) dict[source]

Generate a dictionary of metadata and candidate row, with lower case keys

Parameters:
  • metadata – Metadata for the source table

  • source_row – Individual row of the source table

Returns:

Combined dictionary

class mirar.processors.base_processor.CleanupProcessor[source]

Bases: BaseProcessor, ABC

Processor which ‘cleans up’ by deleting empty batches

update_dataset(dataset: Dataset) Dataset[source]

Update a dataset after processing

Parameters:

dataset – Initial dataset

Returns:

Updated dataset

class mirar.processors.base_processor.ImageHandler[source]

Bases: object

Base class for handling images

static get_hash(image_batch: ImageBatch)[source]

Get a unique hash for an image batch

Parameters:

image_batch – image batch

Returns:

unique hash for that batch

static open_fits(path: str | Path) Image[source]

Opens a fits file, and returns an Image object

Parameters:

path – Path of image

Returns:

Image object

static save_fits(image: Image, path: str | Path)[source]

Save an Image to path

Parameters:
  • image – Image to save

  • path – path

Returns:

None

save_mask_image(image: Image, img_path: Path) Path[source]

Saves a mask image, following the astromatic software convention of masked value = 0. and non-masked value = 1.

Parameters:
  • image – Science image

  • img_path – Path of parent image

Returns:

Path of mask image

exception mirar.processors.base_processor.NoCandidatesError[source]

Bases: ProcessorError

An error raised if a CandidateGenerator produces no candidates

exception mirar.processors.base_processor.PrerequisiteError[source]

Bases: ProcessorError

An error raised if a processor requires another one as a prerequisite, but that processor is not present

class mirar.processors.base_processor.ProcessorPremadeCache(master_image_path: str | Path, *args, **kwargs)[source]

Bases: ProcessorWithCache, ABC

Processor with pre-made master image

get_cache_path(images: ImageBatch) Path[source]

Gets path for saving/loading cached image

Parameters:

images – Images to process

Returns:

Path to cached image

class mirar.processors.base_processor.ProcessorWithCache(try_load_cache: bool = True, write_to_cache: bool = True, overwrite: bool = True, cache_sub_dir: str = 'calibration')[source]

Bases: BaseImageProcessor, ABC

Image processor with cached images associated to it, e.g a master flat

get_cache_file(images: ImageBatch) Image[source]

Return the appropriate cached image for the batch

Parameters:

images – images to process

Returns:

cached image to use

get_cache_file_name(images: ImageBatch) str[source]

Get unique cache name for images

Parameters:

images – images to process

Returns:

unique hashed name

get_cache_path(images: ImageBatch) Path[source]

Gets path for saving/loading cached image

Parameters:

images – images to process

Returns:

cache path

make_image(images: ImageBatch) Image[source]

Make a cached image (e.g master flat)

Parameters:

images – images to use

Returns:

cached image

select_cache_images(images: ImageBatch) ImageBatch[source]

Select the appropriate cached image for the batch

Parameters:

images – images to process

Returns:

cached images to use

mirar.processors.bias module

Module containing processors for bias correction

class mirar.processors.bias.BiasCalibrator(*args, select_bias_images: ~collections.abc.Callable[[~mirar.data.image_data.ImageBatch], ~mirar.data.image_data.ImageBatch] = <function default_select_bias>, **kwargs)[source]

Bases: ProcessorWithCache

Processor to bias-correct images

base_key = 'bias'
make_image(images: ImageBatch) Image[source]

Make a cached image (e.g master flat)

Parameters:

images – images to use

Returns:

cached image

class mirar.processors.bias.MasterBiasCalibrator(master_image_path: str | Path, *args, **kwargs)[source]

Bases: ProcessorPremadeCache, BiasCalibrator

Processor to bias-correct with a master bias

mirar.processors.bias.default_select_bias(images: ImageBatch) ImageBatch[source]

Returns images in a batch with are tagged as bias

Parameters:

images – set of images

Returns:

subset of bias images

mirar.processors.cosmic_rays module

Module containing processors that mask cosmic rays

exception mirar.processors.cosmic_rays.CRCleanError[source]

Bases: NoncriticalProcessingError

Error derived from running cosmic ray cleaning processor

class mirar.processors.cosmic_rays.LACosmicCleaner(contrast=2, cr_threshold=5, neighbor_threshold=0.3, error=None, background=None, effective_gain=None, readnoise=None, maxiter=4, border_mode='mirror', min_exptime=None, effective_gain_key=None, readnoise_key=None)[source]

Bases: BaseImageProcessor

Processor to mask out cosmic rays.

base_key = 'lacosmic'

mirar.processors.csvlog module

Module to generate a CSV log of observations

class mirar.processors.csvlog.CSVLog(export_keys: list[str] | None = None, output_sub_dir: str = '', output_base_dir: str | None = None)[source]

Bases: BaseImageProcessor

Processor to generate a CSV log

base_key = 'csvlog'
get_log_name() str[source]

Returns the custom log name

Returns:

Lof file name

get_output_path() Path[source]

Returns the full log output path

Returns:

log path

max_n_cpu: int = 1

mirar.processors.dark module

Module for applying dark corrections

class mirar.processors.dark.DarkCalibrator(*args, select_cache_images: ~collections.abc.Callable[[~mirar.data.image_data.ImageBatch], ~mirar.data.image_data.ImageBatch] = <function default_select_dark>, **kwargs)[source]

Bases: ProcessorWithCache

Processor for applying dark correction

base_key = 'dark'
base_name = 'master_dark'
make_image(images: ImageBatch) Image[source]

Make a cached image (e.g master flat)

Parameters:

images – images to use

Returns:

cached image

class mirar.processors.dark.MasterDarkCalibrator(master_image_path: str | Path, *args, **kwargs)[source]

Bases: ProcessorPremadeCache, DarkCalibrator

Processor to apply master dark corrections

exception mirar.processors.dark.MissingDarkError[source]

Bases: ImageNotFoundError

Error for when a dark image is missing

mirar.processors.dark.default_select_dark(images: ImageBatch) ImageBatch[source]

Function to select images in a batch tagged as ‘dark’

Parameters:

images – images to filter

Returns:

batch of dark images

mirar.processors.flat module

Module containing processors for flat calibration

class mirar.processors.flat.FlatCalibrator(*args, x_min: int = 0, x_max: int = 9223372036854775807, y_min: int = 0, y_max: int = 9223372036854775807, flat_nan_threshold: float = 0.0, select_flat_images: ~collections.abc.Callable[[~mirar.data.image_data.ImageBatch], ~mirar.data.image_data.ImageBatch] = <function default_select_flat>, flat_mask_key: str | None = None, **kwargs)[source]

Bases: ProcessorWithCache

Processor to apply flat calibration

base_key = 'flat'
make_image(images: ImageBatch) Image[source]

Make a cached image (e.g master flat)

Parameters:

images – images to use

Returns:

cached image

class mirar.processors.flat.MasterFlatCalibrator(master_image_path: str | Path, *args, **kwargs)[source]

Bases: ProcessorPremadeCache, FlatCalibrator

Processor to do flat calibration with a master flate

exception mirar.processors.flat.MissingFlatError[source]

Bases: ImageNotFoundError

Error for when a dark image is missing

class mirar.processors.flat.SkyFlatCalibrator(flat_mask_key=None, *args, **kwargs)[source]

Bases: FlatCalibrator

Processor to do flat calibration using sky flats

static select_sky_flat(images: ImageBatch) ImageBatch[source]

Select science images to use as sky flats

Parameters:

images – set of images

Returns:

subset of ‘sky’ images

mirar.processors.flat.default_select_flat(images: ImageBatch) ImageBatch[source]

Select images tagged as flat

Parameters:

images – set of images

Returns:

subset of flat images

mirar.processors.mask module

Module containing processors which mask pixels

class mirar.processors.mask.BaseMask(write_masked_pixels_to_file: bool = False, output_dir: str | Path = 'mask', only_write_mask: bool = False)[source]

Bases: BaseImageProcessor

Base class for masking processors

get_mask(image) ndarray[bool][source]

Function to get the mask for a given image

class mirar.processors.mask.MaskAboveThreshold(threshold: float | None = None, threshold_key: str | None = None, write_masked_pixels_to_file: bool = False, output_dir: str | Path = 'mask', only_write_mask: bool = False)[source]

Bases: BaseMask

Processor to mask pixels above a threshold

base_key = 'maskthresh'
get_mask(image) ndarray[source]

Returns a mask for pixels above a threshold

Returns:

mask

class mirar.processors.mask.MaskDatasecPixels(write_masked_pixels_to_file: bool = False, output_dir: str | Path = 'mask', only_write_mask: bool = False)[source]

Bases: BaseMask

Processor to mask the data section of an image

base_key = 'maskdatasec'
get_mask(image: Image) ndarray[source]

Function to mask the data section of an image

class mirar.processors.mask.MaskPixelsFromFunction(mask_function: Callable[[Image], ndarray], write_masked_pixels_to_file: bool = False, output_dir: str | Path = 'mask', only_write_mask: bool = False)[source]

Bases: BaseMask

Processor to apply a mask to images using a function

base_key = 'maskfromfunction'
get_mask(image) ndarray[source]

Function to get the mask for a given image

class mirar.processors.mask.MaskPixelsFromPath(mask_path: str | Path | None = None, mask_path_key: str | None = None, write_masked_pixels_to_file: bool = False, output_dir: str | Path = 'mask', only_write_mask: bool = False)[source]

Bases: BaseMask

Processor to apply a mask to images using another `mask image’. Following the general mirar convention, every zero pixel in the mask image will be masked in the science image.

base_key = 'maskfrompath'
get_mask(image) ndarray[source]

loads mask if needed, and returns it

Returns:

mask

class mirar.processors.mask.MaskPixelsFromPathInverted(mask_path: str | Path | None = None, mask_path_key: str | None = None, write_masked_pixels_to_file: bool = False, output_dir: str | Path = 'mask', only_write_mask: bool = False)[source]

Bases: MaskPixelsFromPath

Processor to apply a mask to images using another `mask image’. In contrast to the general mirar convention, every non-zero pixel in the mask image will be masked in the science image.

base_key = 'maskfrompathinverted'
get_mask(image) ndarray[source]

Mask pixels which are non-zero in the mask file. This is the inverse of MaskPixelsFromPath, which masks pixels which are zero in the mask file.

Parameters:

image – image to mask

Returns:

Boolean mask

class mirar.processors.mask.MaskPixelsFromWCS(mask_pixels_ra: float | list[float] | None = None, mask_pixels_dec: float | list[float] | None = None, mask_file_key: str = 'MASKFITS', write_masked_pixels_to_file: bool = False, output_dir: str | Path = 'mask', only_write_mask: bool = False)[source]

Bases: BaseMask

Processor to mask pixels from a file where WCS coordinates of masked pixels are given

base_key = 'maskwcs'
get_mask(image) ndarray[source]

loads mask if needed, and returns it

Returns:

mask

class mirar.processors.mask.WriteMaskedCoordsToFile(output_dir: str | Path = 'mask', only_write_mask: bool = False)[source]

Bases: BaseMask

Processor to write masked coordinates to a file

base_key = 'writemaskedcoords'
get_mask(image) ndarray[source]

Function to get the mask for a given image

mirar.processors.photcal module

Module for running photometric calibration

class mirar.processors.photcal.PhotCalibrator(ref_catalog_generator: ~collections.abc.Callable[[~mirar.data.image_data.Image], ~mirar.catalog.base_catalog.BaseCatalog], temp_output_sub_dir: str = 'phot', image_photometric_catalog_purifier: ~collections.abc.Callable[[~astropy.table.table.Table, ~mirar.data.image_data.Image], ~astropy.table.table.Table] = <function default_image_sextractor_catalog_purifier>, num_matches_threshold: int = 5, crossmatch_radius_arcsec: float = 1.0, write_regions: bool = False, cache: bool = False, outlier_rejection_threshold: float | list[float] = 3.0)[source]

Bases: BaseProcessorWithCrossMatch

Photometric calibrator processor

Attributes:

num_matches_threshold: minimum number of matches required for photometric calibration outlier_rejection_threshold: float or list of floats to use as number of sigmas for outlier rejection. If a ist is provided, the list is sorted and stepped through in order with increasing thresholds until the specified number of matches is reached.

base_key = 'photcalibrator'
calculate_zeropoint(ref_cat: Table, clean_img_cat: Table) list[dict][source]

Function to calculate zero point from two catalogs Args:

ref_cat: Reference catalog table clean_img_cat: Catalog of sources from image to xmatch with ref_cat

Returns:

get_phot_output_dir()[source]

Return the :return:

exception mirar.processors.photcal.PhotometryCalculationError[source]

Bases: PhotometryError

Error related to the photometric calibration

exception mirar.processors.photcal.PhotometryCrossMatchError[source]

Bases: PhotometryError

Error related to cross-matching photometric reference and source catalogues

exception mirar.processors.photcal.PhotometryError[source]

Bases: ProcessorError

Base error for photometric calibration

exception mirar.processors.photcal.PhotometryReferenceError[source]

Bases: PhotometryError

Error related to the photometric reference catalogue

exception mirar.processors.photcal.PhotometrySourceError[source]

Bases: PhotometryError

Error related to the photometric source catalogue

mirar.processors.photcal.get_maglim(bkg_rms_image_path: str | Path, zeropoint: float | list[float], aperture_radius_pixels: float | list[float]) float[source]

Function to calculate limiting magnitude Args:

bkg_rms_image_path: zeropoint: aperture_radius_pixels:

Returns:

mirar.processors.reference module

This module contains the ProcessReference class, which is used to generate reference images.

class mirar.processors.reference.GetReferenceImage(ref_image_generator: Callable[[...], BaseReferenceGenerator], output_sub_dir: str = 'ref')[source]

Bases: BaseImageProcessor

Processor to get reference images and save them to a directory

base_key = 'refimg_returner'
class mirar.processors.reference.ProcessReference(ref_image_generator: Callable[[...], BaseReferenceGenerator], swarp_resampler: Callable[[...], Swarp], sextractor: Callable[[...], Sextractor], ref_psfex: Callable[[...], PSFex], temp_output_subtract_dir: str = 'subtract')[source]

Bases: BaseImageProcessor

Processor to process reference images.

base_key = 'REFPREP'
static get_image_header_params(image: Image)[source]

Get the header parameters from the image.

get_sub_output_dir() Path[source]

Get the output directory for the subtracted images.

mirar.processors.sky module

Module for sky subtraction

class mirar.processors.sky.MasterSkyCalibrator(master_image_path: str | Path, *args, **kwargs)[source]

Bases: ProcessorPremadeCache, NightSkyMedianCalibrator

Processor to subtract a master sky image

class mirar.processors.sky.NightSkyMedianCalibrator(flat_mask_key=None, *args, **kwargs)[source]

Bases: SkyFlatCalibrator

Processor for sky subtraction

base_key = 'sky'

mirar.processors.split module

Module for splitting images into sub-images

class mirar.processors.split.SplitImage(buffer_pixels: int = 0, n_x: int = 1, n_y: int = 1)[source]

Bases: BaseImageProcessor

Processor for splitting images

base_key = 'split'
get_range(n_chunks: int, pixel_width: int, i: int) tuple[int, int][source]

Function to return pixel index range for sub images

Parameters:
  • n_chunks – number of chunks to divide axis into

  • pixel_width – total pixel width of axis

  • i – index of chunk to evaluate

Returns:

lower pixel index and upper pixel index of chunk

update_dataset(dataset: Dataset) Dataset[source]

Update a dataset after processing

Parameters:

dataset – Initial dataset

Returns:

Updated dataset

mirar.processors.xmatch module

Module to cross-match a candidate_table with different catalogs

class mirar.processors.xmatch.XMatch(catalog: BaseXMatchCatalog)[source]

Bases: BaseSourceProcessor

Class to cross-match a candidate_table to a catalog

base_key = 'XMATCH'