Skip to content

Commit 845e4b0

Browse files
authored
Merge branch 'master' into better-gifs
2 parents 4ea79b3 + ed26904 commit 845e4b0

5 files changed

Lines changed: 29 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
55

66
## [Unreleased]
77

8+
### Fixed
9+
- `Data.squeeze`: axes of output object now inherit units from axes of the input object
10+
811
### Changed
912
- use `pillow` directly and remove `ImageIO` dependency
13+
14+
## [3.6.3]
15+
16+
### Changed
1017
- `Data.norm_for_each`: allow for normlization for each combination of a set of variables
1118
- docs use updated Sphinx packages
1219
- docs: new example showing norms interfacing with data objects
@@ -456,7 +463,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
456463
### Added
457464
- initial release
458465

459-
[Unreleased]: https://github.com/wright-group/WrightTools/-/compare/3.6.2...master
466+
[Unreleased]: https://github.com/wright-group/WrightTools/-/compare/3.6.3...master
467+
[3.6.3]: https://github.com/wright-group/WrightTools/compare/3.6.2...3.6.3
460468
[3.6.2]: https://github.com/wright-group/WrightTools/compare/3.6.1...3.6.2
461469
[3.6.1]: https://github.com/wright-group/WrightTools/compare/3.6.0...3.6.1
462470
[3.6.0]: https://github.com/wright-group/WrightTools/compare/3.5.5...3.6.0

WrightTools/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.6.2
1+
3.6.3

WrightTools/data/_data.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,9 +424,12 @@ def squeeze(self, name=None, parent=None):
424424

425425
# inherit constants
426426
for c in self.constants:
427-
new.create_constant(c.expression)
427+
new.create_constant(c.expression, verbose=False)
428428

429429
new.transform(*self.axis_expressions)
430+
for axn in self.axis_names:
431+
new.get_axis(axn).convert(self.get_axis(axn).units)
432+
430433
return new
431434

432435
def ichop(self, *args, at=None, autoclose=True) -> Generator:

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787

8888
# General information about the project.
8989
project = "WrightTools"
90-
copyright = "2016-2024, WrightTools Developers"
90+
copyright = f"2016-%Y, WrightTools Developers"
9191
author = "WrightTools Developers"
9292

9393
# The version info for the project you're documenting, acts as replacement for

tests/data/squeeze.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,19 @@ def test_squeeze():
2626
assert d.shape == (5, 4)
2727

2828

29+
def test_squeeze_units():
30+
d = wt.Data(name="test")
31+
d.create_variable("x", values=np.arange(5)[:, None, None], units="fs")
32+
d.create_variable("y", values=np.arange(4)[None, :, None], units="fs")
33+
d.create_variable("unused_var", values=d.x[:] - d.y[:], units="fs")
34+
d.transform("x", "y")
35+
d.convert("ps")
36+
37+
ds = d.squeeze(name="squeezed")
38+
for axn in d.axis_names:
39+
assert ds[axn].units == d[axn].units
40+
41+
2942
def test_constants():
3043
d = wt.Data(name="test")
3144
d.create_variable("x", values=np.array([1]).reshape(1, 1))
@@ -35,10 +48,9 @@ def test_constants():
3548
d.transform("y")
3649
ds = d.squeeze()
3750
assert "x" in ds.constant_expressions
38-
d.print_tree()
39-
ds.print_tree()
4051

4152

4253
if __name__ == "__main__":
4354
test_squeeze()
55+
test_squeeze_units()
4456
test_constants()

0 commit comments

Comments
 (0)