solpolpy.util#

Functions#

combine_all_collection_masks(→ numpy.ndarray | None)

Combine all the masks in a given collection.

combine_masks(→ numpy.ndarray | None)

Combine masks.

calculate_pc_matrix() → numpy.ndarray)

Calculate a PC matrix given CROTA and CDELT.

convert_cd_matrix_to_pc_matrix(wcs)

extract_crota_from_wcs(→ astropy.units.deg)

Extract CROTA from a WCS.

indexed_offset(index, distortion, image_shape)

calculate_distortion(distortion, image_shape)

apply_distortion_shift(input_image, wcs)

make_empty_distortion_model(num_bins, image, ...)

Create an empty distortion table

Module Contents#

solpolpy.util.combine_all_collection_masks(collection: ndcube.NDCollection) numpy.ndarray | None#

Combine all the masks in a given collection.

solpolpy.util.combine_masks(*args) numpy.ndarray | None#

Combine masks.

If any of the masks are None, the result is None. Otherwise, when combining any value that is masked in any of the input args, gets masked, i.e. it does a logical or.

solpolpy.util.calculate_pc_matrix(crota: float, cdelt: float, float) numpy.ndarray#

Calculate a PC matrix given CROTA and CDELT.

Parameters:
  • crota (float) – rotation angle from the WCS

  • cdelt (float) – pixel size from the WCS

Returns:

PC matrix

Return type:

np.ndarray

solpolpy.util.convert_cd_matrix_to_pc_matrix(wcs)#
solpolpy.util.extract_crota_from_wcs(wcs: astropy.wcs.WCS) astropy.units.deg#

Extract CROTA from a WCS.

solpolpy.util.indexed_offset(index, distortion, image_shape)#
solpolpy.util.calculate_distortion(distortion, image_shape)#
solpolpy.util.apply_distortion_shift(input_image, wcs: astropy.wcs.WCS)#
solpolpy.util.make_empty_distortion_model(num_bins: int, image: numpy.ndarray)#

Create an empty distortion table

Parameters:
  • num_bins (int) – number of histogram bins in the distortion model, i.e. the size of the distortion model is (num_bins, num_bins)

  • image (np.ndarray) – image to create a distortion model for

Returns:

x and y distortion models

Return type:

(DistortionLookupTable, DistortionLookupTable)