Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ultra: Updates to annotated events and create l1b cdf. #1081

Merged
merged 17 commits into from
Nov 22, 2024
241 changes: 162 additions & 79 deletions imap_processing/cdf/config/imap_ultra_l1b_variable_attrs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,210 +3,293 @@ default_attrs: &default
DEPEND_0: epoch
DISPLAY_TYPE: time_series
FILLVAL: -9223372036854775808
FORMAT: I19
VALIDMIN: 0
FORMAT: I12
VALIDMIN: -9223372036854775808
VALIDMAX: 9223372036854775807
VAR_TYPE: data
UNITS: " "

x_front:
default_uint8_attrs: &default_uint8
<<: *default
FILLVAL: 255
FORMAT: I3
VALIDMIN: 0
VALIDMAX: 255
dtype: uint8

default_uint16_attrs: &default_uint16
<<: *default
FILLVAL: 65535
FORMAT: I5
VALIDMIN: 0
VALIDMAX: 65535
dtype: uint16

default_uint32_attrs: &default_uint32
<<: *default
FILLVAL: 4294967295
FORMAT: I10
VALIDMIN: 0
VALIDMAX: 4294967295
dtype: uint32

default_int64_attrs: &default_int64
<<: *default
FILLVAL: -9223372036854775808
FORMAT: I20
VALIDMIN: -9223372036854775808
VALIDMAX: 9223372036854775807
dtype: int64

default_int32_attrs: &default_int32
<<: *default
FILLVAL: -2147483648
FORMAT: I10
VALIDMIN: -2147483648
VALIDMAX: 2147483647
dtype: int32

default_float32_attrs: &default_float32
<<: *default
FILLVAL: .NAN
FORMAT: F12.6
VALIDMIN: -3.4028235e+38
VALIDMAX: 3.4028235e+38
dtype: float32

x_front:
<<: *default_float32
CATDESC: x front position
FIELDNAM: Event x-position on front foil
LABLAXIS: x front position
# TODO: come back to format
UNITS: mm
UNITS: mm / 100
dtype: float32
laspsandoval marked this conversation as resolved.
Show resolved Hide resolved

y_front:
<<: *default
<<: *default_float32
CATDESC: y front position
FIELDNAM: Event y-position on front foil
LABLAXIS: y front position
# TODO: come back to format
UNITS: mm
UNITS: mm / 100
dtype: float32

x_back:
<<: *default
<<: *default_float32
CATDESC: x back position
FIELDNAM: x_back
LABLAXIS: x back position
# TODO: come back to format
UNITS: mm
UNITS: mm / 100
dtype: float32

y_back:
<<: *default
<<: *default_float32
CATDESC: y back position
FIELDNAM: y_back
LABLAXIS: y back position
# TODO: come back to format
UNITS: mm
UNITS: mm / 100
dtype: float32

x_coin:
<<: *default
<<: *default_float32
CATDESC: x coincidence position
FIELDNAM: x_coin
LABLAXIS: x coincidence position
# TODO: come back to format
UNITS: mm
UNITS: mm / 100
dtype: float32

tof_start_stop:
<<: *default
<<: *default_float32
CATDESC: Particle time of flight from start to stop
FIELDNAM: tof_start_stop
LABLAXIS: tof start stop
# TODO: come back to format
UNITS: ns
UNITS: nanosecond / 10
dtype: float32

tof_stop_coin:
<<: *default
<<: *default_float32
CATDESC: Particle time of flight from stop to coincidence
FIELDNAM: tof_stop_coin
LABLAXIS: tof stop coin
# TODO: come back to format
UNITS: ns
UNITS: nanosecond / 10
dtype: float32

tof_corrected:
<<: *default
<<: *default_float32
CATDESC: Corrected time of flight
FIELDNAM: tof_corrected
LABLAXIS: tof corrected
# TODO: come back to format
UNITS: ns
UNITS: nanosecond / 10
dtype: float32

eventtype:
<<: *default
event_type:
<<: *default_uint8
CATDESC: Eventtype (1-2 top and bottom stop types; 8-15 ssd stop types)
FIELDNAM: eventtype
LABLAXIS: eventtype
# TODO: come back to format
FIELDNAM: Event type
LABLAXIS: event type
UNITS: " "
dtype: uint8

