Skip to content

Commit

Permalink
Refactor modules (#68)
Browse files Browse the repository at this point in the history
* MNT: Large refactor splitting up contents into submodules

* MNT: Rename modules

matches -> comparisons
packets -> parseables

* MNT: Rename modules (xtcedef / csvdev -> definitions)
  • Loading branch information
greglucas authored Sep 6, 2024
1 parent ab0f361 commit 3744845
Show file tree
Hide file tree
Showing 22 changed files with 3,666 additions and 3,622 deletions.
2 changes: 2 additions & 0 deletions docs/source/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ list and release milestones.
Release notes for the `space_packet_parser` library

### v5.0.0 (unreleased)
- BREAKING: Separated out logical pieces into separate modules rather than everything
living within the xtcedef module. This means user imports may be different now.
- BREAKING: Replace `bitstring` objects with native Python bytes objects
- Remove dependency on the `bitstring` library
- Much faster parsing speed
Expand Down
8 changes: 4 additions & 4 deletions docs/source/users.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ Usage with XTCE packet definition:

```python
from pathlib import Path
from space_packet_parser import xtcedef, parser
from space_packet_parser import definitions, parser

packet_file = Path('my_packets.pkts')
xtce_document = Path('my_xtce_document.xml')
packet_definition = xtcedef.XtcePacketDefinition(xtce_document)
packet_definition = definitions.XtcePacketDefinition(xtce_document)

# You can introspect the packet definition to learn about what was parsed
pt = packet_definition.named_parameter_types["MY_PARAM_Type"] # Look up a type (includes unit and encoding info)
Expand All @@ -38,11 +38,11 @@ Usage with CSV packet definition:

```python
from pathlib import Path
from space_packet_parser import csvdef, parser
from space_packet_parser import definitions, parser

packet_file = Path('my_packets.pkts')
csv_document = Path('my_csv_file.csv')
packet_definition = csvdef.CsvPacketDefinition(csv_document)
packet_definition = definitions.CsvPacketDefinition(csv_document)
my_parser = parser.PacketParser(packet_definition)

with packet_file.open("rb") as binary_data:
Expand Down
6 changes: 3 additions & 3 deletions examples/parsing_and_plotting_idex_waveforms_from_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# Installed
import matplotlib.pyplot as plt
# Local
from space_packet_parser import xtcedef
from space_packet_parser import definitions
from space_packet_parser import parser


Expand Down Expand Up @@ -99,8 +99,8 @@ def plot_full_event(data: dict):
"""Parse IDEX data"""
idex_test_data_dir = Path("../tests/test_data/idex")
idex_xtce = idex_test_data_dir / 'idex_combined_science_definition.xml'
idex_definition = xtcedef.XtcePacketDefinition(xtce_document=idex_xtce)
assert isinstance(idex_definition, xtcedef.XtcePacketDefinition)
idex_definition = definitions.XtcePacketDefinition(xtce_document=idex_xtce)
assert isinstance(idex_definition, definitions.XtcePacketDefinition)
idex_parser = parser.PacketParser(idex_definition)
idex_packet_file = idex_test_data_dir / 'sciData_2023_052_14_45_05'

Expand Down
Loading

0 comments on commit 3744845

Please sign in to comment.