Skip to content

Commit

Permalink
Merge pull request #1002 from wright-group/axes_string
Browse files Browse the repository at this point in the history
Explicitly store axes as fixed width numpy strings
  • Loading branch information
kameyer226 committed May 1, 2021
2 parents a6872a4 + c8ea74a commit 674e132
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).

### Changed
- complete units overhaul, now using pint library
- explicitly store axes as fixed string dtype

### Fixed
- Avoid passing both `vmin/vmax` and `norm` to `pcolor*` methods
Expand Down
6 changes: 4 additions & 2 deletions WrightTools/data/_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def _on_axes_updated(self):
Propagates updated axes properly.
"""
# update attrs
self.attrs["axes"] = [a.identity.encode() for a in self._axes]
self.attrs["axes"] = np.array([a.identity.encode() for a in self._axes], dtype="S")
# remove old attributes
while len(self._current_axis_identities_in_natural_namespace) > 0:
key = self._current_axis_identities_in_natural_namespace.pop(0)
Expand All @@ -241,7 +241,9 @@ def _on_constants_updated(self):
Propagates updated constants properly.
"""
# update attrs
self.attrs["constants"] = [a.identity.encode() for a in self._constants]
self.attrs["constants"] = np.array(
[a.identity.encode() for a in self._constants], dtype="S"
)

def _print_branch(self, prefix, depth, verbose):
def print_leaves(prefix, lis, vline=True):
Expand Down

0 comments on commit 674e132

Please sign in to comment.