match_fraction#
Methods for computing match fractions.
- hsr4hci.match_fraction.get_all_match_fractions(residuals, roi_mask, hypotheses, parang, psf_template, frame_size, n_roi_splits=1, roi_split=0)[source]#
This is essentially a convenience function which wraps the loop over the ROI and calls
get_match_fraction_for_position()for every spatial pixel.- Parameters:
residuals (Dict[str, ndarray]) โ A dictionary containing the full residuals as they are produced by
hsr4hci.training.train_all_models().hypotheses (ndarray) โ A 2D numpy array containing the hypotheses map.
parang (ndarray) โ A 1D numpy array of shape (n_frames, ) containing the parallactic angle for every frame.
psf_template (ndarray) โ A 2D numpy array containing the unsaturated PSF template.
frame_size (Tuple[int, int]) โ A tuple (x_size, y_size) containing the spatial size of the input stack in pixels.
n_roi_splits (int) โ Total number of splits for the ROI if we want to compute the match fraction map in parallel.
roi_split (int) โ Index of the ROI split that we want to process here.
roi_mask (ndarray) โ
- Returns:
A 3-tuple consisting of
mean_mfs: A 2D numpy array containing the match fraction map when using the mean to average.median_mfs: A 2D numpy array containing the match fraction map when using the median to average.affected_pixels: A 4D numpy array containing which, for each position (x, y) contains a 2D binary mask with the affected mask (seeget_match_fraction_for_position()).
- Return type:
- hsr4hci.match_fraction.get_match_fraction_for_position(position, hypothesis, residuals, parang, psf_template, signal_times, frame_size)[source]#
Compute the match fraction for a single given position.
- Parameters:
position (Tuple[int, int]) โ A tuple (x, y) specifying the position for which to compute the match fraction.
hypothesis (float) โ The hypothesis (= temporal index) for the given
position. In general, this should be an integer, but the type here has to be afloatbecause the value may also be NaN (in case there is no hypothesis).residuals (Dict[str, ndarray]) โ A dictionary containing the full residuals as they are produced by
hsr4hci.training.train_all_models().parang (ndarray) โ A 1D numpy array of shape (n_frames, ) containing the parallactic angle for every frame.
psf_template (ndarray) โ A 2D numpy array containing the unsaturated PSF template.
signal_times (ndarray) โ A 1D numpy array of shape (n_signal_times, ) containing the temporal grid.
frame_size (Tuple[int, int]) โ A tuple (x_size, y_size) containing the spatial size of the input stack in pixels.
- Returns:
A 3-tuple consisting of
match_fraction__mean: The match fraction for the given targetpositionwhen using the mean to average.match_fraction__median: The match fraction for the given targetpositionwhen using the median to average.affected_mask: A 2D numpy array containing a binary mask that indicates the pixels from which the match fraction was computed (i.e., the pixels that are affected by the planet according to thehypothesis).
- Return type: