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
4 changes: 1 addition & 3 deletions imap_processing/mag/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

from enum import Enum

import numpy as np


class DataMode(Enum):
"""
Expand Down Expand Up @@ -127,7 +125,7 @@ class ModeFlags(Enum):
165580141,
]

MAX_FINE_TIME = np.iinfo(np.uint16).max # maximum 16 bit unsigned int
MAX_FINE_TIME = 65536 # maximum 16 bit unsigned int
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this constant is used in other places in mag_l1a_data.py. Can you confirm that for all uses, this change to the value is correct?

AXIS_COUNT = 3
RANGE_BIT_WIDTH = 2
MAX_COMPRESSED_VECTOR_BITS = 60
Expand Down
4 changes: 1 addition & 3 deletions imap_processing/mag/l1a/mag_l1a_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,7 @@ def to_j2000ns(self) -> np.int64:
j2000ns : numpy.int64
Time in nanoseconds since J2000 epoch.
"""
coarse_j2000ns = np.int64(met_to_ttj2000ns(self.coarse_time))
fine_ns = np.int64(self.fine_time / MAX_FINE_TIME * 1e9)
return coarse_j2000ns + fine_ns
return np.int64(met_to_ttj2000ns(self.to_seconds()))


@dataclass
Expand Down
2 changes: 1 addition & 1 deletion imap_processing/tests/mag/test_mag_l1a.py
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ def test_time_tuple():

test_add = example_time_tuple + (1000 / MAX_FINE_TIME)

assert test_add == TimeTuple(439067319, 83)
assert test_add == TimeTuple(439067319, 82)


def test_calculate_vector_time():
Expand Down
Loading