Skip to content

Commit

Permalink
Use unicode for Yanny strings
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Jul 3, 2024
1 parent c38180a commit 40aceb6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/sdsstools/_vendor/yanny.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,9 +640,9 @@ def dtype(self, structure):
for c in self.columns(structure):
typ = self.basetype(structure, c)
if typ == "char":
d = "S{0:d}".format(self.char_length(structure, c))
d = "U{0:d}".format(self.char_length(structure, c))
elif self.isenum(structure, c):
d = "S{0:d}".format(max([len(x) for x in self._enum_cache[typ]]))
d = "U{0:d}".format(max([len(x) for x in self._enum_cache[typ]]))
else:
d = dtmap[typ]
if self.isarray(structure, c):
Expand Down
6 changes: 6 additions & 0 deletions test/test_vendor.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

import pathlib

import numpy

from sdsstools import yanny
from sdsstools._vendor.color_print import color_text

Expand All @@ -22,3 +24,7 @@ def test_yanny():
assert yy is not None
assert yy["configuration_id"] == "145"
assert len(yy["FIBERMAP"]) == 33

cadence = yy["FIBERMAP"]["cadence"][1]
assert isinstance(cadence, numpy.str_)
assert str(cadence) == "bright_1x1"

0 comments on commit 40aceb6

Please sign in to comment.