Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).

### Fixed
- fixed bug where numpy>2.4 broke `data.join`
- fixed bug which prevented channels from having units

### Changed
- per [PEP 765](https://peps.python.org/pep-0765/), `return` is removed from `finally` blocks
Expand Down
3 changes: 2 additions & 1 deletion WrightTools/data/_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ def __init__(
super().__init__(id)
self.label = label
self.label_seed = label_seed
self.units = units
if units is not None:
self.units = units
self.dimensionality = len(self.shape)
# attrs
if self._parent.file.mode is not None and self._parent.file.mode != "r":
Expand Down
17 changes: 17 additions & 0 deletions tests/data/channel/units.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""Tests to do with null."""

# --- import --------------------------------------------------------------------------------------


import WrightTools as wt
import numpy as np


def test_assignment():
d = wt.Data()
d.create_channel("x", values=np.arange(5), units="Hz")
assert d["x"].units == "Hz"


if __name__ == "__main__":
test_assignment()