regularizepsf.builder#

Functions for building PSF models from images.

Classes#

ArrayPSFBuilder

A builder that will take a series of images and construct an ArrayPSF to represent their implicit PSF.

Functions#

_convert_to_generator(→ collections.abc.Generator)

_find_matches(coordinate, x_bounds, y_bounds, psf_size)

_average_patches_by_mean(patches, corners, x_bounds, ...)

_average_patches_by_percentile(patches, corners, ...)

_average_patches(patches, corners[, method, percentile])

Module Contents#

regularizepsf.builder._convert_to_generator(images: list[pathlib.Path] | numpy.ndarray | collections.abc.Generator, hdu_choice: int | None = None) collections.abc.Generator[source]#
regularizepsf.builder._find_matches(coordinate, x_bounds, y_bounds, psf_size)[source]#
regularizepsf.builder._average_patches_by_mean(patches, corners, x_bounds, y_bounds, psf_size)[source]#
regularizepsf.builder._average_patches_by_percentile(patches, corners, x_bounds, y_bounds, psf_size, percentile: float = 50)[source]#
regularizepsf.builder._average_patches(patches, corners, method='mean', percentile: float = None)[source]#
class regularizepsf.builder.ArrayPSFBuilder(psf_size: int)[source]#

A builder that will take a series of images and construct an ArrayPSF to represent their implicit PSF.

Initialize an ArrayPSFBuilder.

_psf_size#
property psf_size#
build(images: list[str] | list[pathlib.Path] | numpy.ndarray | collections.abc.Generator, sep_mask: list[str] | list[pathlib.Path] | numpy.ndarray | collections.abc.Generator | None = None, hdu_choice: int | None = 0, num_workers: int | None = None, interpolation_scale: int = 1, star_threshold: int = 3, average_method: str = 'median', percentile: float = 50, saturation_threshold: float = np.inf, image_mask: numpy.ndarray | None = None, star_minimum: float = 0, star_maximum: float = np.inf, sqrt_compressed: bool = False, return_patches: bool = False) tuple[regularizepsf.psf.ArrayPSF, dict] | tuple[regularizepsf.psf.ArrayPSF, dict, dict][source]#

Build the PSF model.

Parameters:
  • images (list[str] | list[pathlib.Path] | np.ndarray | Generator) – Input images to use for PSF characterization

  • sep_mask (list[str] | list[pathlib.Path] | np.ndarray | Generator | None) – Mask to use with source extraction (sep)

  • hdu_choice (int | None) – HDU index to use when loading FITS input files

  • num_workers (int | None) – Number of worker processes for multithreaded image processing, with None using all available CPUs

  • interpolation_scale (int) – Interpolation scale to apply to input images after loading

  • star_threshold (int) – Minimum threshold value for star detection using sep

  • average_method (str) – Method for patch averaging (mean, percentile, or median)

  • percentile (float) – Percentile value when specifying the percentile patch averaging method

  • saturation_threshold (float) – Pixel value above which stars are considered saturated

  • image_mask (np.ndarray | None) – Mask of pixels to ignore for PSF characterization in input images

  • star_minimum (float) – Minimum threshold of center star for patch inclusion, in units of input data

  • star_maximum (float) – Maximum threshold of center star for patch inclusion, in units of input data

  • sqrt_compressed (bool) – Toggle to indicate if input data has been square-root compressed, and requires decompression

  • return_patches (bool) – Toggle to return computed patches alongside model output

Returns:

Array PSF and the counts of stars in each component

Return type:

(ArrayPSF, dict)