Errormap

class Errormap[source]

Class representing an error map image for astronomical data processing.

Inherits from DummyImage and provides methods for creating, combining, and managing various types of error maps including background weight, background RMS, source weight, and source RMS maps.

Parameters:
  • path (Union[str, Path]) – Path to the error map FITS image.

  • emaptype (str, optional) – Type of error map (β€˜none’, β€˜bkgweight’, β€˜bkgrms’, β€˜sourceweight’,’sourcerms’).

  • status (Status, optional) – Initial status object. If not provided, status is loaded from file or initialized.

  • load (bool, optional) – Whether to load status and header upon initialization.

__init__(path, emaptype='None', status=None, load=False)[source]

Methods

show(self, cmap='gray', scale='zscale', downsample=4, figsize=(8, 6), title=None, save_path=False, close_fig=False)

Visualize the FITS image using slicing-based downsampling and scaling.

Parameters:
  • cmap (str, optional) – Matplotlib colormap. Default is β€˜gray’.

  • scale (str, optional) – Scaling method. Default is β€˜zscale’.

  • downsample (int, optional) – Step size for downsampling via slicing. Default is 4.

  • figsize (tuple, optional) – Matplotlib figure size. Default is (8, 6).

  • title (str, optional) – Plot title. Default is None.

  • save_path (str, optional) – Path to save the figure. Default is None.

  • close_fig (bool, optional) – If True, close the figure after saving. Default is False.

run_ds9(self)

Open the image with SAOImage DS9.

Parameters:

None

Return type:

None

to_rms(self)

Convert the Errormap to a Background RMS image.

Parameters:

None

Return type:

None

to_weight(self)

Convert the Errormap to a Weight image.

Parameters:

None

Return type:

None

load(self)

Load both image data and header from disk.

Parameters:

None

Return type:

None

write(self, verbose=True)

Save Errormap to FITS file.

Parameters:

None

Return type:

None

remove(self, remove_main=True, remove_connected_files=True, skip_patterns=['*.png', '*.cat'], verbose=True)
Return type:

dict

copy(self)

Return an in-memory deep copy of this Mask instance,

Parameters:

None

Return type:

None

rename(self, new_name, verbose=True)

Rename the image file and update the internal path.

Parameters:

new_name (str) – New name of the image file.

Return type:

None

clear(self, clear_data=True, clear_header=False, verbose=True)

Clear the image data and/or header from memory.

Parameters:
  • clear_data (bool, optional) – If True, clear the image data. Default is True.

  • clear_header (bool, optional) – If True, clear the image header. Default is False.

Additional Methods

update_header(self, **kwargs)

Update FITS header values using known key variants.

Parameters:

kwargs (dict) – Keyword arguments to update the FITS header.

Return type:

None

load_status(self)

Load processing status from a JSON file.

Parameters:

None

Return type:

None

save_status(self)

Save processing status to a JSON file.

Parameters:

None

Return type:

None

add_status(self, event_name, **event_details)

Add a status event to the mask.

Parameters:
  • event_name (str) – Name of the event to add.

  • event_details (dict) – Details of the event to add.

save_info(self)

Save processing info to JSON file.

Parameters:

None

Return type:

None

Properties

Key Properties

Property

Description

available_telescope_keys

Return a list of available telescope keys.

center

Center pixel (0-based) and its world coordinates (RA, Dec).

connected_files

Return all associated files that would be deleted in remove() if remove_connected_files=True,

data

Image data array.

egain

Electron gain of the image.

exptime

Exposure time of the image.

fovx

Field of view along the first axis.

fovy

Field of view along the second axis.

header

FITS header object.

info

Register necessary info fields

is_data_loaded

Check if the image data is loaded.

is_exists

Check if the image file exists.

is_header_loaded

Check if the image header is loaded.

is_saved

Check if the image has been saved

naxis1

Number of pixels along the first axis.

naxis2

Number of pixels along the second axis.

pixelscale

Pixel scale of the image.

savedir

Return the directory where this image and associated files will be saved.

savepath

Dynamically builds save paths based on current header info

target_img

wcs

WCS information of the image.