Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set dim label #522

Merged
merged 3 commits into from
Aug 11, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
20 changes: 10 additions & 10 deletions nixio/dimensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,18 @@ def _check_index(index):

return None

@property
def label(self):
return self._h5group.get_attr("label")

@label.setter
def label(self, label):
util.check_attr_type(label, str)
self._h5group.set_attr("label", label)

@staticmethod
def _check_link_dimensionality(data_array, index):
invalid_dim_msg = ("Length of linked DataArray indices ({}) does not match "
invalid_dim_msg = ("Length of linked DataArray indices ({}) does not match "
"number of DataArray dimensions ({})"
).format(len(data_array.data_extent), len(index))

Expand Down Expand Up @@ -429,15 +438,6 @@ def axis(self, count, start=None, start_position=None):

return tuple(np.arange(count) * sample + start_val)

@property
def label(self):
return self._h5group.get_attr("label")

@label.setter
def label(self, label):
util.check_attr_type(label, str)
self._h5group.set_attr("label", label)

@property
def sampling_interval(self):
return self._h5group.get_attr("sampling_interval")
Expand Down
2 changes: 1 addition & 1 deletion nixio/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@


FILE_FORMAT = "nix"
HDF_FF_VERSION = (1, 2, 0)
HDF_FF_VERSION = (1, 2, 1)


def can_write(nixfile):
Expand Down
4 changes: 2 additions & 2 deletions nixio/info.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"VERSION": "1.5.0.dev",
"VERSION": "1.5.1.dev",
"STATUS": "Release",
"RELEASE": "1.5.0 Development",
"RELEASE": "1.5.1 Development",
"AUTHOR": "Christian Kellner, Adrian Stoewer, Andrey Sobolev, Jan Grewe, Balint Morvai, Achilleas Koutsou",
"COPYRIGHT": "2014-2020, German Neuroinformatics Node, Christian Kellner, Adrian Stoewer, Andrey Sobolev, Jan Grewe, Balint Morvai, Achilleas Koutsou",
"CONTACT": "[email protected]",
Expand Down
6 changes: 6 additions & 0 deletions nixio/test/test_dimensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ def test_set_dimension(self):
self.set_dim.labels = test_labels
assert self.set_dim.labels == test_labels

assert self.set_dim.label is None
self.set_dim.label = TEST_LABEL
assert self.set_dim.label == TEST_LABEL
self.set_dim.label = None
assert self.set_dim.label is None

def test_sample_dimension(self):
assert self.sample_dim.index == 2
assert self.sample_dim.dimension_type == nix.DimensionType.Sample
Expand Down