liger_iris_sim.utils.resampling

Functions

rebin_image(image[, scale_in, scale_out, ...])

Rebin a 2-D image to a new shape or by a scale factor.

rebin_image_scipy(image[, scale_in, ...])

rebin_spectrum(wave, spec, wave_out[, ...])

Rebin a 1-D spectrum onto a new wavelength grid.

rebin_image(image: ndarray, scale_in: float | None = None, scale_out: float | None = None, recenter_to_odd_shape: bool = True) ndarray[source]

Rebin a 2-D image to a new shape or by a scale factor.

Parameters:
  • image (np.ndarray) – The 2-D image to rebin.

  • new_shape (tuple[int, int] | None, optional) – The target shape. Either new_shape or scales must be provided.

  • scale_in (float | None, optional) – Size of input pixels in arcsec/pixel. Either new_shape or scales must be provided.

  • scale_out (float | None, optional) – Size of output pixels in arcsec/pixel. Either new_shape or scales must be provided.

  • recenter_to_odd_shape (bool, optional) – If True, if the output shape is odd, the last index of each axis is dropped. Default is False.

Returns:

image_out (np.ndarray) – The rebinned image

rebin_image_scipy(image: ndarray, scale_in: float | None = None, scale_out: float | None = None, recenter_to_odd_shape: bool = True) ndarray[source]
rebin_spectrum(wave: ndarray, spec: ndarray, wave_out: ndarray, return_edges: bool = False) ndarray[source]

Rebin a 1-D spectrum onto a new wavelength grid.

Parameters:
  • wave (np.ndarray) – The input wavelength array.

  • spec (np.ndarray) – The input spectrum.

  • wave_out (np.ndarray) – The output wavelength array.

  • return_edges (bool, optional) – If True, also return the input and output wavelength bin edges. Default is False.

Returns:

spec_out (np.ndarray) – The rebinned spectrum.