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, either

  • A 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), or

  • A 2-tuple containing

    • A 3D numpy array with the signal estimates (see above), and

    • A 3D numpy array with the corresponding principal components.