mirar package
Subpackages
- mirar.catalog package
- mirar.data package
- mirar.downloader package
- mirar.errors package
- mirar.monitor package
- mirar.pipelines package
- Subpackages
- mirar.pipelines.sedmv2 package
- mirar.pipelines.summer package
- mirar.pipelines.winter package
- Subpackages
- Submodules
- mirar.pipelines.winter.blocks module
- mirar.pipelines.winter.build_references module
- mirar.pipelines.winter.constants module
- mirar.pipelines.winter.fix_headers module
- mirar.pipelines.winter.generator module
- mirar.pipelines.winter.load_winter_image module
- mirar.pipelines.winter.winter_pipeline module
- mirar.pipelines.wirc package
- Submodules
- mirar.pipelines.base_pipeline module
PipelinePipeline.add_configuration()Pipeline.all_pipeline_configurationsPipeline.configure_processors()Pipeline.default_cal_requirementsPipeline.download_raw_images_for_night()Pipeline.get_error_output_path()Pipeline.load_pipeline_configuration()Pipeline.load_raw_image()Pipeline.namePipeline.non_linear_levelPipeline.pipelinesPipeline.postprocess_configuration()Pipeline.reduce_images()Pipeline.set_configuration()Pipeline.unpack_raw_image()
- Subpackages
- mirar.processors package
- Subpackages
- mirar.processors.alerts package
- mirar.processors.astromatic package
- mirar.processors.astrometry package
- mirar.processors.candidates package
- Subpackages
- Submodules
- mirar.processors.candidates.bright_star_mask module
- mirar.processors.candidates.candidate_detector module
- mirar.processors.candidates.candidate_extractor module
- mirar.processors.candidates.candidate_filter module
- mirar.processors.candidates.edge_mask module
- mirar.processors.candidates.namer module
- mirar.processors.database package
- Submodules
- mirar.processors.database.base_database_processor module
- mirar.processors.database.constraints module
- mirar.processors.database.database_exporter module
- mirar.processors.database.database_importer module
- mirar.processors.database.database_modifier module
- mirar.processors.database.postgres module
- mirar.processors.database.utils module
- mirar.processors.sqldatabase package
- mirar.processors.utils package
- Submodules
- mirar.processors.utils.cal_hunter module
- mirar.processors.utils.error_annotator module
- mirar.processors.utils.header_annotate module
- mirar.processors.utils.header_reader module
- mirar.processors.utils.image_loader module
- mirar.processors.utils.image_rejector module
- mirar.processors.utils.image_saver module
- mirar.processors.utils.image_selector module
- mirar.processors.utils.multi_ext_parser module
- mirar.processors.utils.simulate_realtime module
- Submodules
- mirar.processors.base_catalog_xmatch_processor module
BaseProcessorWithCrossMatchBaseProcessorWithCrossMatch.base_keyBaseProcessorWithCrossMatch.check_prerequisites()BaseProcessorWithCrossMatch.get_sextractor_apertures()BaseProcessorWithCrossMatch.get_sextractor_module()BaseProcessorWithCrossMatch.setup_catalogs()BaseProcessorWithCrossMatch.write_regions_files()BaseProcessorWithCrossMatch.xmatch_catalogs()
default_image_sextractor_catalog_purifier()
- mirar.processors.base_processor module
BaseImageProcessorBaseProcessorBaseProcessor.apply()BaseProcessor.apply_to_batch()BaseProcessor.base_apply()BaseProcessor.base_keyBaseProcessor.check_prerequisites()BaseProcessor.clean_cache()BaseProcessor.generate_error_report()BaseProcessor.max_n_cpuBaseProcessor.set_night()BaseProcessor.set_preceding_steps()BaseProcessor.subclassesBaseProcessor.update_dataset()
BaseSourceGeneratorBaseSourceProcessorCleanupProcessorImageHandlerNoCandidatesErrorPrerequisiteErrorProcessorPremadeCacheProcessorWithCache
- mirar.processors.bias module
- mirar.processors.cosmic_rays module
- mirar.processors.csvlog module
- mirar.processors.dark module
- mirar.processors.flat module
- mirar.processors.mask module
- mirar.processors.photcal module
- mirar.processors.reference module
- mirar.processors.sky module
- mirar.processors.split module
- mirar.processors.xmatch module
- Subpackages
- mirar.references package
- mirar.utils package
Submodules
mirar.io module
Python script containing all IO functions.
All opening/writing of fits files should run via this script.
- exception mirar.io.MissingCoreFieldError[source]
Bases:
KeyErrorBase class for missing core field errors
- mirar.io.check_file_is_complete(path: str) bool[source]
Function to check whether a fits file is as large as expected. Useful to verify with e.g rsync, where files can be partially transferred
Disclaimer: I (Robert) do not feel great about having written this code block. It seems to works though, let’s hope no one finds out! I will cover my tracks by hiding the astropy warning which inspired this block, informing the user that the file is not as long as expected
- Parameters:
path – path of file to check
- Returns:
boolean file complete
- mirar.io.check_image_has_core_fields(img: Image)[source]
Function to ensure that an image has all the core fields
- Parameters:
img – Image object to check
- Returns:
None
- mirar.io.combine_mef_extension_file_headers(primary_header: Header, extension_header: Header) Header[source]
Function to combine the primary header with an extension header in a MEF frame
- Parameters:
primary_header – astropy Header object
extension_header – astropy Header object
- Returns:
astropy Header object
- mirar.io.create_fits(data: ndarray, header: Header | None) PrimaryHDU[source]
Return an astropy PrimaryHDU object created with <data> and <header>
- Parameters:
data – numpy ndarray containing image data
header – astropy Header object
- Returns:
astropy PrimaryHDU object containing the image data and header
- mirar.io.open_fits(path: str | Path) tuple[ndarray, Header][source]
Function to open a fits file saved to <path>
- Parameters:
path – path of fits file
- Returns:
tuple containing image data and image header
- mirar.io.open_mef_fits(path: str | Path) tuple[Header, list[ndarray], list[Header]][source]
Function to open a MEF fits file saved to <path>
- Parameters:
path – path of fits file
- Returns:
tuple containing image data and image header
- mirar.io.open_mef_image(path: str | ~pathlib.Path, open_f: ~typing.Callable[[str | ~pathlib.Path], tuple[~astropy.io.fits.header.Header, list[~numpy.ndarray], list[~astropy.io.fits.header.Header]]] = <function open_mef_fits>, extension_key: str | None = None) list[Image][source]
Function to open a raw image as an Image object
- Parameters:
path – path of raw image
open_f – function to open the raw image
extension_key – key to use to number the MEF frames
- Returns:
Image object
- mirar.io.open_raw_image(path: str | ~pathlib.Path, open_f: ~typing.Callable[[str | ~pathlib.Path], tuple[~numpy.ndarray, ~astropy.io.fits.header.Header]] = <function open_fits>) Image[source]
Function to open a raw image as an Image object
- Parameters:
path – path of raw image
open_f – function to open the raw image
- Returns:
Image object
- mirar.io.save_fits(image: Image, path: str | Path)[source]
Save an Image to path
- Parameters:
image – Image to save
path – path
- Returns:
None
- mirar.io.save_hdu_as_fits(hdu: PrimaryHDU, path: str | Path, overwrite: bool = True)[source]
Wrapper function to save an astropy hdu to file
- Parameters:
hdu – hdu to save
path – path to save
overwrite – boolean whether to overwrite
- Returns:
None
- mirar.io.save_mef_to_path(data_list, header_list, primary_header, path)[source]
Function to save a MEF image with <data> and <header> to <path>.
- mirar.io.save_to_path(data: ndarray, header: Header | None, path: str | Path, overwrite: bool = True)[source]
Function to save an image with <data> and <header> to <path>.
- Parameters:
data – numpy ndarray containing image data
header – astropy Header object
path – output path to save to
overwrite – boolean variable opn whether to overwrite of an image exists at <path>. Defaults to True.
- Returns:
None
- mirar.io.tag_mef_extension_file_headers(primary_header: Header, extension_headers: list[Header], extension_key: str | None = None) list[Header][source]
Function to tag the extension headers in a MEF frame
- Parameters:
primary_header – Primary header
extension_headers – Extension headers
extension_key – Key to use for tagging the extension headers
- Returns:
List of tagged extension headers
mirar.paths module
Central module hosting all shared paths/directory conventions/keys/variables
- mirar.paths.copy_temp_file(output_dir: Path, file_path: Path) Path[source]
Copies a file at file_path to a temporary path in output dir, then returns temp path
- Parameters:
output_dir – output directory
file_path – file to cope
- Returns:
path of temporary file
- mirar.paths.get_astrometry_keys() list[source]
Function to get a list of common astrometric keywords that could be present in a fits header Returns:
- mirar.paths.get_mask_path(img_path: str | Path) Path[source]
Returns a mask image path
- Parameters:
img_path – parent image
- Returns:
custom path for weight image
- mirar.paths.get_output_dir(dir_root: str, sub_dir: str | int = '', output_dir: Path = PosixPath('/home/docs')) Path[source]
Generic function to get a full output directory combining dir_root, sub_dir and the parent output directory
- Parameters:
dir_root – directory within subdir, e.g ‘raw’ or ‘processed’
sub_dir – subdirectory in parent directory, typically a night e.g 20221223
output_dir – parent output directory
- Returns:
full output directory
- mirar.paths.get_output_path(base_name: str, dir_root: str, sub_dir: str | int = '', output_dir: Path = PosixPath('/home/docs')) Path[source]
Generic function to get a full output path combining the file name, dir_root, sub_dir and the parent output directory
- Parameters:
base_name – name of file
dir_root – directory within subdir, e.g ‘raw’ or ‘processed’
sub_dir – subdirectory in parent directory, typically a night e.g 20221223
output_dir – parent output directory
- Returns:
full output directory
- mirar.paths.get_temp_path(output_dir: Path, file_path: Path | str) Path[source]
Gets a temporary path, in output dir, with name of file_path
- Parameters:
output_dir – Output directory
file_path – current path of file
- Returns:
temporary path
- mirar.paths.get_untemp_path(temp_path: Path | str) Path[source]
Converts a temporary path to a regular path.
Essentially undoes ..:func:mirar.path.get_temp_path
- Parameters:
temp_path – temporary file path
- Returns:
normal file path
mirar.testing module
Base class for unit testing, with common cleanup method