pca#
Methods for performing PCA-based PSF subtraction.
- hsr4hci.pca.get_pca_signal_estimates(stack: ndarray, parang: ndarray, n_components: Union[int, List[int], Tuple[int], ndarray], return_components: Literal[True], roi_mask: Optional[ndarray] = None) Tuple[ndarray, ndarray][source]#
- hsr4hci.pca.get_pca_signal_estimates(stack: ndarray, parang: ndarray, n_components: Union[int, List[int], Tuple[int], ndarray], return_components: Literal[False], roi_mask: Optional[ndarray] = None) ndarray
Get the signal estimate (i.e., the derotated and combined stack that has been denoised) using PCA-based PSF subtraction for different numbers of principal components.
Note
This function essentially provides a rather minimalistic implementation of PynPointβs
pynpoint.processing.psfsubtraction.PcaPsfSubtractionModule.- Parameters:
stack β A 3D numpy array of shape (n_frames, width, height) containing the stack for which to estimate the systematic noise using PCA.
parang β A numpy array of shape (n_frames,) which contains the respective parallactic angle for each frame (necessary for derotating the stack).
n_components β An iterable of integers, containing the values for the numbers of principal components for which to run PCA.
return_components β Whether to return the principal components.
roi_mask β A 2D binary mask of shape (x_size, y_size) that can be used to select the region of interest. If a ROI mask is given, only the pixels inside the ROI will be used to find the PCA basis.
- Returns:
Depending on the value of
return_components, eitherA 3D numpy array of shape (N, width, height) (where N is the number of elements in
pca_numbers), which contains the signal estimates for different numbers of principal components (ordered from lowest to highest number of PCs), orA 2-tuple containing
A 3D numpy array with the signal estimates (see above), and
A 3D numpy array with the corresponding principal components.