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
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
Comment thread
alastairtree marked this conversation as resolved.
AXIS_COUNT = 3
RANGE_BIT_WIDTH = 2
MAX_COMPRESSED_VECTOR_BITS = 60
Expand Down
6 changes: 2 additions & 4 deletions imap_processing/mag/l1a/mag_l1a_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def __add__(self, seconds: float) -> TimeTuple:
"""
# Add whole seconds to coarse time
coarse = self.coarse_time + floor(seconds)
# fine time is 1/65535th of a second
# fine time is 1/65536th of a second
fine = self.fine_time + round((seconds % 1) * MAX_FINE_TIME)

# If fine is larger than the max, move the excess into coarse time.
Expand Down 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
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
t,coarse,fine,sequence,x,y,z,range,compression,compression_width
2025-02-04T16:38:24.981979,476383107,64354,15,0.95542504596,-0.94791461247,-0.884626055955,2,1,18
2025-02-04T16:38:25.481979,476383107,64354,15,1.00249031916,-1.30810804533,-0.85028532705,2,1,18
2025-02-04T16:38:25.981979,476383107,64354,15,1.0354360104,-1.50668675937,-0.816826842585,2,1,18
2025-02-04T16:38:26.481979,476383107,64354,15,0.2692989473625,-0.4248742005525,-0.267548787525,3,1,18
2025-02-04T16:38:26.981979,476383107,64354,15,0.1707469921575,-0.4799672700675,-0.3170672152575,3,1,18
2025-02-04T16:38:27.481979,476383107,64354,15,0.11459529675,-0.54869001219,-0.294384937875,3,1,18
2025-02-04T16:38:27.981979,476383107,64354,15,0.1913741455725,-0.5612622219825,-0.31102190421,3,1,18
2025-02-04T16:38:28.481979,476383107,64354,15,0.1592874624825,-0.5194412483925,-0.2977832317575,3,1,18
2025-02-04T16:38:28.981979,476383107,64354,15,35.837166093435,-104.129102911005,-52.11528225921,0,1,18
2025-02-04T16:38:29.481979,476383107,64354,15,-5.68843906245,8.402260826025,13.968622541925,0,1,18
2025-02-04T16:38:29.981979,476383107,64354,15,7.96381468743,-17.358231791085,12.447504304605,0,1,18
2025-02-04T16:38:30.481979,476383107,64354,15,16.496473281105,-22.96778973681,-11.066117873445,0,1,18
2025-02-04T16:38:30.981979,476383107,64354,15,-4.55075124996,-33.56267110866,4.09207388463,0,1,18
2025-02-04T16:38:31.481979,476383107,64354,15,0.165955554,-1.517995728,0.478387692,1,1,18
2025-02-04T16:38:31.981979,476383107,64354,15,0.977293818,-2.133706896,0.609742854,1,1,18
2025-02-04T16:38:32.481979,476383107,64354,15,0.663822216,-2.187369792,0.247695228,1,1,18
2025-02-04T16:38:24.981964,476383107,64354,15,0.95542504596,-0.94791461247,-0.884626055955,2,1,18
2025-02-04T16:38:25.481964,476383107,64354,15,1.00249031916,-1.30810804533,-0.85028532705,2,1,18
2025-02-04T16:38:25.981964,476383107,64354,15,1.0354360104,-1.50668675937,-0.816826842585,2,1,18
2025-02-04T16:38:26.481964,476383107,64354,15,0.2692989473625,-0.4248742005525,-0.267548787525,3,1,18
2025-02-04T16:38:26.981964,476383107,64354,15,0.1707469921575,-0.4799672700675,-0.3170672152575,3,1,18
2025-02-04T16:38:27.481964,476383107,64354,15,0.11459529675,-0.54869001219,-0.294384937875,3,1,18
2025-02-04T16:38:27.981964,476383107,64354,15,0.1913741455725,-0.5612622219825,-0.31102190421,3,1,18
2025-02-04T16:38:28.481964,476383107,64354,15,0.1592874624825,-0.5194412483925,-0.2977832317575,3,1,18
2025-02-04T16:38:28.981964,476383107,64354,15,35.837166093435,-104.129102911005,-52.11528225921,0,1,18
2025-02-04T16:38:29.481964,476383107,64354,15,-5.68843906245,8.402260826025,13.968622541925,0,1,18
2025-02-04T16:38:29.981964,476383107,64354,15,7.96381468743,-17.358231791085,12.447504304605,0,1,18
2025-02-04T16:38:30.481964,476383107,64354,15,16.496473281105,-22.96778973681,-11.066117873445,0,1,18
2025-02-04T16:38:30.981964,476383107,64354,15,-4.55075124996,-33.56267110866,4.09207388463,0,1,18
2025-02-04T16:38:31.481964,476383107,64354,15,0.165955554,-1.517995728,0.478387692,1,1,18
2025-02-04T16:38:31.981964,476383107,64354,15,0.977293818,-2.133706896,0.609742854,1,1,18
2025-02-04T16:38:32.481964,476383107,64354,15,0.663822216,-2.187369792,0.247695228,1,1,18
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
t,coarse,fine,sequence,x,y,z,range,compression,compression_width
2025-02-04T16:38:24.981948,476383107,64352,15,0.1804626032025,-0.562105854075,-0.3036826507575,3,1,18
2025-02-04T16:38:25.481948,476383107,64352,15,0.17011761321,-0.53281880385,-0.30834684861,3,1,18
2025-02-04T16:38:25.981948,476383107,64352,15,0.112645446585,-0.35145717345,-0.189801018135,3,1,18
2025-02-04T16:38:26.481948,476383107,64352,15,-2.29722020166,2.23454254428,9.55399882842,0,1,18
2025-02-04T16:38:26.981948,476383107,64352,15,4.020135352905,-8.94601423008,17.46477430263,0,1,18
2025-02-04T16:38:27.481948,476383107,64352,15,16.08054141162,-21.79637698257,-8.928932800755,0,1,18
2025-02-04T16:38:27.981948,476383107,64352,15,1.722915151245,-29.65126678371,-1.008913007595,0,1,18
2025-02-04T16:38:28.481948,476383107,64352,15,-3.44583030249,-43.64679077442,12.54925750059,0,1,18
2025-02-04T16:38:28.981948,476383107,64352,15,0.904295196,-1.88049375,0.585438228,1,1,18
2025-02-04T16:38:29.481948,476383107,64352,15,0.664380144,-2.333212128,0.388430856,1,1,18
2025-02-04T16:38:29.981948,476383107,64352,15,1.254940272,-1.8618804,-0.211248648,1,1,18
2025-02-04T16:38:30.481948,476383107,64352,15,2.12232546,-2.43962217,-1.060461756,1,1,18
2025-02-04T16:38:30.981948,476383107,64352,15,2.989710648,-3.849712596,-1.99688544,1,1,18
2025-02-04T16:38:31.481948,476383107,64352,15,0.87643137132,-0.95042434446,-0.769179598785,2,1,18
2025-02-04T16:38:31.981948,476383107,64352,15,0.94711132062,-0.894849188085,-0.903518102745,2,1,18
2025-02-04T16:38:32.481948,476383107,64352,15,0.99894328344,-1.185887030445,-0.879318758475,2,1,18
2025-02-04T16:38:24.981934,476383107,64352,15,0.1804626032025,-0.562105854075,-0.3036826507575,3,1,18
2025-02-04T16:38:25.481934,476383107,64352,15,0.17011761321,-0.53281880385,-0.30834684861,3,1,18
2025-02-04T16:38:25.981934,476383107,64352,15,0.112645446585,-0.35145717345,-0.189801018135,3,1,18
2025-02-04T16:38:26.481934,476383107,64352,15,-2.29722020166,2.23454254428,9.55399882842,0,1,18
2025-02-04T16:38:26.981934,476383107,64352,15,4.020135352905,-8.94601423008,17.46477430263,0,1,18
2025-02-04T16:38:27.481934,476383107,64352,15,16.08054141162,-21.79637698257,-8.928932800755,0,1,18
2025-02-04T16:38:27.981934,476383107,64352,15,1.722915151245,-29.65126678371,-1.008913007595,0,1,18
2025-02-04T16:38:28.481934,476383107,64352,15,-3.44583030249,-43.64679077442,12.54925750059,0,1,18
2025-02-04T16:38:28.981934,476383107,64352,15,0.904295196,-1.88049375,0.585438228,1,1,18
2025-02-04T16:38:29.481934,476383107,64352,15,0.664380144,-2.333212128,0.388430856,1,1,18
2025-02-04T16:38:29.981934,476383107,64352,15,1.254940272,-1.8618804,-0.211248648,1,1,18
2025-02-04T16:38:30.481934,476383107,64352,15,2.12232546,-2.43962217,-1.060461756,1,1,18
2025-02-04T16:38:30.981934,476383107,64352,15,2.989710648,-3.849712596,-1.99688544,1,1,18
2025-02-04T16:38:31.481934,476383107,64352,15,0.87643137132,-0.95042434446,-0.769179598785,2,1,18
2025-02-04T16:38:31.981934,476383107,64352,15,0.94711132062,-0.894849188085,-0.903518102745,2,1,18
2025-02-04T16:38:32.481934,476383107,64352,15,0.99894328344,-1.185887030445,-0.879318758475,2,1,18
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
t,coarse,fine,sequence,x,y,z,range,compression,compression_width
2025-02-06T11:58:58.985885,476539141,64610,4,0.11001148488,-0.55093754904,-0.29438610888,3,1,16
2025-02-06T11:58:59.485885,476539141,64610,4,0.18793628667,-0.56464063143,-0.31214068737,3,1,16
2025-02-06T11:58:59.985885,476539141,64610,4,0.16043341545,-0.52395763461,-0.29888557215,3,1,16
2025-02-06T11:59:00.485885,476539141,64610,4,36.40600999968,-111.96316228692,-57.68292247884,0,1,16
2025-02-06T11:59:00.985885,476539141,64610,4,-6.82612687494,6.72567301044,13.41408036078,0,1,16
2025-02-06T11:59:01.485885,476539141,64610,4,6.82612687494,-17.91580627974,11.32618443732,0,1,16
2025-02-06T11:59:01.985885,476539141,64610,4,15.92762937486,-24.6453436398,-11.0585445813,0,1,16
2025-02-06T11:59:02.485885,476539141,64610,4,-4.55075124996,-33.56267110866,2.40920730198,0,1,16
2025-02-06T11:59:02.985885,476539141,64610,4,0.073758024,-1.517836608,0.442036152,1,1,16
2025-02-06T11:59:03.485885,476539141,64610,4,0.958854312,-2.097539136,0.591434568,1,1,16
2025-02-06T11:59:03.985885,476539141,64610,4,0.663822216,-2.241573696,0.229889232,1,1,16
2025-02-06T11:59:04.485885,476539141,64610,4,1.47516048,-1.881614592,-0.493822728,1,1,16
2025-02-06T11:59:04.985885,476539141,64610,4,2.360256768,-2.894948352,-1.28264616,1,1,16
2025-02-06T11:59:05.485885,476539141,64610,4,0.77187048048,-1.01689256196,-0.5843507652,2,1,16
2025-02-06T11:59:05.985885,476539141,64610,4,0.90365324544,-0.92475187668,-0.8432787366,2,1,16
2025-02-06T11:59:06.485885,476539141,64610,4,0.941305464,-0.94327639578,-0.89854130394,2,1,16
2025-02-06T11:58:58.985870,476539141,64610,4,0.11001148488,-0.55093754904,-0.29438610888,3,1,16
2025-02-06T11:58:59.485870,476539141,64610,4,0.18793628667,-0.56464063143,-0.31214068737,3,1,16
2025-02-06T11:58:59.985870,476539141,64610,4,0.16043341545,-0.52395763461,-0.29888557215,3,1,16
2025-02-06T11:59:00.485870,476539141,64610,4,36.40600999968,-111.96316228692,-57.68292247884,0,1,16
2025-02-06T11:59:00.985870,476539141,64610,4,-6.82612687494,6.72567301044,13.41408036078,0,1,16
2025-02-06T11:59:01.485870,476539141,64610,4,6.82612687494,-17.91580627974,11.32618443732,0,1,16
2025-02-06T11:59:01.985870,476539141,64610,4,15.92762937486,-24.6453436398,-11.0585445813,0,1,16
2025-02-06T11:59:02.485870,476539141,64610,4,-4.55075124996,-33.56267110866,2.40920730198,0,1,16
2025-02-06T11:59:02.985870,476539141,64610,4,0.073758024,-1.517836608,0.442036152,1,1,16
2025-02-06T11:59:03.485870,476539141,64610,4,0.958854312,-2.097539136,0.591434568,1,1,16
2025-02-06T11:59:03.985870,476539141,64610,4,0.663822216,-2.241573696,0.229889232,1,1,16
2025-02-06T11:59:04.485870,476539141,64610,4,1.47516048,-1.881614592,-0.493822728,1,1,16
2025-02-06T11:59:04.985870,476539141,64610,4,2.360256768,-2.894948352,-1.28264616,1,1,16
2025-02-06T11:59:05.485870,476539141,64610,4,0.77187048048,-1.01689256196,-0.5843507652,2,1,16
2025-02-06T11:59:05.985870,476539141,64610,4,0.90365324544,-0.92475187668,-0.8432787366,2,1,16
2025-02-06T11:59:06.485870,476539141,64610,4,0.941305464,-0.94327639578,-0.89854130394,2,1,16
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
t,coarse,fine,sequence,x,y,z,range,compression,compression_width
2025-02-06T11:58:58.985854,476539141,64608,4,0.11494433325,-0.5497820457,-0.29476252923,3,1,16
2025-02-06T11:58:59.485854,476539141,64608,4,0.18850870653,-0.5632239147,-0.31269143571,3,1,16
2025-02-06T11:58:59.985854,476539141,64608,4,0.15632429322,-0.5181847068,-0.29941001478,3,1,16
2025-02-06T11:59:00.485854,476539141,64608,4,34.4583030249,-105.13505944548,-53.60805445602,0,1,16
2025-02-06T11:59:00.985854,476539141,64608,4,-6.89166060498,6.70362763284,13.47787096794,0,1,16
2025-02-06T11:59:01.485854,476539141,64608,4,6.89166060498,-17.89377158304,11.3110517382,0,1,16
2025-02-06T11:59:01.985854,476539141,64608,4,16.08054141162,-24.59391297012,-11.16732741162,0,1,16
2025-02-06T11:59:02.485854,476539141,64608,4,-4.59444040332,-33.57740434212,2.38778141658,0,1,16
2025-02-06T11:59:02.985854,476539141,64608,4,0.147640032,-1.519722576,0.44010432,1,1,16
2025-02-06T11:59:03.485854,476539141,64608,4,0.959660208,-2.169924408,0.58651272,1,1,16
2025-02-06T11:59:03.985854,476539141,64608,4,0.664380144,-2.242739448,0.2252124,1,1,16
2025-02-06T11:59:04.485854,476539141,64608,4,1.47640032,-1.879647264,-0.500962176,1,1,16
2025-02-06T11:59:04.985854,476539141,64608,4,2.362240512,-2.964008736,-1.293918624,1,1,16
2025-02-06T11:59:05.485854,476539141,64608,4,0.79161543216,-1.01526610338,-0.60705657342,2,1,16
2025-02-06T11:59:05.985854,476539141,64608,4,0.92355133752,-0.92261638386,-0.84791876094,2,1,16
2025-02-06T11:59:06.485854,476539141,64608,4,0.942399324,-0.9595523466,-0.90325176174,2,1,16
2025-02-06T11:58:58.985840,476539141,64608,4,0.11494433325,-0.5497820457,-0.29476252923,3,1,16
2025-02-06T11:58:59.485840,476539141,64608,4,0.18850870653,-0.5632239147,-0.31269143571,3,1,16
2025-02-06T11:58:59.985840,476539141,64608,4,0.15632429322,-0.5181847068,-0.29941001478,3,1,16
2025-02-06T11:59:00.485840,476539141,64608,4,34.4583030249,-105.13505944548,-53.60805445602,0,1,16
2025-02-06T11:59:00.985840,476539141,64608,4,-6.89166060498,6.70362763284,13.47787096794,0,1,16
2025-02-06T11:59:01.485840,476539141,64608,4,6.89166060498,-17.89377158304,11.3110517382,0,1,16
2025-02-06T11:59:01.985840,476539141,64608,4,16.08054141162,-24.59391297012,-11.16732741162,0,1,16
2025-02-06T11:59:02.485840,476539141,64608,4,-4.59444040332,-33.57740434212,2.38778141658,0,1,16
2025-02-06T11:59:02.985840,476539141,64608,4,0.147640032,-1.519722576,0.44010432,1,1,16
2025-02-06T11:59:03.485840,476539141,64608,4,0.959660208,-2.169924408,0.58651272,1,1,16
2025-02-06T11:59:03.985840,476539141,64608,4,0.664380144,-2.242739448,0.2252124,1,1,16
2025-02-06T11:59:04.485840,476539141,64608,4,1.47640032,-1.879647264,-0.500962176,1,1,16
2025-02-06T11:59:04.985840,476539141,64608,4,2.362240512,-2.964008736,-1.293918624,1,1,16
2025-02-06T11:59:05.485840,476539141,64608,4,0.79161543216,-1.01526610338,-0.60705657342,2,1,16
2025-02-06T11:59:05.985840,476539141,64608,4,0.92355133752,-0.92261638386,-0.84791876094,2,1,16
2025-02-06T11:59:06.485840,476539141,64608,4,0.942399324,-0.9595523466,-0.90325176174,2,1,16
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
t,coarse,fine,sequence,x,y,z,range,compression,compression_width
2025-02-04T16:06:55.982024,476381218,64357,14,4.55075124996,-11.19786196854,15.77425592322,0,0,16
2025-02-04T16:06:56.482024,476381218,64357,14,15.92762937486,-22.40731698594,-11.07018889848,0,0,16
2025-02-04T16:06:56.982024,476381218,64357,14,0,-31.33237315404,0.16302044052,0,0,16
2025-02-04T16:06:57.482024,476381218,64357,14,-2.27537562498,-44.75666872758,11.44735711164,0,0,16
2025-02-04T16:06:57.982024,476381218,64357,14,0.885096288,-1.952868096,0.590544504,1,0,16
2025-02-04T16:06:58.482024,476381218,64357,14,0.663822216,-2.313845568,0.302605344,1,0,16
2025-02-04T16:06:58.982024,476381218,64357,14,1.253886408,-1.881232704,-0.277225488,1,0,16
2025-02-04T16:06:59.482024,476381218,64357,14,2.138982696,-2.605478976,-1.139884128,1,0,16
2025-02-04T16:06:59.982024,476381218,64357,14,3.024078984,-3.907900224,-2.071901592,1,0,16
2025-02-04T16:07:00.482024,476381218,64357,14,0.88482713616,-0.9431913528,-0.78778074834,2,0,16
2025-02-04T16:07:00.982024,476381218,64357,14,0.941305464,-0.90634074822,-0.89873597394,2,0,16
2025-02-04T16:07:01.482024,476381218,64357,14,0.99778379184,-1.22037879546,-0.87847855812,2,0,16
2025-02-04T16:07:01.982024,476381218,64357,14,1.01660990112,-1.47895667604,-0.80315324496,2,0,16
2025-02-04T16:07:02.482024,476381218,64357,14,1.11074044752,-1.68224447592,-1.02364442208,2,0,16
2025-02-04T16:07:02.982024,476381218,64357,14,0.19710391041,-0.46535117637,-0.31706811786,3,0,16
2025-02-04T16:07:03.482024,476381218,64357,14,0.10542767301,-0.53738602233,-0.29896071126,3,0,16
2025-02-04T16:06:55.982010,476381218,64357,14,4.55075124996,-11.19786196854,15.77425592322,0,0,16
2025-02-04T16:06:56.482010,476381218,64357,14,15.92762937486,-22.40731698594,-11.07018889848,0,0,16
2025-02-04T16:06:56.982010,476381218,64357,14,0,-31.33237315404,0.16302044052,0,0,16
2025-02-04T16:06:57.482010,476381218,64357,14,-2.27537562498,-44.75666872758,11.44735711164,0,0,16
2025-02-04T16:06:57.982010,476381218,64357,14,0.885096288,-1.952868096,0.590544504,1,0,16
2025-02-04T16:06:58.482010,476381218,64357,14,0.663822216,-2.313845568,0.302605344,1,0,16
2025-02-04T16:06:58.982010,476381218,64357,14,1.253886408,-1.881232704,-0.277225488,1,0,16
2025-02-04T16:06:59.482010,476381218,64357,14,2.138982696,-2.605478976,-1.139884128,1,0,16
2025-02-04T16:06:59.982010,476381218,64357,14,3.024078984,-3.907900224,-2.071901592,1,0,16
2025-02-04T16:07:00.482010,476381218,64357,14,0.88482713616,-0.9431913528,-0.78778074834,2,0,16
2025-02-04T16:07:00.982010,476381218,64357,14,0.941305464,-0.90634074822,-0.89873597394,2,0,16
2025-02-04T16:07:01.482010,476381218,64357,14,0.99778379184,-1.22037879546,-0.87847855812,2,0,16
2025-02-04T16:07:01.982010,476381218,64357,14,1.01660990112,-1.47895667604,-0.80315324496,2,0,16
2025-02-04T16:07:02.482010,476381218,64357,14,1.11074044752,-1.68224447592,-1.02364442208,2,0,16
2025-02-04T16:07:02.982010,476381218,64357,14,0.19710391041,-0.46535117637,-0.31706811786,3,0,16
2025-02-04T16:07:03.482010,476381218,64357,14,0.10542767301,-0.53738602233,-0.29896071126,3,0,16
Loading
Loading