CCSDSPy / ccsdspy

I/O interface and utilities for CCSDS binary spacecraft data in Python. Library used in flight missions at NASA, NOAA, and SWRI
https://ccsdspy.org
BSD 3-Clause "New" or "Revised" License
78 stars 19 forks source link

`PacketArray` represented as `PacketField` #79

Closed jmbhughes closed 1 year ago

jmbhughes commented 1 year ago

Issue

I noticed when doing some testing that when I created a PacketArray and then printed it that the string representation said PacketField instead of PacketArray. I don't think this was intended, but feel free to close the issue if it was.

Relevant area of code:

https://github.com/CCSDSPy/ccsdspy/blob/0d19cd9a6a146bf608b2c62e8c20e2b2bdc731bc/ccsdspy/packet_fields.py#L74

Simple example:

import ccsdspy
from ccsdspy import PacketField, PacketArray

pkt = [
  PacketField(
       name='SHCOARSE',
       data_type='uint',
       bit_length=32
  ),
  PacketArray(
       name="data",
       data_type="uint",
       bit_length=16,
       array_shape="expand",   # makes the data field expand
  ),
  PacketField(
       name="checksum",
       data_type="uint",
       bit_length=16
  ),
]
print(pkt[1])

the output is: PacketField(name='data', data_type='uint', bit_length=16, bit_offset=None, byte_order='big') instead of PacketArray(name='data', data_type='uint', bit_length=16, bit_offset=None, byte_order='big')

jmbhughes commented 1 year ago

I must've been running an older version of CCSDSPy or something because it appears fixed now.