GetWCSAdjustStep
This step calculates shifts to get good relative alignment between tiles in a mosaic. Since longer wavelengths may not have sources (and hence astrometry may fail catastrophically), we can instead defined a reference band to calculate a shift per-visit (since JWST cycles between filters), and apply that shift to all tiles in that visit. Our testing shows that taking a long NIRCam band that is ideally stellar dominated (i.e. F300M) works best for NIRCam, and a shorter wavelength, non-PAH-dominated MIRI band (i.e. F1000W) is ideal for MIRI.
By default, this step uses tweakreg, but can also be swapped out for cross-correlation via optical flow. This may be more optimal if you don’t have any point source dominated wavebands, such as if you only have F770W, for instance.
API
- class pjpipe.GetWCSAdjustStep(directory, progress_dict, target, alignment_dir, procs=1, bands=None, method='tweakreg', alignment_catalogs=None, group_dithers=None, degroup_nircam_modules=False, tweakreg_parameters=None, reproject_func='interp', overwrite=False, custom_catalog_function=None, custom_catalog_function_kwargs=None)[source]
Gets a table of WCS corrections to apply to visit groups
Experience has shown that the relative JWST guide star uncertainty is very small, but there are significant absolute corrections between guide stars. Thus, we can use the same visit as a correction for all visits, for example using F1000W at F2100W where tweakreg doesn’t work so well.
Here, we take some template bands and loop over with tweakreg, writing out a table of shifts/matrices to apply to other bands. For multiple dithers etc., will take an average correction.
Alternatively, we can take a cross-correlation approach. Here, we instead make a stacked image of the dithers for each mosaic tile, then loop over and cross-correlate to get a shift. This should work better than tweakreg for bands where there aren’t many stars present, e.g. F770W.
- Parameters:
directory – Directory of target
progress_dict – The progress dictionary the pipeline builds up. This is used to figure out what subdirectories we should be looking in
target – Target to consider
alignment_dir – Directory for alignment catalogs
bands – List of target bands to pull corrections out for
method – Method to align images together. Can be “tweakreg” (default) or cross_corr. N.B. for “cross_corr”, all dithers will be stacked by default to calculate the cross-correlation. This can also be a dictionary to distinguish between e.g. NIRCam and MIRI, like {‘nircam’: ‘tweakreg’, ‘miri’: ‘cross_corr’}
alignment_catalogs – Dictionary mapping targets to alignment catalogs
procs – Number of processes to run in parallel. Defaults to 1
group_dithers – Which band type (e.g. nircam) to group up dithers for and find a single correction. Defaults to None, which won’t group up anything
degroup_nircam_modules – Whether to degroup NIRCam A and B modules. Currently, the WCS is inconsistent between the two, so should probably be set to True if you see “ghosting” in the final mosaic. Defaults to False
tweakreg_parameters – Dictionary of parameters to pass to tweakreg. Defaults to None, which will use observatory defaults
reproject_func – Which reproject function to use. Defaults to ‘interp’, but can also be ‘exact’ or ‘adaptive’
overwrite – Whether to overwrite or not. Defaults to False
- do_step()[source]
Run the WCS adjust step
- get_visit_transforms(in_dir)[source]
Get visit transforms out of the shifted files
- Parameters:
in_dir – Directory containing files with shifts
- make_stacked_images(dithers, in_dir, out_dir, procs=1)[source]
Function to parallellise up making stacked dither images
- Parameters:
dithers – List of dithers to go
in_dir – Where to find files
out_dir – Where to save stacked images to
procs – Number of simultaneous processes to run. Defaults to 1
- parallel_make_stacked_image(dither, in_dir, out_dir)[source]
Light wrapper around parallelising the stacked image
- Parameters:
dither – Dither group to consider
in_dir – Where to find files
out_dir – Where to save stacked images to
- run_cross_corr(band_full, out_dir)[source]
Get transforms per-visit, using a cross-correlation between stacked dithers
- Parameters:
band_full – Band to consider
out_dir – Output directory to save files with shifts to
- run_tweakreg(band_full, out_dir)[source]
Run tweakreg to get shifts
- Parameters:
band_full – Band to consider
out_dir – Output directory to save files with shifts to