The tweakreg_step function (class name TweakRegStep) is the top-level function used to call the “tweakreg” operation from the JWST calibration pipeline.

JWST pipeline step for image alignment.


Mihai Cara

class jwst.tweakreg.tweakreg_step.TweakRegStep(name=None, parent=None, config_file=None, _validate_kwds=True, **kws)[source]

TweakRegStep: Image alignment based on catalogs of sources detected in input images.

Create a Step instance.

  • 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 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.


This is where real work happens. Every Step subclass has to override this method. The default behaviour is to raise a NotImplementedError exception.

reference_file_types = []
spec = "\n save_catalogs = boolean(default=False) # Write out catalogs?\n catalog_format = string(default='ecsv') # Catalog output file format\n kernel_fwhm = float(default=2.5) # Gaussian kernel FWHM in pixels\n snr_threshold = float(default=10.0) # SNR threshold above the bkg\n brightest = integer(default=1000) # Keep top ``brightest`` objects\n peakmax = float(default=None) # Filter out objects with pixel values >= ``peakmax``\n enforce_user_order = boolean(default=False) # Align images in user specified order?\n expand_refcat = boolean(default=False) # Expand reference catalog with new sources?\n minobj = integer(default=15) # Minimum number of objects acceptable for matching\n searchrad = float(default=1.0) # The search radius in arcsec for a match\n use2dhist = boolean(default=True) # Use 2d histogram to find initial offset?\n separation = float(default=0.5) # Minimum object separation in arcsec\n tolerance = float(default=1.0) # Matching tolerance for xyxymatch in arcsec\n xoffset = float(default=0.0), # Initial guess for X offset in arcsec\n yoffset = float(default=0.0) # Initial guess for Y offset in arcsec\n fitgeometry = option('shift', 'rscale', 'general', default='general') # Fitting geometry\n nclip = integer(min=0, default=3) # Number of clipping iterations in fit\n sigma = float(min=0.0, default=3.0) # Clipping limit in sigma units\n align_to_gaia = boolean(default=False) # Align to GAIA catalog\n gaia_catalog = option('GAIADR2', 'GAIADR1', default='GAIADR2')\n min_gaia = integer(min=0, default=5) # Min number of GAIA sources needed\n save_gaia_catalog = boolean(default=False) # Write out GAIA catalog as a separate product\n "