coincidence_type:
<<: *default_uint8
CATDESC: Coincidence type for the direct event (1-2 top and bottom)
FIELDNAM: Coincidence type
LABLAXIS: coincidence type
UNITS: " "
dtype: uint8

start_type:
<<: *default_uint8
CATDESC: Start type for the direct event (1-2 left and right)
FIELDNAM: Start type
LABLAXIS: start type
UNITS: " "
dtype: uint8

vx_ultra:
<<: *default
<<: *default_float32
CATDESC: Normalized component of the velocity vector in x direction in the instrument frame.
FIELDNAM: vx_ultra
LABLAXIS: vx ultra
# TODO: come back to format
UNITS: " "
dtype: float32

vy_ultra:
<<: *default
<<: *default_float32
CATDESC: Normalized component of the velocity vector in y direction in the instrument frame.
FIELDNAM: vy_ultra
LABLAXIS: vy ultra
# TODO: come back to format
UNITS: " "
dtype: float32

vz_ultra:
<<: *default
<<: *default_float32
CATDESC: Normalized component of the velocity vector in z direction in the instrument frame.
FIELDNAM: vz_ultra
LABLAXIS: vz ultra
# TODO: come back to format
UNITS: " "
dtype: float32

energy:
<<: *default
<<: *default_float32
CATDESC: Energy measured using the pulse height from the stop anode (DN) or Energy measured using the SSD (keV) depending on eventtype.
FIELDNAM: energy
LABLAXIS: energy
# TODO: come back to format
UNITS: keV
dtype: float32

species:
<<: *default
CATDESC: Species bin.
<<: *default_uint8
CATDESC: Species bin (0-255).
FIELDNAM: species
LABLAXIS: species
# TODO: come back to format
UNITS: " "
dtype: uint8

front_back_distance:
<<: *default_float32
CATDESC: Distance front to back.
FIELDNAM: front_back_distance
LABLAXIS: front_back_distance
UNITS: mm / 100
dtype: float32

path_length:
<<: *default_float32
CATDESC: Path length.
FIELDNAM: path_length
LABLAXIS: path_length
UNITS: mm / 100
dtype: float32

event_efficiency:
<<: *default
<<: *default_float32
CATDESC: Estimated event efficiency for this path through the instrument.
FIELDNAM: event_efficiency
LABLAXIS: event efficiency
# TODO: come back to format
UNITS: " "
dtype: float32

vx_sc:
<<: *default
CATDESC: Normalized component of the velocity vector in x direction in the spacecraft frame.
<<: *default_float32
CATDESC: x-component of the velocity vector of the ena in the spacecraft frame.
FIELDNAM: vx_sc
LABLAXIS: vx sc
# TODO: come back to format
UNITS: " "
dtype: float32

vy_sc:
<<: *default
CATDESC: Normalized component of the velocity vector in y direction in the spacecraft frame.
<<: *default_float32
CATDESC: y-component of the velocity vector of the ena in the spacecraft frame.
FIELDNAM: vy_sc
LABLAXIS: vy sc
# TODO: come back to format
UNITS: " "
dtype: float32

vz_sc:
<<: *default
CATDESC: Normalized component of the velocity vector in z direction in the spacecraft frame.
<<: *default_float32
CATDESC: z-component of the velocity vector of the ena in the spacecraft frame.
FIELDNAM: vz_sc
LABLAXIS: vz sc
# TODO: come back to format
UNITS: " "
dtype: float32

vx_dps_sc:
<<: *default
CATDESC: Normalized component of the velocity vector in x direction in the DPS frame at rest WRT spacecraft (velocity w/ spacecraft frame subtracted)
<<: *default_float32
CATDESC: x-component of the velocity vector of the ena in the DPS frame at rest WRT spacecraft (velocity w/ spacecraft frame subtracted)
laspsandoval marked this conversation as resolved.
Show resolved Hide resolved
FIELDNAM: vx_dps_sc
LABLAXIS: vx dps sc
# TODO: come back to format
UNITS: " "
dtype: float32

