Skip to content

Commit

Permalink
Xtce generator updates (IMAP-Science-Operations-Center#155)
Browse files Browse the repository at this point in the history
- updated xtce generator code to handle different data types. made code more generic.
- fixed XTCE header schema
- added template that all instrument can use
- moved past xml file into their respective folder and fixed path with new path for IDEX and SWE

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
tech3371 and pre-commit-ci[bot] authored Sep 13, 2023
1 parent 94117be commit a38649c
Show file tree
Hide file tree
Showing 25 changed files with 1,107 additions and 1,085 deletions.
3 changes: 0 additions & 3 deletions imap_processing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,3 @@

# Eg. imap_module_directory = /usr/local/lib/python3.11/site-packages/imap_processing
imap_module_directory = Path(__file__).parent

# Relative to imap_module_directory, set path of packet definitions directory.
packet_definition_directory = f"{imap_module_directory}/packet_definitions/"
32 changes: 0 additions & 32 deletions imap_processing/codice/L0/hi_pha.py

This file was deleted.

32 changes: 0 additions & 32 deletions imap_processing/codice/L0/lo_pha.py

This file was deleted.

32 changes: 0 additions & 32 deletions imap_processing/codice/L0/nsw_species_counts.py

This file was deleted.

32 changes: 0 additions & 32 deletions imap_processing/codice/L0/omni_species_counts.py

This file was deleted.

32 changes: 0 additions & 32 deletions imap_processing/codice/L0/sw_species_counts.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
<?xml version='1.0' encoding='utf-8'?>
<xtce:SpaceSystem xmlns:xtce="http://www.omg.org/space" name="P_COD_HI_OMNI_SPECIES_COUNTS">
<xtce:Header date="2023-09" version="1.0" author="IMAP SDC" />
<xtce:TelemetryMetaData>
<xtce:ParameterTypeSet>
<xtce:ParameterType name="UINT3" signed="false">
<xtce:IntegerDataEncoding sizeInBits="3" encoding="unsigned" />
</xtce:ParameterType>
<xtce:ParameterType name="UINT1" signed="false">
<xtce:IntegerDataEncoding sizeInBits="1" encoding="unsigned" />
</xtce:ParameterType>
<xtce:ParameterType name="UINT11" signed="false">
<xtce:IntegerDataEncoding sizeInBits="11" encoding="unsigned" />
</xtce:ParameterType>
<xtce:ParameterType name="UINT2" signed="false">
<xtce:IntegerDataEncoding sizeInBits="2" encoding="unsigned" />
</xtce:ParameterType>
<xtce:ParameterType name="UINT14" signed="false">
<xtce:IntegerDataEncoding sizeInBits="14" encoding="unsigned" />
</xtce:ParameterType>
<xtce:ParameterType name="UINT16" signed="false">
<xtce:IntegerDataEncoding sizeInBits="16" encoding="unsigned" />
</xtce:ParameterType>
<xtce:ParameterType name="UINT32" signed="false">
<xtce:IntegerDataEncoding sizeInBits="32" encoding="unsigned" />
</xtce:ParameterType>
<xtce:ParameterType name="UINT20" signed="false">
<xtce:IntegerDataEncoding sizeInBits="20" encoding="unsigned" />
</xtce:ParameterType>
<xtce:ParameterType name="UINT12" signed="false">
<xtce:IntegerDataEncoding sizeInBits="12" encoding="unsigned" />
</xtce:ParameterType>
<xtce:ParameterType name="UINT4" signed="false">
<xtce:IntegerDataEncoding sizeInBits="4" encoding="unsigned" />
</xtce:ParameterType>
<xtce:ParameterType name="UINT6" signed="false">
<xtce:IntegerDataEncoding sizeInBits="6" encoding="unsigned" />
</xtce:ParameterType>
<xtce:ParameterType name="UINT24" signed="false">
<xtce:IntegerDataEncoding sizeInBits="24" encoding="unsigned" />
</xtce:ParameterType>
<xtce:BinaryParameterType name="BYTE28704768">
<xtce:UnitSet />
<xtce:BinaryDataEncoding bitOrder="mostSignificantBitFirst">
<xtce:SizeInBits>
<xtce:FixedValue>28704768</xtce:FixedValue>
</xtce:SizeInBits>
</xtce:BinaryDataEncoding>
</xtce:BinaryParameterType>
</xtce:ParameterTypeSet>
<xtce:ParameterSet>
<xtce:Parameter name="VERSION" parameterTypeRef="UINT3">
<xtce:LongDescription>CCSDS Packet Version Number (always 0)</xtce:LongDescription>
</xtce:Parameter>
<xtce:Parameter name="TYPE" parameterTypeRef="UINT1">
<xtce:LongDescription>CCSDS Packet Type Indicator (0=telemetry)</xtce:LongDescription>
</xtce:Parameter>
<xtce:Parameter name="SEC_HDR_FLG" parameterTypeRef="UINT1">
<xtce:LongDescription>CCSDS Packet Secondary Header Flag (always 1)</xtce:LongDescription>
</xtce:Parameter>
<xtce:Parameter name="PKT_APID" parameterTypeRef="UINT11">
<xtce:LongDescription>CCSDS Packet Application Process ID</xtce:LongDescription>
</xtce:Parameter>
<xtce:Parameter name="SEG_FLGS" parameterTypeRef="UINT2">
<xtce:LongDescription>CCSDS Packet Grouping Flags (3=not part of group)</xtce:LongDescription>
</xtce:Parameter>
<xtce:Parameter name="SRC_SEQ_CTR" parameterTypeRef="UINT14">
<xtce:LongDescription>CCSDS Packet Sequence Count (increments with each new packet)</xtce:LongDescription>
</xtce:Parameter>
<xtce:Parameter name="PKT_LEN" parameterTypeRef="UINT16">
<xtce:LongDescription>CCSDS Packet Length (number of bytes after Packet length minus 1)</xtce:LongDescription>
</xtce:Parameter>
<xtce:Parameter name="SHCOARSE" parameterTypeRef="UINT32">
<xtce:LongDescription>CCSDS Packet Time Stamp (coarse time)</xtce:LongDescription>
</xtce:Parameter>
<xtce:Parameter name="Packet_Version" parameterTypeRef="UINT16">
<xtce:LongDescription>Packet version - this will be incremented each time the format of the packet changes.</xtce:LongDescription>
</xtce:Parameter>
<xtce:Parameter name="Spin_Period" parameterTypeRef="UINT16">
<xtce:LongDescription>Spin period reported by the Spacecraft in the Time and Status message. Reported period is the period that was active when the 16-spin acquisition cycle started.</xtce:LongDescription>
</xtce:Parameter>
<xtce:Parameter name="Acq_Start_Seconds" parameterTypeRef="UINT32">
<xtce:LongDescription>Full-seconds portion of the time at which the 16-spin cycle started</xtce:LongDescription>
</xtce:Parameter>
<xtce:Parameter name="Acq_Start_Subseconds" parameterTypeRef="UINT20">
<xtce:LongDescription>Sub-seconds portion of the time at which the 16-spin cycle started (microseconds)</xtce:LongDescription>
</xtce:Parameter>
<xtce:Parameter name="Spare_00" parameterTypeRef="UINT12">
<xtce:LongDescription>Spare for alignment</xtce:LongDescription>
</xtce:Parameter>
<xtce:Parameter name="Table_ID" parameterTypeRef="UINT32">
<xtce:LongDescription>Unique ID assigned to a specific table configuration. This field is used to link the overall acquisition and processing settings to a specific table configuration.</xtce:LongDescription>
</xtce:Parameter>
<xtce:Parameter name="Plan_ID" parameterTypeRef="UINT16">
<xtce:LongDescription>Plan table that was in use</xtce:LongDescription>
</xtce:Parameter>
<xtce:Parameter name="Plan_Step" parameterTypeRef="UINT4">
<xtce:LongDescription>Plan step that was active when this data was acquired and processed.</xtce:LongDescription>
</xtce:Parameter>
<xtce:Parameter name="View_ID" parameterTypeRef="UINT4">
<xtce:LongDescription>View ID provides information about how data was collapsed and/or compressed.</xtce:LongDescription>
</xtce:Parameter>
<xtce:Parameter name="RGFO_Half_Spin" parameterTypeRef="UINT6">
<xtce:LongDescription>N/A for CoDICE-Hi; included in order to maintain common packet format</xtce:LongDescription>
</xtce:Parameter>
<xtce:Parameter name="NSO_Half_Spin" parameterTypeRef="UINT6">
<xtce:LongDescription>N/A for CoDICE-Hi; included in order to maintain common packet format</xtce:LongDescription>
</xtce:Parameter>
<xtce:Parameter name="Bias_Gain_Mode" parameterTypeRef="UINT1">
<xtce:LongDescription>N/A for CoDICE-Hi; included in order to maintain common packet format</xtce:LongDescription>
</xtce:Parameter>
<xtce:Parameter name="Suspect" parameterTypeRef="UINT1">
<xtce:LongDescription>Indicates that there was some error detected during acquisition or processing of the data. Errors could include corrupted acquisition memory (i.e. EDAC errors), timing violations, or other events that interrupted or otherwise affected data collection.</xtce:LongDescription>
</xtce:Parameter>
<xtce:Parameter name="Compression" parameterTypeRef="UINT2">
<xtce:LongDescription>Whether/how the data is compressed.</xtce:LongDescription>
</xtce:Parameter>
<xtce:Parameter name="Byte_Count" parameterTypeRef="UINT24">
<xtce:LongDescription>Number of bytes in the Data array. If compressed, this value represents the length of the compressed data.</xtce:LongDescription>
</xtce:Parameter>
<xtce:Parameter name="Data" parameterTypeRef="BYTE28704768">
<xtce:LongDescription>Counter Data

Variable Length; Maximum (based on uncollapsed, uncompressed data, and assuming all 146 sqrt(2) speceis counters included):

16 spins x 16 positions x 24 spin-angles x 32 bits x 146 counters = 28,704,768 bits (3,588,096 bytes)

Nominal (based on current plan for counter selection, collapsing, and compression): 42,240 bits (5,281 bytes)

Data format is a series of spin-angle x position x spin number data cubes collapsed per the SCI_LUT Collapse Table selected by the View_ID. Which counters are included is determined by using the Plan_ID and Plan_Step to index into the SCI_LUT Data Products Hi/Lo tables to find all the counters that are associated with the View_ID.

The collapsed data cubes are also optionally compressed using Lossy and/or Lossless Compression. Lossy compression is a table-based 24-&gt;8 bit compression applied to each counter value. Lossless compression uses the LZMA compression algorithm and is applied to the full Data field as a single unit.

Field will additionally be padded in order to meet the requirement of packets being a multiple of 16 bits; any pad bits will be accounted for in the CCSDS header Length field, but will *not* be included in the Byte_Count field

When this array is too large for a single CCSDS packet, CoDICE will utilize the CCSDS Grouping flags to provide the full data packet over several CCSDS packets.</xtce:LongDescription>
</xtce:Parameter>
</xtce:ParameterSet>
<xtce:ContainerSet>
<xtce:SequenceContainer name="CCSDSPacket">
<xtce:EntryList>
<xtce:ParameterRefEntry parameterRef="VERSION" />
<xtce:ParameterRefEntry parameterRef="TYPE" />
<xtce:ParameterRefEntry parameterRef="SEC_HDR_FLG" />
<xtce:ParameterRefEntry parameterRef="PKT_APID" />
<xtce:ParameterRefEntry parameterRef="SEG_FLGS" />
<xtce:ParameterRefEntry parameterRef="SRC_SEQ_CTR" />
<xtce:ParameterRefEntry parameterRef="PKT_LEN" />
<xtce:ParameterRefEntry parameterRef="SHCOARSE" />
</xtce:EntryList>
</xtce:SequenceContainer>
<xtce:SequenceContainer name="P_COD_HI_OMNI_SPECIES_COUNTS">
<xtce:BaseContainer containerRef="CCSDSPacket">
<xtce:RestrictionCriteria>
<xtce:Comparison parameterRef="PKT_APID" value="1172" useCalibratedValue="false" />
</xtce:RestrictionCriteria>
</xtce:BaseContainer>
<xtce:EntryList>
<xtce:ParameterRefEntry parameterRef="Packet_Version" />
<xtce:ParameterRefEntry parameterRef="Spin_Period" />
<xtce:ParameterRefEntry parameterRef="Acq_Start_Seconds" />
<xtce:ParameterRefEntry parameterRef="Acq_Start_Subseconds" />
<xtce:ParameterRefEntry parameterRef="Spare_00" />
<xtce:ParameterRefEntry parameterRef="Table_ID" />
<xtce:ParameterRefEntry parameterRef="Plan_ID" />
<xtce:ParameterRefEntry parameterRef="Plan_Step" />
<xtce:ParameterRefEntry parameterRef="View_ID" />
<xtce:ParameterRefEntry parameterRef="RGFO_Half_Spin" />
<xtce:ParameterRefEntry parameterRef="NSO_Half_Spin" />
<xtce:ParameterRefEntry parameterRef="Bias_Gain_Mode" />
<xtce:ParameterRefEntry parameterRef="Suspect" />
<xtce:ParameterRefEntry parameterRef="Compression" />
<xtce:ParameterRefEntry parameterRef="Byte_Count" />
<xtce:ParameterRefEntry parameterRef="Data" />
</xtce:EntryList>
</xtce:SequenceContainer>
</xtce:ContainerSet>
</xtce:TelemetryMetaData>
</xtce:SpaceSystem>
Loading

0 comments on commit a38649c

Please sign in to comment.