TweakRegStep¶
- class romancal.tweakreg.TweakRegStep(name=None, parent=None, config_file=None, _validate_kwds=True, **kws)[source]¶
Bases:
RomanStep
TweakRegStep: Image alignment based on catalogs of sources detected in input images.
Create a
Step
instance.- Parameters:
name (str, optional) – The name of the Step instance. Used in logging messages and in cache filenames. If not provided, one will be generated based on the class name.
parent (Step instance, optional) – The parent step of this step. Used to determine a fully-qualified name for this step, and to determine the mode in which to run this step.
config_file (str or pathlib.Path, optional) – The path to the config file that this step was initialized with. Use to determine relative path names of other config files.
**kws (dict) – Additional parameters to set. These will be set as member variables on the new Step instance.
Attributes Summary
Methods Summary
do_absolute_alignment
(ref_image, imcats)Perform absolute alignment of images.
do_relative_alignment
(imcats)Perform relative alignment of images.
get_tweakreg_catalog
(source_catalog, image_model)Retrieve the tweakreg catalog from source detection.
process
(input)This is where real work happens.
read_catalog
(catalog_name)Reads a source catalog from a specified file.
Update the source catalog coordinates using the tweaked WCS.
Attributes Documentation
- class_alias = 'tweakreg'¶
- reference_file_types: ClassVar = []¶
- spec¶
use_custom_catalogs = boolean(default=False) # Use custom user-provided catalogs? catalog_format = string(default='ascii.ecsv') # Catalog output file format catfile = string(default='') # Name of the file with a list of custom user-provided catalogs catalog_path = string(default='') # Catalog output file path enforce_user_order = boolean(default=False) # Align images in user specified order? expand_refcat = boolean(default=False) # Expand reference catalog with new sources? minobj = integer(default=15) # Minimum number of objects acceptable for matching searchrad = float(default=2.0) # The search radius in arcsec for a match use2dhist = boolean(default=True) # Use 2d histogram to find initial offset? separation = float(default=1.0) # Minimum object separation in arcsec tolerance = float(default=0.7) # Matching tolerance for xyxymatch in arcsec fitgeometry = option('shift', 'rshift', 'rscale', 'general', default='rshift') # Fitting geometry nclip = integer(min=0, default=3) # Number of clipping iterations in fit sigma = float(min=0.0, default=3.0) # Clipping limit in sigma units abs_refcat = string(default='GAIADR3') # Absolute reference # catalog. Options: GAIADR3,GAIADR2,GAIADR1 save_abs_catalog = boolean(default=False) # Write out used absolute astrometric reference catalog as a separate product abs_minobj = integer(default=15) # Minimum number of objects acceptable for matching when performing absolute astrometry abs_searchrad = float(default=6.0) # The search radius in arcsec for a match when performing absolute astrometry # We encourage setting this parameter to True. Otherwise, xoffset and yoffset will be set to zero. abs_use2dhist = boolean(default=True) # Use 2D histogram to find initial offset when performing absolute astrometry? abs_separation = float(default=1.0) # Minimum object separation in arcsec when performing absolute astrometry abs_tolerance = float(default=0.7) # Matching tolerance for xyxymatch in arcsec when performing absolute astrometry # Fitting geometry when performing absolute astrometry abs_fitgeometry = option('shift', 'rshift', 'rscale', 'general', default='rshift') abs_nclip = integer(min=0, default=3) # Number of clipping iterations in fit when performing absolute astrometry abs_sigma = float(min=0.0, default=3.0) # Clipping limit in sigma units when performing absolute astrometry output_use_model = boolean(default=True) # When saving use `DataModel.meta.filename` update_source_catalog_coordinates = boolean(default=False) # Update source catalog file with tweaked coordinates? save_l1_wcs = boolean(default=True)
Methods Documentation
- do_absolute_alignment(ref_image, imcats)[source]¶
Perform absolute alignment of images.
This method retrieves a reference image and performs absolute alignment using the specified parameters, including reference WCS information and catalog details. It aligns the provided image catalogs to the absolute reference catalog.
- Parameters:
ref_image (DataModel) – The reference image used for alignment, which contains WCS information.
imcats (list) – A list of image catalogs containing source information for alignment.
- Return type:
None
- do_relative_alignment(imcats)[source]¶
Perform relative alignment of images.
This method performs relative alignment with the specified parameters, including search radius, separation, and fitting geometry.
- Parameters:
imcats (list) – A list of image catalogs containing source information for alignment.
- Return type:
None
- get_tweakreg_catalog(source_catalog, image_model)[source]¶
Retrieve the tweakreg catalog from source detection.
This method checks the source detection metadata for the presence of a tweakreg catalog data or a string with its name. It returns the catalog as a Table object if either is found, or raises an error if neither is available.
- Parameters:
source_catalog (object) – The source catalog metadata containing catalog information.
image_model (DataModel) – The image model associated with the source detection.
- Returns:
The retrieved tweakreg catalog as a Table object.
- Return type:
Table
- Raises:
AttributeError – If the required catalog information is missing from the source detection.
- process(input)[source]¶
This is where real work happens. Every Step subclass has to override this method. The default behaviour is to raise a NotImplementedError exception.
- read_catalog(catalog_name)[source]¶
Reads a source catalog from a specified file.
This function determines the format of the catalog based on the file extension:
“asdf”: uses roman datamodels
“parquet”: uses pyarrow
otherwise: uses astropy Table.
- Parameters:
catalog_name (str) – The name of the catalog file to read.
- Returns:
The read catalog as a Table object.
- Return type:
Table
- Raises:
ValueError – If the catalog format is unsupported.
- update_catalog_coordinates(tweakreg_catalog_name, tweaked_wcs)[source]¶
Update the source catalog coordinates using the tweaked WCS.
- Parameters:
tweakreg_catalog_name (str) – The name of the TweakReg catalog file produced by
SourceCatalog
.tweaked_wcs (
gwcs.wcs.WCS
) – The tweaked World Coordinate System (WCS) object.
- Return type:
None