vy_dps_sc:
<<: *default
CATDESC: Normalized component of the velocity vector in y direction in the DPS frame at rest WRT spacecraft (velocity w/ spacecraft frame subtracted)
<<: *default_float32
CATDESC: y-component of the velocity vector of the ena in the DPS frame at rest WRT spacecraft (velocity w/ spacecraft frame subtracted)
FIELDNAM: vy_dps_sc
LABLAXIS: vy dps sc
# TODO: come back to format
UNITS: " "
dtype: float32

vz_dps_sc:
<<: *default
CATDESC: Normalized component of the velocity vector in z direction in the DPS frame at rest WRT spacecraft (velocity w/ spacecraft frame subtracted)
<<: *default_float32
CATDESC: z-component of the velocity vector of the ena in the DPS frame at rest WRT spacecraft (velocity w/ spacecraft frame subtracted)
FIELDNAM: vz_dps_sc
LABLAXIS: vz dps sc
# TODO: come back to format
UNITS: " "
dtype: float32

vx_dps_helio:
<<: *default
CATDESC: Normalized component of the velocity vector in x direction in the DPS frame at rest WRT heliosphere.
<<: *default_float32
CATDESC: x-component of the velocity vector of the ena in the DPS frame at rest WRT heliosphere.
laspsandoval marked this conversation as resolved.
Show resolved Hide resolved
FIELDNAM: vx_dps_helio
LABLAXIS: vx dps helio
# TODO: come back to format
UNITS: " "
dtype: float32

vy_dps_helio:
<<: *default
CATDESC: Normalized component of the velocity vector in y direction in the DPS frame at rest WRT heliosphere.
<<: *default_float32
CATDESC: y-component of the velocity vector of the ena in the DPS frame at rest WRT heliosphere.
FIELDNAM: vy_dps_helio
LABLAXIS: vy dps helio
# TODO: come back to format
UNITS: " "
dtype: float32

vz_dps_helio:
<<: *default
CATDESC: Normalized component of the velocity vector in z direction in the DPS frame at rest WRT heliosphere.
<<: *default_float32
CATDESC: z-component of the velocity vector of the ena in the DPS frame at rest WRT heliosphere.
FIELDNAM: vz_dps_helio
LABLAXIS: vz dps helio
# TODO: come back to format
UNITS: " "

eventtimes:
<<: *default
CATDESC: Event times calculated from event and universal spin table.
FIELDNAM: eventtimes
LABLAXIS: event times
# TODO: come back to format
UNITS: " "
dtype: float32

de_event_met:
<<: *default_int64
CATDESC: Mission Elapsed Time (MET) of Direct Event
DISPLAY_TYPE: no_plot
FIELDNAM: Mission Elapsed Time
LABLAXIS: DE MET
UNITS: ns
VAR_TYPE: support_data
SCALE_TYP: linear

spin_number:
<<: *default
Expand Down
11 changes: 8 additions & 3 deletions imap_processing/tests/ultra/unit/test_ultra_l1b.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def test_create_dataset(mock_data_l1b_dict):
assert "epoch" in dataset.coords
assert dataset.coords["epoch"].dtype == "datetime64[ns]"
assert dataset.attrs["Logical_source"] == "imap_ultra_l1b_45sensor-de"
assert dataset["x_front"].attrs["UNITS"] == "mm"
assert dataset["x_front"].attrs["UNITS"] == "mm / 100"
np.testing.assert_array_equal(dataset["x_front"], np.zeros(3))


Expand All @@ -99,9 +99,14 @@ def test_ultra_l1b_rates(mock_data_l1a_rates_dict):
)


def test_ultra_l1b_de(mock_data_l1a_de_aux_dict):
@pytest.mark.external_kernel()
@pytest.mark.use_test_metakernel("imap_ena_sim_metakernel.template")
def test_ultra_l1b_de(de_dataset):
"""Tests that L1b data is created."""
output_datasets = ultra_l1b(mock_data_l1a_de_aux_dict, data_version="001")
data_dict = {}
data_dict[de_dataset.attrs["Logical_source"]] = de_dataset
data_dict["imap_ultra_l1a_45sensor-aux"] = de_dataset
output_datasets = ultra_l1b(data_dict, data_version="001")

assert len(output_datasets) == 1
assert output_datasets[0].attrs["Logical_source"] == "imap_ultra_l1b_45sensor-de"
Expand Down
Loading
Loading