CalibrationImageο
- class CalibrationImage[source]ο
Class representing a calibration FITS image (e.g., bias or dark frame).
Inherits from BaseImage and provides methods for managing calibration image metadata, processing status tracking, and handling associated products like logs, masks, and status files. This class is used to manage bias or dark frames and is typically used in preprocessing steps like bias correction or dark subtraction.
- Parameters:
path (str or Path) β Path to the calibration FITS image.
telinfo (dict, optional) β Telescope metadata dictionary (e.g., observatory name, CCD ID, pixel scale).
status (Status, optional) β Status object tracking processing completion for each calibration step. If not provided, status is initialized or loaded from disk.
load (bool, optional) β Whether to automatically load header and status from the file at initialization.
Methodsο
- run_ds9(self)ο
Open the image with SAOImage DS9.
- Parameters:
None
- Return type:
None
- show_position(self, x, y, coord_type='coord', radius_arcsec=None, a_arcsec=None, b_arcsec=None, theta_deg=None, aperture_linewidth=1.0, aperture_color='red', aperture_label='detected', downsample=4, zoom_radius_pixel=100, cmap='gray', scale='zscale', figsize=(6, 6), title=None, title_fontsize=18, ax=None, save_path=None)ο
Display a zoomed-in view around a given (x, y) or (RA, Dec) position.
- Parameters:
x (float) β X-coordinate (pixel or RA)
y (float) β Y-coordinate (pixel or Dec)
radius_arcsec (float, optional) β Radius of the circle in arcseconds. Default is None.
a_arcsec (float, optional) β Semi-major axis of the ellipse in arcseconds. Default is None.
b_arcsec (float, optional) β Semi-minor axis of the ellipse in arcseconds. Default is None.
theta_deg (float, optional) β Position angle of the ellipse in degrees. Default is None.
coord_type (str, optional) β βpixelβ or βcoordβ. Default is βpixelβ.
downsample (int, optional) β Step size for downsampling via slicing. Default is 4.
zoom_radius_pixel (int, optional) β Radius of the zoom-in region in pixels. Default is 100.
cmap (str, optional) β Matplotlib colormap. Default is βgrayβ.
scale (str, optional) β Scaling method. Default is βzscaleβ.
figsize (tuple, optional) β Matplotlib figure size. Default is (6, 6).
ax (matplotlib Axes object, optional) β If provided, the image will be plotted on this axis. Default is None.
save_path (str, optional) β Path to save the figure. Default is None.
title (bool, optional) β Whether to display the title. Default is True.
- load(self)ο
Load both image data and header from disk.
- Parameters:
None
- Return type:
None
- write(self, verbose=True)ο
Write CalibrationImage data to savepath.
- Parameters:
None
- Return type:
None
- remove(self, remove_main=True, remove_connected_files=True, skip_patterns=[], verbose=True)ο
- Return type:
dict
- copy(self)ο
Make a deep copy of the CalibrationImage instance.
- Parameters:
None
- Returns:
new_instance β A deep copy of the CalibrationImage instance.
- Return type:
- 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
- Returns:
status β Status object loaded from the JSON file.
- Return type:
Status
- save_status(self)ο
Save processing status to a JSON file.
- Parameters:
None
- Return type:
None
- update_status(self, process_name)ο
Mark a process as completed and update time.
- Parameters:
process_name (str) β Name of the process to update.
- save_info(self)ο
Save processing info to a JSON file.
- Parameters:
None
- Return type:
None
Propertiesο
Key Properties
Property |
Description |
|---|---|
|
Altitude of the telescope. |
|
Return a list of available telescope keys. |
|
Azimuth of the telescope. |
|
Path to the bias image. |
|
Binning of the image. |
|
Type of the background image. |
|
Name of the CCD. |
|
CCD temperature. |
|
Center pixel (0-based) and its world coordinates (RA, Dec). |
|
Return all associated files that would be deleted in remove() if remove_connected_files=True, |
|
Path to the dark image. |
|
Image data array. |
|
Declination of the target. |
|
Depth of the image. |
|
Electron gain of the image. |
|
Type of the emap image. |
|
Exposure time of the image. |
|
Filter name. |
|
Path to the flat image. |
|
Field of view along the first axis. |
|
Field of view along the second axis. |
|
Gain of the image. |
|
FITS header object. |
|
Type of the image. Among BIAS, DARK, FLAT, LIGHT, OBJECT, UNKNOWN. |
|
Register necessary info fields |
|
Whether the image data is loaded. |
|
Whether the image file exists. |
|
Whether the image header is loaded. |
|
Check if the image has been saved |
|
Julian date of the observation. |
|
Type of the mask image. |
|
Modified Julian date of the observation. |
|
Number of pixels along the first axis. |
|
Number of pixels along the second axis. |
|
Number of combined images. |
|
Object name. |
|
Observation date in UTC. |
|
Name of the observatory. |
|
Observation mode. |
|
Pixel scale of the image. |
|
Right ascension of the target. |
|
Return the directory where this image and associated files will be saved. |
|
Dynamically builds save paths based on current header info |
|
Seeing of the image. |
|
Spectroscopic mode. |
|
Name of the telescope. |
|
WCS information of the image. |
|
Zero point of the image. |
|
Zero point error of the image. |