solpolpy.util#
Functions#
|
Combine all the masks in a given collection. |
|
Combine masks. |
|
Calculate a PC matrix given CROTA and CDELT. |
|
Extract CROTA from a WCS. |
|
|
|
|
|
Calculate shift in pixels due to optical distortion |
|
Apply shift in pixels due to optical distortion |
|
Create an empty distortion table |
|
Convert an NDCollection to a list of SunPy Map objects. |
Module Contents#
- solpolpy.util.combine_all_collection_masks(collection: ndcube.NDCollection) numpy.ndarray | None[source]#
Combine all the masks in a given collection.
- solpolpy.util.combine_masks(*args) numpy.ndarray | None[source]#
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[source]#
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.extract_crota_from_wcs(wcs: astropy.wcs.WCS) astropy.units.deg[source]#
Extract CROTA from a WCS.
- solpolpy.util.compute_distortion_shift(image_shape, wcs: astropy.wcs.WCS)[source]#
Calculate shift in pixels due to optical distortion
- Parameters:
image_shape (Tuple(int, int)) – shape of input image
wcs (WCS) – WCS from input object
- Returns:
Tuple containing new x-coordinates, new y-coordinates, valid mask, original i-coordinates, and original j-coordinates.
- Return type:
tuple (np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray)
- solpolpy.util.apply_distortion_shift(input_image, new_x, new_y, valid_mask, i_coords, j_coords)[source]#
Apply shift in pixels due to optical distortion
- Parameters:
input_image (np.ndarray) – input image on which shift to be applied
new_x (np.ndarray) – The precomputed new x-coordinates after distortion.
new_y (np.ndarray) – The precomputed new y-coordinates after distortion.
valid_mask (np.ndarray) – Boolean mask indicating valid shifts within bounds.
i_coords (np.ndarray) – Original i-coordinates of pixels frpm input_image.
j_coords (np.ndarray) – Original j-coordinates of pixels from input_image.
- Returns:
Image after applying the distortion shifts.
- Return type:
np.ndarray
- solpolpy.util.make_empty_distortion_model(num_bins: int, image: numpy.ndarray)[source]#
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)