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

Move MAG L1A to CDF attribute manager #693

Merged
merged 45 commits into from
Jul 25, 2024
Merged
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
25a99f2
Updating mag CDF generation to match new filenames
maxinelasp Mar 25, 2024
b30de9f
PR updates
maxinelasp Mar 25, 2024
fe8975d
Updating test to remove path
maxinelasp Mar 27, 2024
44439bf
removing bytearray from magl0
maxinelasp Mar 28, 2024
079d8d0
First pass at vector processing and tests
maxinelasp Mar 28, 2024
b26a4dd
Updating vectors to use proper timestamps
maxinelasp Mar 28, 2024
9fe2638
Finishing MAG L1A processing and tests
maxinelasp Apr 1, 2024
2b5e3cc
Switching return to dictionaries instead of tuples
maxinelasp Apr 1, 2024
d64c974
Adding an additional test
maxinelasp Apr 1, 2024
b2153b2
Updating from PR comments
maxinelasp Apr 2, 2024
10312c5
MAG CDF L1A generation
maxinelasp Apr 8, 2024
980b949
Merge branch 'upstream-dev' into mag_cdf
maxinelasp Apr 8, 2024
f4827bf
Updating tests
maxinelasp Apr 8, 2024
d643393
Merge branch 'upstream-dev' into mag_cdf
maxinelasp Apr 8, 2024
efa7e8c
Minor updates
maxinelasp Apr 9, 2024
ba4ad80
Updating comments
maxinelasp Apr 9, 2024
2c13eb9
Merge branch 'upstream-dev' into mag_cdf
maxinelasp Apr 16, 2024
b8e0da6
Minor updates from PR
maxinelasp Apr 16, 2024
7b379c4
Updating mag CLI
maxinelasp Apr 18, 2024
73ef339
Fixing logging
maxinelasp Apr 18, 2024
79c0500
test push
maxinelasp Apr 18, 2024
6406a62
Fixing attributes to get proper data version in filename
maxinelasp Apr 18, 2024
126cb47
fixing error
maxinelasp Apr 18, 2024
bc03904
Fixing version in cdf writer to line up with batch starter version
maxinelasp Apr 18, 2024
73f4dda
Merge branch 'mag_cli_updates' into mag_cdf
maxinelasp Apr 18, 2024
df5d9d3
Merge
maxinelasp Apr 18, 2024
fce53cf
Merge branch 'upstream-dev' into mag_cdf
maxinelasp Apr 19, 2024
b3c59a4
Adding global attrs
maxinelasp Apr 21, 2024
cde8619
added all required attributes to dataclasses
maxinelasp Apr 24, 2024
08e7ca6
Merge branch 'upstream-dev' into mag_cdf
maxinelasp Jun 25, 2024
3735563
Merge branch 'upstream-dev' into mag_cdf
maxinelasp Jun 27, 2024
84b0195
WIP: Fixing mag raw
maxinelasp Jul 2, 2024
49251d0
Finishing up MAG changes
maxinelasp Jul 8, 2024
1afee99
Merge branch 'upstream-dev' into mag_cdf
maxinelasp Jul 8, 2024
843aead
Merge conflict resolved
maxinelasp Jul 8, 2024
8de4221
Correcting pre-commit issues
maxinelasp Jul 8, 2024
8836373
Cleaning up and renaming
maxinelasp Jul 9, 2024
cc333fa
updating cli
maxinelasp Jul 9, 2024
21e64f6
Tidying up for PR
maxinelasp Jul 10, 2024
2dcb198
Doc fixes
maxinelasp Jul 10, 2024
620d803
Merge branch 'upstream-dev' into mag_cdf
maxinelasp Jul 11, 2024
bbcaaa4
fixing docs
maxinelasp Jul 11, 2024
9243731
Added test, addressing comments
maxinelasp Jul 11, 2024
d33d5bf
Merge branch 'upstream-dev' into mag_cdf
maxinelasp Jul 25, 2024
6c7ad9f
Added a constant for primary sensor, fixed typehint
maxinelasp Jul 25, 2024
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
Prev Previous commit
Added a constant for primary sensor, fixed typehint
maxinelasp committed Jul 25, 2024
commit 6c7ad9fa9a0d15b6b0400c0a9e517052bd408710
18 changes: 18 additions & 0 deletions imap_processing/mag/constants.py
Original file line number Diff line number Diff line change
@@ -37,3 +37,21 @@ class Sensor(Enum):
MAGO = "MAGO"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
MAGO = "MAGO"
MAGO = "MAGO" # MAGo sensor for outer measurements

MAGI = "MAGI"
maxinelasp marked this conversation as resolved.
Show resolved Hide resolved
RAW = "RAW"
maxinelasp marked this conversation as resolved.
Show resolved Hide resolved


class PrimarySensor(Enum):
"""
Enum for primary sensor: MAGo and MAGi (MAGO, MAGI).

This corresponds to the PRI_SENS field in the MAG Level 0 data.

Attributes
----------
MAGO : int
Primary sensor is MAGo.
MAGI : int
Primary sensor is MAGi.
"""

MAGO = 0
MAGI = 1
4 changes: 2 additions & 2 deletions imap_processing/mag/l1a/mag_l1a.py
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@

from imap_processing.cdf.imap_cdf_manager import ImapCdfAttributes
from imap_processing.cdf.utils import J2000_EPOCH, met_to_j2000ns
from imap_processing.mag.constants import DataMode
from imap_processing.mag.constants import DataMode, PrimarySensor
from imap_processing.mag.l0 import decom_mag
from imap_processing.mag.l0.mag_l0_data import MagL0
from imap_processing.mag.l1a.mag_l1a_data import (
@@ -148,7 +148,7 @@ def process_packets(
primary_start_time = TimeTuple(mag_l0.PRI_COARSETM, mag_l0.PRI_FNTM)
secondary_start_time = TimeTuple(mag_l0.SEC_COARSETM, mag_l0.SEC_FNTM)

mago_is_primary = mag_l0.PRI_SENS == 0
mago_is_primary = mag_l0.PRI_SENS == PrimarySensor.MAGO.value

primary_day = (
J2000_EPOCH
5 changes: 3 additions & 2 deletions imap_processing/mag/l1a/mag_l1a_data.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Data classes for storing and processing MAG Level 1A data."""

from __future__ import annotations

from dataclasses import InitVar, dataclass, field
from math import floor

@@ -33,7 +35,7 @@ class TimeTuple:
coarse_time: int
fine_time: int

def __add__(self, seconds: float): # type: ignore[no-untyped-def]
def __add__(self, seconds: float) -> TimeTuple:
"""
Add a number of seconds to the time tuple.

@@ -46,7 +48,6 @@ def __add__(self, seconds: float): # type: ignore[no-untyped-def]
-------
time : TimeTuple
New time tuple with the current time tuple + seconds.
Ruff is saying TimeTuple is undefined for this usage.
"""
# Add whole seconds to coarse time
coarse = self.coarse_time + floor(seconds)