solpolpy.core#
Core transformation functions for solpolpy.
Functions#
|
Apply a polarization transformation to a set of input dataframes. |
|
Get the instrument specific offset angle. |
|
Determine what kind of data was input in the NDCollection. |
|
Given an input and output system type, determine the require path of transforms from the transform graph. |
|
Given a transform path, compose the equation, i.e. the composed function of transforms that executes that path. |
|
Determine if an alpha array is required for this transformation path. |
|
Define an A matrix with which to convert MZP^ (camera coords) = A x MZP (solar coords). |
|
Resolves the IMAX effect for provided input data, correcting measured polarization angles for wide FOV imagers. |
|
Evaluates the shape of the image in the input NDCollection. |
|
Adds an alpha array to an image NDCollection. |
|
Compose 2 functions together, i.e. f(g(x)). |
|
Identity function that returns the input. |
Module Contents#
- solpolpy.core.resolve(input_data: list[str] | ndcube.NDCollection, out_system: str, imax_effect: bool = False, out_angles: astropy.units.degree = None, reference_angle: astropy.units.degree = None) ndcube.NDCollection[source]#
Apply a polarization transformation to a set of input dataframes.
- Parameters:
input_data (NDCollection or List[str]) – Either: 1) a collection where each member NDCube has an expected name or 2) a list of paths to FITS files. We recommend option 2.
out_system (string) –
The polarization state you want to convert your input dataframes to. Must be one of the following strings:
”mzpsolar”: Triplet of images taken at -60°, 0°, and +60° polarizing angles with a reference angle set to solar frame.
”mzpinstru”: Triplet of images taken at -60°, 0°, and +60° polarizing angles with a reference angle set to instrument frame.
”btbr”: A Pair of images with polarization along the tangential and radial direction with respect to the Sun respectively.
”stokes”: Total brightness (“I”), polarized brightness along vertical and horizontal axes (Q) and polarized brightness along ±45° (U) .
”bpb”: Total brightness and ‘excess polarized’ brightness images pair respectively.
”bp3”: Analogous to Stokes I, Q and U, but rotates around the Sun instead of a fixed frame of reference of the instrument.
”bthp”: Total brightness, angle and degree of polarization.
”fourpol”: For observations taken at sequence of four polarizer angles, i.e. 0°, 45°, 90° and 135°.
”npol”: Set of images taken at than arbitrary polarizing angles other than MZP
imax_effect (Boolean) – The ‘IMAX effect’ describes the change in apparent measured polarization angle as an result of foreshortening effects. This effect becomes more pronounced for wide field polarized imagers - see Patel et al (2024, in preparation) If True, applies the IMAX effect for wide field imagers as part of the resolution process.
out_angles (u.degree) – Angles to use when converting to npol or some arbitrary system
reference_angle (u.degree) – Reference angle used for the polarizer offset. If None, it will try to determine it from the metadata.
- Returns:
The transformed data are returned as a NDCollection.
- Return type:
NDCollection
- solpolpy.core.determine_reference_angle(input_collection: ndcube.NDCollection) astropy.units.degree[source]#
Get the instrument specific offset angle.
- solpolpy.core.determine_input_kind(input_data: ndcube.NDCollection) solpolpy.transforms.System[source]#
Determine what kind of data was input in the NDCollection.
- Parameters:
input_data (NDCollection) – data to evaluate kind of
- Returns:
a valid input kind, see documentation of resolve for the full list under out_system
- Return type:
str
- solpolpy.core.get_transform_path(input_kind: str, output_kind: str) list[str][source]#
Given an input and output system type, determine the require path of transforms from the transform graph.
- Parameters:
input_kind (str) – starting point for transformations
output_kind (str) – ending point for transformations
- Returns:
a list of transformation identifiers used to convert from input_kind to output_kind
- Return type:
List[str]
- solpolpy.core.get_transform_equation(path: list[str]) Callable[source]#
Given a transform path, compose the equation, i.e. the composed function of transforms that executes that path.
- Parameters:
path (List[str]) – a list of transform identifiers from the path
- Returns:
a function that executes the transformation
- Return type:
Callable
- solpolpy.core.requires_alpha(func: Callable) bool[source]#
Determine if an alpha array is required for this transformation path.
- Parameters:
path (List[str]) – a path through the transform graph
- Returns:
whether alpha array is required for transformation
- Return type:
bool
- solpolpy.core.generate_imax_matrix(array_shape: int, int, cumulative_offset: astropy.units.deg, wcs: astropy.wcs.WCS) numpy.ndarray[source]#
Define an A matrix with which to convert MZP^ (camera coords) = A x MZP (solar coords).
- Parameters:
array_shape – Defined input WCS array shape for matrix generation
- Returns:
Output A matrix used in converting between camera coordinates and solar coordinates
- Return type:
ndarray
- solpolpy.core.resolve_imax_effect(input_data: ndcube.NDCollection) ndcube.NDCollection[source]#
Resolves the IMAX effect for provided input data, correcting measured polarization angles for wide FOV imagers.
- Parameters:
input_data (NDCollection) – Input data on which to correct foreshortened polarization angles
- Returns:
Output data with corrected polarization angles
- Return type:
NDCollection
- solpolpy.core._determine_image_shape(input_collection: ndcube.NDCollection) tuple[int, int][source]#
Evaluates the shape of the image in the input NDCollection.
- Parameters:
input_collection (NDCollection) – collection to determine image shape for
- Returns:
shape of image data
- Return type:
Tuple[int, int]
- solpolpy.core.add_alpha(input_data: ndcube.NDCollection) ndcube.NDCollection[source]#
Adds an alpha array to an image NDCollection.
- Parameters:
input_data (NDCollection) – dataset to append alpha to
- Returns:
dataset with alpha array appended
- Return type:
NDCollection