AnchoringStep

This step will anchor images to an external reference level, and then will internally match other bands to this externally matched band. You will need to provide convolution kernels and images.

If you want to generate a kernel that can feed directly into this step, please see this repository.

API

class pjpipe.AnchoringStep(target, bands, in_dir, ref_dir, procs, in_step_ext, out_step_ext='i2d_anchor', in_subdir=None, out_subdir=None, kernel_dir=None, ref_band=None, external_bands=None, internal_conv_band=None, reproject_func='interp', simplify_labels=True, overwrite=False, galaxy_table=None, reff_factor=2.0, percentile_range=None)[source]

Anchor aligned data to the external images

Will convolve data to a common resolution given a reference image, bin and fit for an offset between them. Can be used with external images to anchor to known fluxes, or JWST images for internal consistency.

N.B. for external files the naming scheme expects something like [target]_[resolution].fits, where resolution can be something like ‘irac1’, or if pre-convolved, then maybe ‘irac1_atgauss15’. Kernels should be named something like [resolution]_to_[resolution].fits. This is non-negotiable!

Parameters:
  • target – Target to consider

  • bands – Bands to consider

  • in_dir – Input directory

  • ref_dir – Directory for reference images

  • procs – Number of processes to run in parallel

  • in_step_ext – Filename extension for the input files

  • out_step_ext – Filename extension for output files. Defaults to “i2d_anchor”

  • in_subdir – Where files are located within the target directory (something like ‘lv3’)

  • out_subdir – Where to save intermediate files (something like ‘anchored’)

  • kernel_dir – Where kernels are located

  • ref_band – If internally anchoring, these are the bands to lock to

  • external_bands – If externally anchoring, these are a list (in preference order) of resolutions to lock to (e.g. irac1, irac1_atgauss4p5)

  • internal_conv_band – For internal anchoring, we use this common resolution.

  • reproject_func – Which reproject function to use. Defaults to ‘interp’, but can also be ‘exact’ or ‘adaptive’

  • simplify_labels – If True, will strip any convolution info (_atgaussX) from the labels

  • overwrite – Whether to overwrite or not

  • galaxy_table – Path to galaxy properties table (CSV) for dynamic intensity range calculation. If None, uses hard-coded intensity ranges (original behavior). Defaults to None. CSV must have columns: name, ra, dec, posang, inclination, distance_mpc, size_reff

  • reff_factor – Factor to multiply effective radius by for intensity range calculation. Defaults to 2.0

  • percentile_range – [min, max] percentiles to calculate intensity range. Defaults to [15, 60] if None is provided. Only used if galaxy_table is provided.

do_step()[source]

Run anchoring step

parallel_anchoring(file, external=True, internal_reference=None)[source]

Parallelize applying anchoring to external images

Does relevant convolutions and fits for the anchoring offsets

Parameters:
  • file – File and (potentially) reference to apply anchoring

  • external – anchoring to external (True) or internal (False) images

  • internal_reference – path to the internal reference image (None if external = True)

run_step(files)[source]

Wrap paralellism around applying anchoring to external images

This will loop over NIRCam/MIRI files (excluding backgrounds) and perform anchoring as set up by the user. Will put out a table of fit values and the anchored images at the end

Parameters:

files – List of files to process