Skip to content

Commit

Permalink
Merge branch 'master' into refactor-artists-quicknD
Browse files Browse the repository at this point in the history
  • Loading branch information
ddkohler authored Mar 20, 2024
2 parents 50ae5d1 + eb5293e commit f05dc1a
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 288 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: test python

on: [push, pull_request]
on:
pull_request:
types: [opened, reopened]
push:

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/psf/black
rev: 24.2.0 # Replace by any tag/version: https://github.com/psf/black/tags
rev: 24.3.0 # Replace by any tag/version: https://github.com/psf/black/tags
hooks:
- id: black
language_version: python3 # Should be a command that runs python3.6+
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).

### Fixed
- fixed Quick2D/Quick1D issues where collapsing unused dims did not work
- wt5 explore : fixed bug where data will not load interactively if directory is not cwd
- constants in chopped data will inherit the units of the original data

## Changed
- artists now gets turbo colormap straight from matplotlib

## [3.5.2]

Expand Down
3 changes: 0 additions & 3 deletions WrightTools/artists/_colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
import matplotlib.colors as mplcolors
import matplotlib.gridspec as grd

from ._turbo import turbo


# --- define -------------------------------------------------------------------------------------

Expand Down Expand Up @@ -438,7 +436,6 @@ def __getitem__(self, key):
colormaps["skyebar1"] = mplcolors.LinearSegmentedColormap.from_list("skyebar", skyebar)
colormaps["skyebar2"] = mplcolors.LinearSegmentedColormap.from_list("skyebar dark", skyebar_d)
colormaps["skyebar3"] = mplcolors.LinearSegmentedColormap.from_list("skyebar inverted", skyebar_i)
colormaps["turbo"] = turbo
colormaps["wright"] = mplcolors.LinearSegmentedColormap.from_list("wright", wright)


Expand Down
280 changes: 0 additions & 280 deletions WrightTools/artists/_turbo.py

This file was deleted.

2 changes: 1 addition & 1 deletion WrightTools/cli/_wt5.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def raise_sys_exit():
break
if valid:
print("interacting...")
_interact(shell, str(paths[int(msg)]))
_interact(shell, str(directory / paths[int(msg)]))
continue


Expand Down
11 changes: 10 additions & 1 deletion WrightTools/data/_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,11 @@ def _from_slice(self, idx, name=None, parent=None) -> Data:

for const in list(self.constant_expressions) + constants:
out.create_constant(const, verbose=False)
if const in self.constant_expressions:
dest_units = self.constants[self.constant_expressions.index(const)].units
else:
dest_units = self.axes[self.axis_expressions.index(const)].units
out.constants[out.constant_expressions.index(const)].convert(dest_units)
for j, units in enumerate(new_axis_units):
out.axes[j].convert(units)

Expand Down Expand Up @@ -1263,10 +1268,14 @@ def level(self, channel, axis, npts, *, verbose=True):
def map_variable(
self, variable, points, input_units="same", *, name=None, parent=None, verbose=True
) -> "Data":
"""Map points of an axis to new points using linear interpolation.
"""
Map points of an axis to new points using linear interpolation.
Out-of-bounds points are written nan.
Non-mapped variables are kept in the data object only if they are
orthogonal to the mapped variable (see `kit.orthogonal`).
Parameters
----------
variable : string
Expand Down
4 changes: 3 additions & 1 deletion tests/data/chop.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,10 @@ def test_3D_to_2D_units():
assert d.w2.size == 11
assert d.axis_expressions == ("wm", "w2")
assert d.units == ("eV", "eV")
data.close()
w1 = d.constants[d.constant_names.index("w1")]
assert w1.units == "eV"
chop.close()
data.close()


def test_parent():
Expand Down

0 comments on commit f05dc1a

Please sign in to comment.