Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#1046)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/psf/black: 21.12b0 → 22.1.0](psf/black@21.12b0...22.1.0)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] committed Feb 1, 2022
1 parent 69d6703 commit a2e2f0b
Show file tree
Hide file tree
Showing 15 changed files with 70 additions and 70 deletions.
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: 21.12b0 # Replace by any tag/version: https://github.com/psf/black/tags
rev: 22.1.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
2 changes: 1 addition & 1 deletion WrightTools/artists/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def _parse_plot_args(self, *args, **kwargs):
if "origin" not in kwargs.keys():
kwargs["origin"] = "lower"
if "interpolation" not in kwargs.keys():
if max(zi.shape) < 10 ** 3: # TODO: better decision logic
if max(zi.shape) < 10**3: # TODO: better decision logic
kwargs["interpolation"] = "nearest"
else:
kwargs["interpolation"] = "antialiased"
Expand Down
2 changes: 1 addition & 1 deletion WrightTools/artists/_colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def get_color_function(p0, p1):
def color(x):
# Calculate amplitude and angle of deviation from the black to
# white diagonal in the plane of constant perceived intensity.
xg = darkest * x ** gamma
xg = darkest * x**gamma
lum = 1 - xg # starts at 1
if reverse:
lum = lum[::-1]
Expand Down
2 changes: 1 addition & 1 deletion WrightTools/artists/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ def plot_colorbar(
else:
# scientific notation
def fmt(x, _):
return "%.1f" % (x / float(10 ** magnitude))
return "%.1f" % (x / float(10**magnitude))

format = matplotlib.ticker.FuncFormatter(fmt)
magnitude_label = r" $\mathsf{\times 10^{%d}}$" % magnitude
Expand Down
2 changes: 1 addition & 1 deletion WrightTools/data/_axis.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def label(self) -> str:

label = label.replace(v.natural_name, vl)

label += fr"\,\left({wt_units.ureg.Unit(self.units):~}\right)"
label += rf"\,\left({wt_units.ureg.Unit(self.units):~}\right)"

label = r"$\mathsf{%s}$" % label
return label
Expand Down
2 changes: 1 addition & 1 deletion WrightTools/data/_constant.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def label(self) -> str:
val = round(self.value, self.round_spec) if self.round_spec is not None else self.value
label += r"\,=\,{}".format(format(val, self.format_spec))
if self.units_kind:
label += fr"\,{wt_units.ureg.Unit(self.units):~}"
label += rf"\,{wt_units.ureg.Unit(self.units):~}"
label = r"$\mathsf{%s}$" % label
return label

Expand Down
2 changes: 1 addition & 1 deletion WrightTools/data/_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ def moment(self, axis, channel=0, moment=1, *, resultant=None):
sigma.shape = new_shape
sigma /= norm
sigma **= 0.5
norm *= sigma ** moment
norm *= sigma**moment

values = np.trapz((x - about) ** moment * y, x, axis=axis_index)
values = np.array(values)
Expand Down
4 changes: 2 additions & 2 deletions WrightTools/kit/_calculate.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ def fluence(
# calculate beam area
if area_type == "even":
radius_cm = wt_units.converter(beam_radius, beam_radius_units, "cm")
area_cm2 = np.pi * radius_cm ** 2 # cm^2
area_cm2 = np.pi * radius_cm**2 # cm^2
elif area_type == "average":
radius_cm = wt_units.converter(beam_radius, beam_radius_units, "cm")
area_cm2 = np.pi * radius_cm ** 2 # cm^2
area_cm2 = np.pi * radius_cm**2 # cm^2
area_cm2 /= 0.7213 # weight by average intensity felt by oscillator inside of FWHM
else:
raise NotImplementedError
Expand Down
4 changes: 2 additions & 2 deletions WrightTools/kit/_lineshapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def gaussian(x, x0, FWHM, norm="height"):
Gaussian lineshape.
"""
c = FWHM / (2 * np.sqrt(2 * np.log(2)))
arr = np.exp(-1 * (x - x0) ** 2 / (2 * c ** 2))
arr = np.exp(-1 * (x - x0) ** 2 / (2 * c**2))
if norm == "height":
return arr
elif norm == "area":
Expand Down Expand Up @@ -99,7 +99,7 @@ def lorentzian_real(x, x0, G, norm="height"):
array_like or number
Lorentzian lineshape.
"""
arr = G ** 2 / ((x - x0) ** 2 + G ** 2)
arr = G**2 / ((x - x0) ** 2 + G**2)
if norm == "height":
return arr
if norm == "area":
Expand Down
96 changes: 48 additions & 48 deletions WrightTools/kit/_unicode.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,51 +14,51 @@


unicode_dictionary = collections.OrderedDict()
unicode_dictionary["Alpha"] = u"\u0391"
unicode_dictionary["Beta"] = u"\u0392"
unicode_dictionary["Gamma"] = u"\u0392"
unicode_dictionary["Delta"] = u"\u0394"
unicode_dictionary["Epsilon"] = u"\u0395"
unicode_dictionary["Zeta"] = u"\u0396"
unicode_dictionary["Eta"] = u"\u0397"
unicode_dictionary["Theta"] = u"\u0398"
unicode_dictionary["Iota"] = u"\u0399"
unicode_dictionary["Kappa"] = u"\u039A"
unicode_dictionary["Lamda"] = u"\u039B"
unicode_dictionary["Mu"] = u"\u039C"
unicode_dictionary["Nu"] = u"\u039D"
unicode_dictionary["Xi"] = u"\u039E"
unicode_dictionary["Omicron"] = u"\u039F"
unicode_dictionary["Pi"] = u"\u03A0"
unicode_dictionary["Rho"] = u"\u03A1"
unicode_dictionary["Sigma"] = u"\u03A3"
unicode_dictionary["Tau"] = u"\u03A4"
unicode_dictionary["Upsilon"] = u"\u03A5"
unicode_dictionary["Phi"] = u"\u03A6"
unicode_dictionary["Chi"] = u"\u03A7"
unicode_dictionary["Psi"] = u"\u03A8"
unicode_dictionary["Omega"] = u"\u03A9"
unicode_dictionary["alpha"] = u"\u03B1"
unicode_dictionary["beta"] = u"\u03B2"
unicode_dictionary["gamma"] = u"\u03B3"
unicode_dictionary["delta"] = u"\u03B4"
unicode_dictionary["epsilon"] = u"\u03B5"
unicode_dictionary["zeta"] = u"\u03B6"
unicode_dictionary["eta"] = u"\u03B7"
unicode_dictionary["theta"] = u"\u03B8"
unicode_dictionary["iota"] = u"\u03B9"
unicode_dictionary["kappa"] = u"\u03BA"
unicode_dictionary["lamda"] = u"\u03BB"
unicode_dictionary["mu"] = u"\u03BC"
unicode_dictionary["nu"] = u"\u03BD"
unicode_dictionary["xi"] = u"\u03BE"
unicode_dictionary["omicron"] = u"\u03BF"
unicode_dictionary["pi"] = u"\u03C0"
unicode_dictionary["rho"] = u"\u03C1"
unicode_dictionary["sigma"] = u"\u03C3"
unicode_dictionary["tau"] = u"\u03C4"
unicode_dictionary["upsilon"] = u"\u03C5"
unicode_dictionary["phi"] = u"\u03C6"
unicode_dictionary["chi"] = u"\u03C7"
unicode_dictionary["psi"] = u"\u03C8"
unicode_dictionary["omega"] = u"\u03C9"
unicode_dictionary["Alpha"] = "\u0391"
unicode_dictionary["Beta"] = "\u0392"
unicode_dictionary["Gamma"] = "\u0392"
unicode_dictionary["Delta"] = "\u0394"
unicode_dictionary["Epsilon"] = "\u0395"
unicode_dictionary["Zeta"] = "\u0396"
unicode_dictionary["Eta"] = "\u0397"
unicode_dictionary["Theta"] = "\u0398"
unicode_dictionary["Iota"] = "\u0399"
unicode_dictionary["Kappa"] = "\u039A"
unicode_dictionary["Lamda"] = "\u039B"
unicode_dictionary["Mu"] = "\u039C"
unicode_dictionary["Nu"] = "\u039D"
unicode_dictionary["Xi"] = "\u039E"
unicode_dictionary["Omicron"] = "\u039F"
unicode_dictionary["Pi"] = "\u03A0"
unicode_dictionary["Rho"] = "\u03A1"
unicode_dictionary["Sigma"] = "\u03A3"
unicode_dictionary["Tau"] = "\u03A4"
unicode_dictionary["Upsilon"] = "\u03A5"
unicode_dictionary["Phi"] = "\u03A6"
unicode_dictionary["Chi"] = "\u03A7"
unicode_dictionary["Psi"] = "\u03A8"
unicode_dictionary["Omega"] = "\u03A9"
unicode_dictionary["alpha"] = "\u03B1"
unicode_dictionary["beta"] = "\u03B2"
unicode_dictionary["gamma"] = "\u03B3"
unicode_dictionary["delta"] = "\u03B4"
unicode_dictionary["epsilon"] = "\u03B5"
unicode_dictionary["zeta"] = "\u03B6"
unicode_dictionary["eta"] = "\u03B7"
unicode_dictionary["theta"] = "\u03B8"
unicode_dictionary["iota"] = "\u03B9"
unicode_dictionary["kappa"] = "\u03BA"
unicode_dictionary["lamda"] = "\u03BB"
unicode_dictionary["mu"] = "\u03BC"
unicode_dictionary["nu"] = "\u03BD"
unicode_dictionary["xi"] = "\u03BE"
unicode_dictionary["omicron"] = "\u03BF"
unicode_dictionary["pi"] = "\u03C0"
unicode_dictionary["rho"] = "\u03C1"
unicode_dictionary["sigma"] = "\u03C3"
unicode_dictionary["tau"] = "\u03C4"
unicode_dictionary["upsilon"] = "\u03C5"
unicode_dictionary["phi"] = "\u03C6"
unicode_dictionary["chi"] = "\u03C7"
unicode_dictionary["psi"] = "\u03C8"
unicode_dictionary["omega"] = "\u03C9"
2 changes: 1 addition & 1 deletion examples/heal.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# create original arrays
x = np.linspace(-3, 3, 31)[:, None]
y = np.linspace(-3, 3, 31)[None, :]
arr = np.exp(-1 * (x ** 2 + y ** 2))
arr = np.exp(-1 * (x**2 + y**2))
# create damaged array
arr2 = arr.copy()
np.random.seed(11) # set seed for reproducibility
Expand Down
2 changes: 1 addition & 1 deletion tests/data/heal.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def test_heal_gauss():
# create original arrays
x = np.linspace(-3, 3, 31)[:, None]
y = np.linspace(-3, 3, 31)[None, :]
arr = np.exp(-1 * (x ** 2 + y ** 2))
arr = np.exp(-1 * (x**2 + y**2))
# create damaged array
arr2 = arr.copy()
np.random.seed(11) # set seed for reproducibility
Expand Down
2 changes: 1 addition & 1 deletion tests/data/join.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def test_2D_to_3D_overlap():
y = np.linspace(-1, 1, 11)
z = np.arange(1, 10)

ch1 = lambda x, y, z: 5 * (x / 2.5) ** 2 + y ** 2 + (z / 10) ** 2
ch1 = lambda x, y, z: 5 * (x / 2.5) ** 2 + y**2 + (z / 10) ** 2
ch2 = lambda x, y, z: 4 * np.exp(-x / 10) - 3 * y + z
ch3 = lambda x, y, z: 5 + np.cos(x) - np.sin(z + y)

Expand Down
4 changes: 2 additions & 2 deletions tests/data/trim.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def test_trim_2Dgauss():
# create original arrays
x = np.linspace(-3, 3, 31)[:, None]
y = np.linspace(-3, 3, 31)[None, :]
arr = np.exp(-1 * (x ** 2 + y ** 2))
arr = np.exp(-1 * (x**2 + y**2))
# create damaged array
arr2 = arr.copy()
np.random.seed(11) # set seed for reproducibility
Expand Down Expand Up @@ -56,7 +56,7 @@ def test_trim_3Dgauss():
x = np.linspace(-3, 3, 31)[:, None, None]
y = np.linspace(-3, 3, 31)[None, :, None]
z = np.linspace(-3, 3, 31)[None, None, :]
arr = np.exp(-1 * (x ** 2 + y ** 2 + z ** 2))
arr = np.exp(-1 * (x**2 + y**2 + z**2))
# create damaged array
arr2 = arr.copy()
np.random.seed(11) # set seed for reproducibility
Expand Down
12 changes: 6 additions & 6 deletions tests/dataset/ipow.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_d1_d2():
value = random.randint(0, 5)
original_max = data.ai0.max()
data.ai0 **= value
assert data.ai0.max() == original_max ** value
assert data.ai0.max() == original_max**value
data.close()


Expand All @@ -31,7 +31,7 @@ def test_d1_d2_array():
value = np.random.randint(0, 5, data.shape)
original = data.ai0[:]
data.ai0 **= value
assert np.array_equal(data.ai0, original ** value)
assert np.array_equal(data.ai0, original**value)
data.close()


Expand All @@ -41,7 +41,7 @@ def test_w1():
value = random.randint(0, 5)
original_max = data.signal.max()
data.signal **= value
assert data.signal.max() == original_max ** value
assert data.signal.max() == original_max**value
data.close()


Expand All @@ -51,7 +51,7 @@ def test_w1_array():
value = np.random.randint(0, 5, data.shape)
original = data.signal[:]
data.signal **= value
assert np.array_equal(data.signal, original ** value)
assert np.array_equal(data.signal, original**value)
data.close()


Expand All @@ -61,7 +61,7 @@ def test_w1_wa():
value = random.randint(0, 5)
original_max = data.array_signal.max()
data.array_signal **= value
assert data.array_signal.max() == original_max ** value
assert data.array_signal.max() == original_max**value
data.close()


Expand All @@ -71,7 +71,7 @@ def test_w1_wa_array():
value = np.random.randint(0, 5, data.shape)
original = data.array_signal[:]
data.array_signal **= value
assert np.array_equal(data.array_signal, original ** value)
assert np.array_equal(data.array_signal, original**value)
data.close()


Expand Down

0 comments on commit a2e2f0b

Please sign in to comment.