Utilities#

jwpoint.utils.download_sw_file(lw_path, x, y)[source]#

Download the SW file associated with a LW file and a pointing

The LW subarray is inferred from the LW file and the directory is the same as for the LW file.

Parameters:
  • lw_path (Path | str) – Full path to the LW file

  • x (int) – X position in the LW image

  • y (int) – Y position in the LW image

Return type:

Path

Returns:

Full path to the SW file

jwpoint.utils.filter_nans(img_crop)[source]#

Fix bad pixel in a cropped image via median filter

This function uses scipy.ndimage.median_filter(), but it sets the NaNs to zero beforehand to avoid propagation.

Parameters:

img_crop (ndarray) – Cropped image of a PSF

Return type:

ndarray

Returns:

The image with bad pixels replaced by median filter

jwpoint.utils.get_sw_detector(x, y, subarray)[source]#

Get the short-wavelength detector for a given long-wavelength position

Warning

Only FULL and SUB400P subarrays are supported. Support for additional subarrays has not yet been implemented.

Parameters:
  • x (int) – X position in the long-wavelength channel

  • y (int) – Y position in the long-wavelength channel

  • subarray (str) – Subarray in the long-wavelength channel

Raises:

ValueError – Raises an error if an unsupported subarray is passed

Return type:

str

Returns:

The short-wavelength detector name in lowercase