Skip to content

Commit f21e2a4

Browse files
authored
Merge pull request #278 from sot/update-repr
Update MSID dtype property to handle objects
2 parents 7cae37d + 3669ac0 commit f21e2a4

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

cheta/fetch.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,8 +533,8 @@ def __len__(self):
533533
return len(self.vals)
534534

535535
@property
536-
def dtype(self):
537-
return self.vals.dtype
536+
def dtype(self) -> np.dtype:
537+
return self.vals.dtype if hasattr(self.vals, "dtype") else np.dtype("object")
538538

539539
def __repr__(self):
540540
attrs = [self.__class__.__name__, self.MSID]

cheta/tests/test_comps.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,19 @@ def test_quat_comp(msid, maude, offset):
271271
assert isinstance(datq.vals, Quat)
272272

273273

274+
def test_quat_comp_repr():
275+
"""Test the repr of a quat_comp MSID and confirm the dtype."""
276+
start = "2025:001:00:00:00.000"
277+
stop = "2025:001:00:01:00.000"
278+
msid = "aoattqt"
279+
datq = fetch_eng.MSID(f"quat_{msid}", start, stop)
280+
assert (
281+
repr(datq)
282+
== "<MSID QUAT_AOATTQT start=2025:001:00:00:00.000 stop=2025:001:00:01:00.000 len=58 dtype=object>"
283+
)
284+
assert datq.dtype.name == "object"
285+
286+
274287
def test_quat_comp_bad_times():
275288
"""Test bad time data on 2024:264. All four quats have zero value and are bad.
276289

0 commit comments

Comments
 (0)