Skip to content

Commit

Permalink
💬 Update type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
arafune committed Mar 19, 2024
1 parent 2dbaa86 commit 39c0769
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 11 deletions.
35 changes: 32 additions & 3 deletions src/arpes/deep_learning/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,44 @@ class Identity:
"""Represents a reversible identity transform."""

def encodes(self, x: Incomplete) -> Incomplete:
"""[TODO:summary].
Args:
x: [TODO:description]
Returns:
[TODO:description]
"""
return x

def __call__(self, x: Incomplete) -> Incomplete:
"""[TODO:summary].
Args:
x: [TODO:description]
Returns:
[TODO:description]
"""
return x

def decodes(self, x: Incomplete) -> Incomplete:
"""[TODO:summary].
Args:
x: [TODO:description]
Returns:
[TODO:description]
"""
return x

def __repr__(self) -> str:
"""[TODO:summary].
Returns:
[TODO:description]
"""
return "Identity()"


Expand Down Expand Up @@ -54,9 +83,9 @@ def __post_init__(self) -> None:
for t in self.transforms:
if isinstance(t, tuple | list):
xt, yt = t
t = [xt or _identity, yt or _identity]

safe_transforms.append(t)
safe_transforms.append([xt or _identity, yt or _identity])
else:
safe_transforms.append(t)

self.original_transforms = self.transforms
self.transforms = safe_transforms
Expand Down
11 changes: 4 additions & 7 deletions src/arpes/plotting/spin.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,9 @@ def spin_polarized_spectrum( # noqa: PLR0913
counts = spin_dr
pol = to_intensity_polarization(counts)

ax_left = ax[0]
ax_right = ax[1]
ax_left, ax_right = ax[0], ax[1]

up = counts.down.data
down = counts.up.data
down, up = counts.down.data, counts.up.data

energies = spin_dr.coords["eV"].values
min_e, max_e = np.min(energies), np.max(energies)
Expand All @@ -194,8 +192,7 @@ def spin_polarized_spectrum( # noqa: PLR0913
ax_left.set_xlabel(r"\textbf{Kinetic energy} (eV)")
ax_left.set_xlim(min_e, max_e)

max_up = np.max(up)
max_down = np.max(down)
max_up, max_down = np.max(up), np.max(down)
ax_left.set_ylim(0, max(max_down, max_up) * 1.2)

# Plot the polarization and associated statistical error bars
Expand Down Expand Up @@ -296,7 +293,7 @@ def hue_brightness_plot(
assert isinstance(ax, Axes)
assert isinstance(fig, Figure)
x, y = data.coords[data.intensity.dims[0]].values, data.coords[data.intensity.dims[1]].values
extent = [y[0], y[-1], x[0], x[-1]]
extent = (y[0], y[-1], x[0], x[-1])
ax.imshow(
polarization_intensity_to_color(data, **kwargs),
extent=extent,
Expand Down
2 changes: 1 addition & 1 deletion src/arpes/utilities/qt/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def set_colormap(self, colormap: Colormap | str) -> None:
if isinstance(view, DataArrayImageView):
view.setColorMap(cmap)

def generate_marginal_for(
def generate_marginal_for( # noqa: PLR0913
self,
dimensions: tuple[int, ...],
column: int,
Expand Down

0 comments on commit 39c0769

Please sign in to comment.