curryer.correction.psf

Attributes

Functions

centroid(→ float)

Compute center-of-mass index for a one-dimensional weight vector.

project_psf(→ curryer.correction.grid_types.ProjectedPSF)

Project optical PSF onto Earth's surface using vectorized ray tracing.

convolve_gcp_with_psf(...)

Convolve GCP reference image with dynamic PSF using FFT.

convolve_psf_with_spacecraft_motion(...)

Apply spacecraft motion blur to projected PSF.

zero_pad_psf(→ curryer.correction.grid_types.PSFGrid)

Zero-pad PSF to center its centroid on the grid.

resample_psf_to_gcp_resolution(...)

Resample PSF to match GCP reference image resolution.

normalize_psf(→ curryer.correction.grid_types.PSFGrid)

Normalize PSF to unit total power.

resolve_spacecraft_ecef(→ tuple[numpy.ndarray, ...)

Return (r_spacecraft_m, boresight, t_matrix) for image-matching.

Module Contents

curryer.correction.psf.logger
curryer.correction.psf.centroid(weights: numpy.ndarray) float

Compute center-of-mass index for a one-dimensional weight vector.

Parameters:

weights (np.ndarray) – One-dimensional weight array.

Returns:

Center-of-mass index position.

Return type:

float

Raises:

ValueError – If weight vector has zero total mass.

curryer.correction.psf.project_psf(r_iss_ctrs_m: numpy.ndarray, optical_psfs: collections.abc.Iterable[curryer.correction.grid_types.OpticalPSFEntry], subimage: curryer.correction.grid_types.ImageGrid, los_set_hs: numpy.ndarray) curryer.correction.grid_types.ProjectedPSF

Project optical PSF onto Earth’s surface using vectorized ray tracing.

Parameters:
  • r_iss_ctrs_m (np.ndarray) – Spacecraft position in ECEF coordinates, shape (3,), units: meters.

  • optical_psfs (Iterable[OpticalPSFEntry]) – Collection of optical PSF samples at different field angles.

  • subimage (ImageGrid) – Image grid defining the observation geometry.

  • los_set_hs (np.ndarray) – Line-of-sight unit vectors in instrument frame, shape (n_pixels, 3).

Returns:

PSF projected onto Earth’s surface with lat, lon, height grids.

Return type:

ProjectedPSF

Raises:
  • ValueError – If no optical PSF entries provided.

  • RuntimeError – If ray-ellipsoid intersection fails.

curryer.correction.psf.convolve_gcp_with_psf(gcp: curryer.correction.grid_types.ImageGrid, psf: curryer.correction.grid_types.PSFGrid) curryer.correction.grid_types.ImageGrid

Convolve GCP reference image with dynamic PSF using FFT.

Parameters:
  • gcp (ImageGrid) – Ground control point reference image.

  • psf (PSFGrid) – Point spread function to convolve with.

Returns:

Convolved GCP image with same coordinate grids.

Return type:

ImageGrid

curryer.correction.psf.convolve_psf_with_spacecraft_motion(psf: curryer.correction.grid_types.ProjectedPSF, composite_img: curryer.correction.grid_types.ImageGrid, config: curryer.correction.config.PSFSamplingConfig) curryer.correction.grid_types.PSFGrid

Apply spacecraft motion blur to projected PSF.

Parameters:
  • psf (ProjectedPSF) – Projected PSF on Earth’s surface.

  • composite_img (ImageGrid) – Composite image defining spacecraft motion direction.

  • config (PSFSamplingConfig) – Configuration with PSF sampling parameters.

Returns:

PSF convolved with spacecraft motion blur.

Return type:

PSFGrid

curryer.correction.psf.zero_pad_psf(psf: curryer.correction.grid_types.PSFGrid) curryer.correction.grid_types.PSFGrid

Zero-pad PSF to center its centroid on the grid.

Parameters:

psf (PSFGrid) – Point spread function on rectilinear grid.

Returns:

Zero-padded PSF with centered centroid.

Return type:

PSFGrid

Raises:

ValueError – If PSF lat/lon are not one-dimensional.

curryer.correction.psf.resample_psf_to_gcp_resolution(psf: curryer.correction.grid_types.PSFGrid, gcp: curryer.correction.grid_types.ImageGrid) curryer.correction.grid_types.PSFGrid

Resample PSF to match GCP reference image resolution.

Parameters:
  • psf (PSFGrid) – Point spread function on rectilinear grid.

  • gcp (ImageGrid) – Ground control point reference defining target resolution.

Returns:

Resampled PSF at GCP resolution.

Return type:

PSFGrid

Raises:

ValueError – If PSF is not on a rectilinear grid.

curryer.correction.psf.normalize_psf(psf: curryer.correction.grid_types.PSFGrid) curryer.correction.grid_types.PSFGrid

Normalize PSF to unit total power.

Parameters:

psf (PSFGrid) – Point spread function to normalize.

Returns:

Normalized PSF with total power = 1.

Return type:

PSFGrid

Raises:

ValueError – If PSF has zero total power.

curryer.correction.psf.resolve_spacecraft_ecef(grid: curryer.correction.grid_types.ImageGrid, r_spacecraft_m: numpy.ndarray | None, default_altitude_m: float = 400000.0) tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray]

Return (r_spacecraft_m, boresight, t_matrix) for image-matching.

When r_spacecraft_m is provided it is used directly; the boresight is the unit nadir vector -r / |r|. When r_spacecraft_m is None the grid center lat/lon is used to build an approximate nadir position at default_altitude_m above the WGS-84 ellipsoid surface.

The rotation matrix is always the 3×3 identity — the boresight is already expressed in the CTRS frame via the nadir-approximation, so no additional rotation is needed.

Parameters:
  • grid (ImageGrid) – Observation grid, used for the center lat/lon when r_spacecraft_m is None.

  • r_spacecraft_m (ndarray of shape (3,) or None) – Spacecraft ECEF position in meters. Pass None to fall back to the nadir approximation.

  • default_altitude_m (float, optional) – Spacecraft altitude above the WGS-84 surface (meters) used when r_spacecraft_m is None. Default 400 000 m (ISS nominal orbit). Override for other spacecraft (e.g. 505 000 m for CTIM).

Returns:

  • r_spacecraft_m (ndarray, shape (3,)) – ECEF spacecraft position in meters.

  • boresight (ndarray, shape (3,)) – Nadir unit vector from spacecraft toward Earth center.

  • t_matrix (ndarray, shape (3, 3)) – Identity rotation matrix.