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
7 changes: 4 additions & 3 deletions imap_processing/lo/l1b/lo_l1b.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
SpiceFrame,
cartesian_to_latitudinal,
frame_transform,
instrument_pointing,
lo_instrument_pointing,
)
from imap_processing.spice.repoint import get_pointing_times
from imap_processing.spice.spin import get_spin_data, get_spin_number
Expand Down Expand Up @@ -1129,9 +1129,10 @@ def set_pointing_direction(l1b_de: xr.Dataset) -> xr.Dataset:
# Get the pointing bin for each DE
et = ttj2000ns_to_et(l1b_de["epoch"])
# get the direction in HAE coordinates
direction = instrument_pointing(
et, SpiceFrame.IMAP_LO_BASE, SpiceFrame.IMAP_HAE, cartesian=True
direction = lo_instrument_pointing(
et, l1b_de["pivot_angle"].values[0], SpiceFrame.IMAP_HAE, cartesian=True
)

# TODO: Need to ask Lo what to do if a latitude is outside of the
# +/-2 degree range. Is that possible?
l1b_de["hae_x"] = xr.DataArray(
Expand Down
12 changes: 7 additions & 5 deletions imap_processing/tests/lo/test_lo_l1b.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def l1a_hist():
return_value=np.array([[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]]),
)
@patch(
"imap_processing.lo.l1b.lo_l1b.instrument_pointing",
"imap_processing.lo.l1b.lo_l1b.lo_instrument_pointing",
return_value=np.zeros((2000, 3)),
)
@patch(
Expand All @@ -149,7 +149,7 @@ def l1a_hist():
)
def test_lo_l1b_de(
mock_frame_transform,
mock_instrument_pointing,
mock_lo_instrument_pointing,
mocked_get_pointing_times,
mock_spin_number,
mock_cartesian_to_latitudinal,
Expand Down Expand Up @@ -730,13 +730,15 @@ def test_set_bad_or_goodtimes(anc_dependencies):


@patch(
"imap_processing.lo.l1b.lo_l1b.instrument_pointing",
"imap_processing.lo.l1b.lo_l1b.lo_instrument_pointing",
return_value=np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]),
)
def test_set_direction(imap_ena_sim_metakernel):
def test_set_direction(mock_lo_instrument_pointing, imap_ena_sim_metakernel):
# Arrange
l1b_de = xr.Dataset(
{},
{
"pivot_angle": ("epoch", [0, 0, 0, 0]),
},
coords={
"epoch": [0, 1, 2, 3],
},
Expand Down