Skip to content

Commit

Permalink
fix names
Browse files Browse the repository at this point in the history
  • Loading branch information
ddkohler committed Jul 10, 2024
1 parent 4b0dd6d commit c8ca940
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions WrightTools/data/_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1935,7 +1935,7 @@ def split(
# axis ------------------------------------------------------------------------------------
old_expr = self.axis_expressions
old_units = self.units
out = wt_collection.Collection(name=f"{self.name}_split", parent=parent)
out = wt_collection.Collection(name=f"{self.natural_name}_split", parent=parent)
if isinstance(expression, int):
if units is None:
units = self._axes[expression].units
Expand Down Expand Up @@ -1969,11 +1969,8 @@ def split(
omasks.append(None)
cuts.append(None)
for i in range(len(positions) - 1):
out.create_data(f"{self.name}_{i:0>3}")
out.create_data(f"{self.natural_name}_{i:0>3}")

if inherit_attrs:
for d in out.values():
{d.attrs[k]: self.attrs[k] for k in self.attrs.keys() if k not in d.attrs.keys()}
for var in self.variables:
for i, (imask, omask, cut) in enumerate(zip(masks, omasks, cuts)):
if omask is None:
Expand Down Expand Up @@ -2047,6 +2044,10 @@ def split(
for ax, u in zip(self.axes, old_units):
ax.convert(u)

if inherit_attrs:
for d in out.values():
{d.attrs[k]: self.attrs[k] for k in self.attrs.keys() if k not in d.attrs.keys()}

return out

def transform(self, *axes, verbose=True):
Expand Down
2 changes: 1 addition & 1 deletion tests/data/split.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def test_split_parent():
a = wt.data.from_PyCMDS(p)
parent = wt.Collection()
split = a.split(1, [1500], parent=parent)
assert "split" in parent
assert f"{a.natural_name}_split" in parent
assert split.filepath == parent.filepath
assert len(split) == 2
a.close()
Expand Down

0 comments on commit c8ca940

Please sign in to comment.