Skip to content

Commit

Permalink
Merge pull request #1055 from wright-group/unused_var
Browse files Browse the repository at this point in the history
Remove unused variables
  • Loading branch information
kameyer226 committed Mar 9, 2022
2 parents 2706b3a + 2f3284b commit f1a0858
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 53 deletions.
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
- `data.from_Solis`: import works without metadata
- remove unused variables


## [3.4.3]
Expand Down
30 changes: 0 additions & 30 deletions WrightTools/artists/_colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,18 +293,6 @@ def get_color_cycle(n, cmap="rainbow", rotations=3):

cubehelix = make_cubehelix()

experimental = [
"#FFFFFF",
"#0000FF",
"#0080FF",
"#00FFFF",
"#00FF00",
"#FFFF00",
"#FF8000",
"#FF0000",
"#881111",
]

greenscale = ["#000000", "#00FF00"] # black # green

greyscale = ["#FFFFFF", "#000000"] # white # black
Expand Down Expand Up @@ -380,24 +368,6 @@ def get_color_cycle(n, cmap="rainbow", rotations=3):
name="isoluminant3",
)

signed = [
"#0000FF", # blue
"#002AFF",
"#0055FF",
"#007FFF",
"#00AAFF",
"#00D4FF",
"#00FFFF",
"#FFFFFF", # white
"#FFFF00",
"#FFD400",
"#FFAA00",
"#FF7F00",
"#FF5500",
"#FF2A00",
"#FF0000", # red
]

signed_old = [
"#0000FF", # blue
"#00BBFF", # blue-aqua
Expand Down
2 changes: 1 addition & 1 deletion WrightTools/data/_aramis.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def from_Aramis(filepath, name=None, parent=None, verbose=True) -> Data:
header = f.read(10)
if header != b"DataMatrix":
warnings.warn(f"Unexpected Header {header}, Aramis parsing may not be valid")
instr = _readstr(f)
_ = _readstr(f) # instr, not used but needs to be read
iname = _readstr(f)
# parse name
if not name:
Expand Down
9 changes: 0 additions & 9 deletions WrightTools/data/_pycmds.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ def from_PyCMDS(filepath, name=None, parent=None, verbose=True, *, collapse=True
A Data instance.
"""
filestr = os.fspath(filepath)
filepath = pathlib.Path(filepath)

# header
ds = np.DataSource(None)
Expand Down Expand Up @@ -254,14 +253,6 @@ def _no_collapse_create(data, headers, signed, index, kind, name, shape):
if kind == "hardware":
units = headers["units"][index]
label = headers["label"][index]
if (
"w" in name
and name.startswith(tuple(data.variable_names))
and name not in headers["axis names"]
):
inherited_shape = data[name.split("_")[0]].shape
else:
units = headers["units"][index]
data.create_variable(name, shape=sh, dtype=np.dtype(np.float64), units=units, label=label)
if kind == "channel":
data.create_channel(name=name, shape=sh, dtype=np.dtype(np.float64), signed=next(signed))
Expand Down
4 changes: 0 additions & 4 deletions WrightTools/kit/_timestamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,6 @@ def hms(self):
@property
def human(self):
"""Human-readable timestamp."""
# get timezone offset
delta_sec = time.timezone
m, s = divmod(delta_sec, 60)
h, m = divmod(m, 60)
# create output
format_string = "%Y-%m-%d %H:%M:%S"
out = self.datetime.strftime(format_string)
Expand Down
2 changes: 1 addition & 1 deletion tests/data/map_variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def test_array():
assert data.shape == (1801,)
new = np.linspace(6000, 8000, 55)
mapped = data.map_variable("energy", new, "wn")
assert data.axes[0][:].all() == new.all()
assert np.allclose(mapped.axes[0][:], 1e7 / new)
data.close()


Expand Down
1 change: 0 additions & 1 deletion tests/data/prune.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ def test_prune_string():
def test_prune_tuple():
p = datasets.PyCMDS.wm_w2_w1_000
data = wt.data.from_PyCMDS(p)
num_channels = len(data.channels)
data.prune(("pyro1", 3, 4), verbose=False)
assert len(data.variables) == 3
assert set(data.variable_names) == {"wm", "w2", "w1"}
Expand Down
12 changes: 5 additions & 7 deletions tests/kit/fft.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# --- import --------------------------------------------------------------------------------------


import pytest

import numpy as np

import WrightTools as wt
Expand All @@ -30,20 +32,16 @@ def test_5_sines():


def test_dimensionality_error():
try:
with pytest.raises(wt.exceptions.DimensionalityError):
t = np.linspace(-20, 20, 10000)
freqs = np.linspace(1, 5, 5)
z = np.sin(2 * np.pi * freqs[None, :] * t[:, None])
t = t[:, None]
wi, zi = wt.kit.fft(t, z, axis=0)
except wt.exceptions.DimensionalityError:
assert True
wt.kit.fft(t, z, axis=0)


def test_even_spacing_error():
try:
with pytest.raises(RuntimeError):
xi = np.logspace(0, 2, 50)
yi = 0
wt.kit.fft(xi, yi)
except RuntimeError:
assert True

0 comments on commit f1a0858

Please sign in to comment.