Skip to content
Merged
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
10 changes: 0 additions & 10 deletions imap_processing/spice/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
import spiceypy
from numpy.typing import NDArray

from imap_processing.mag import constants

logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -319,14 +317,6 @@ def frame_transform(
# Multiple et/positions : (n, 3, 3),(n, 3, 1) -> (n, 3, 1)
result = np.squeeze(rotate @ position[..., np.newaxis])

# For every FILLVAL in the input position, ensure the output is also NaN or FILLVAL
if np.isnan(position).any() or (position == constants.FILLVAL).any():
result = np.where(
np.isnan(position) | (position == constants.FILLVAL),
constants.FILLVAL,
result,
)

return result


Expand Down
20 changes: 0 additions & 20 deletions imap_processing/tests/spice/test_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import pytest
import spiceypy

from imap_processing.mag import constants
from imap_processing.spice.geometry import (
SpiceBody,
SpiceFrame,
Expand Down Expand Up @@ -160,19 +159,6 @@ def test_get_spacecraft_to_instrument_spin_phase_offset(
SpiceFrame.IMAP_SPACECRAFT,
SpiceFrame.IMAP_DPS,
),
# single et, single NaN/FILL_VAL vector
(
["2025-04-30T12:00:00.000"],
np.array(
[
[0, 0, 0],
[constants.FILLVAL, constants.FILLVAL, constants.FILLVAL],
[np.nan, np.nan, np.nan],
]
),
SpiceFrame.IMAP_SPACECRAFT,
SpiceFrame.IMAP_DPS,
),
],
)
def test_frame_transform(et_strings, position, from_frame, to_frame, furnish_kernels):
Expand Down Expand Up @@ -217,12 +203,6 @@ def test_frame_transform(et_strings, position, from_frame, to_frame, furnish_ker
spice_result = spiceypy.mxv(rotation_matrix, spice_position)
np.testing.assert_allclose(test_result, spice_result, atol=1e-12)

# Ensure that NaN/FILL_VAL inputs are preserved exactly as FILL_VAL outputs
# and not just really close to but not quite FILL_VAL
for input_vec, output_vec in zip(position, result, strict=False):
if np.isnan(input_vec).all() or (input_vec == constants.FILLVAL).all():
assert (output_vec == constants.FILLVAL).all()


@pytest.mark.parametrize(
"spice_frame",
Expand Down
Loading