Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ctis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
spectrograph.
"""

from . import regridding
from . import scenes

__all__ = [
"regridding",
"scenes",
]
9 changes: 9 additions & 0 deletions ctis/regridding/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"""
Resampling routines tailored to work with CTIS observations.
"""

from ._weights import weights

__all__ = [
"weights",
]
61 changes: 61 additions & 0 deletions ctis/regridding/_weights.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import numpy as np
import named_arrays as na

__all__ = [
"weights"
]


def weights(
wavelength: na.AbstractScalar,
position_input: na.AbstractCartesian2dVectorArray,
position_output: na.AbstractCartesian2dVectorArray,
axis_wavelength: str,
axis_position_input: tuple[str, str],
axis_position_output: tuple[str, str],
) -> tuple[na.AbstractScalar, dict[str, int], dict[str, int]]:
"""
A version of :func:`named_arrays.regridding.weights` tailored for use with
the spatial-spectral cubes in this package.

Parameters
----------
wavelength
position_input
position_output
axis_wavelength
axis_position_input
axis_position_output
"""

wavelength = wavelength.cell_centers(axis_wavelength)
position_input = position_input.cell_centers(axis_wavelength)
position_output = position_output.cell_centers(axis_wavelength)

Check warning on line 33 in ctis/regridding/_weights.py

View check run for this annotation

Codecov / codecov/patch

ctis/regridding/_weights.py#L31-L33

Added lines #L31 - L33 were not covered by tests

_weights_2d, shape_input, shape_output = na.regridding.weights(

Check warning on line 35 in ctis/regridding/_weights.py

View check run for this annotation

Codecov / codecov/patch

ctis/regridding/_weights.py#L35

Added line #L35 was not covered by tests
coordinates_input=position_input,
coordinates_output=position_output,
axis_input=axis_position_input,
axis_output=axis_position_output,
method="conservative",
)


def _weights_3d(
weights_2d: na.ScalarArray,
shape_inputs: dict[str, int],
shape_outputs: dict[str, int],
axis_wavelength: str,
) -> tuple[na.AbstractScalar, dict[str, int], dict[str, int]]:

pass

Check warning on line 51 in ctis/regridding/_weights.py

View check run for this annotation

Codecov / codecov/patch

ctis/regridding/_weights.py#L51

Added line #L51 was not covered by tests


def weights_3d_numpy(
weights_2d: np.ndarray,
shape_inputs: tuple[int, ...],
shape_outputs: tuple[int, ...],
axis_wavelength: int,
) -> tuple[np.ndarray, tuple[int, ...], tuple[int, ...]]:

pass

Check warning on line 61 in ctis/regridding/_weights.py

View check run for this annotation

Codecov / codecov/patch

ctis/regridding/_weights.py#L61

Added line #L61 was not covered by tests
Loading