Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/arpes/analysis/derivative.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def warpped_filter(arr: xr.DataArray):
"""
assert isinstance(arr, xr.DataArray)
assert alpha > 0
dim = dim if dim else str(arr.dims[0])
dim = dim or str(arr.dims[0])
smooth_ = _nothing_to_array if smooth_fn is None else smooth_fn
arr = smooth_(arr)
d_arr = arr.differentiate(dim)
Expand Down Expand Up @@ -301,7 +301,7 @@ def warpped_filter(arr: xr.DataArray):
The nth derivative data.
"""
assert isinstance(arr, xr.DataArray)
dim = dim if dim else str(arr.dims[0])
dim = dim or str(arr.dims[0])
smooth_ = _nothing_to_array if smooth_fn is None else smooth_fn
dn_arr = smooth_(arr)
for _ in range(order):
Expand Down
2 changes: 1 addition & 1 deletion src/arpes/analysis/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def savitzky_golay_filter( # noqa: PLR0913
"""
data = data if isinstance(data, xr.DataArray) else normalize_to_spectrum(data)
axis = data.dims.index(dim) if dim else -1
dim = dim if dim else data.dims[0]
dim = dim or data.dims[0]
coords_diffs = np.diff(data.coords[dim])
assert np.allclose(coords_diffs, coords_diffs[0], rtol=1e-5, atol=1e-6), (
f"The coordinates must be equally spaced. Consider to use interpolation. f{coords_diffs}"
Expand Down
4 changes: 1 addition & 3 deletions src/arpes/analysis/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,7 @@ def normalize_by_fermi_distribution(
assert isinstance(distrib, np.ndarray)
# don't boost by more than 90th percentile of input, by default
max_gain = (
max_gain
if max_gain
else min(
max_gain or min(
float(np.mean(data.values, dtype=np.float64)),
float(np.percentile(data.values, 10)),
)
Expand Down
2 changes: 1 addition & 1 deletion src/arpes/configuration/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def __init__(self, workspace_name: str = "") -> None:
self.workspace_name = workspace_name
self._active = bool(workspace_name)

def __enter__(self) -> "WorkspaceManager":
def __enter__(self) -> "WorkspaceManager": # noqa: PYI034
"""Enter the runtime context for the WorkspaceManager.

Returns:
Expand Down
4 changes: 2 additions & 2 deletions src/arpes/plotting/ui/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ def image_with_pointer(
data = fix_xarray_to_fit_with_holoview(data)
max_coords = data.G.argmax_coords()

posx = posx if posx else PointerX(x=max_coords[data.dims[0]])
posy = posy if posy else PointerY(y=max_coords[data.dims[1]])
posx = posx or PointerX(x=max_coords[data.dims[0]])
posy = posy or PointerY(y=max_coords[data.dims[1]])

assert isinstance(posx, PointerX)
assert isinstance(posy, PointerY)
Expand Down
4 changes: 2 additions & 2 deletions src/arpes/plotting/ui/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ def profile_view(
kwargs.setdefault("profile_view_height", 100)

max_coords = data.G.argmax_coords()
posx = posx if posx else PointerX(x=max_coords[data.dims[0]])
posy = posy if posy else PointerY(y=max_coords[data.dims[1]])
posx = posx or PointerX(x=max_coords[data.dims[0]])
posy = posy or PointerY(y=max_coords[data.dims[1]])

plot_lim = get_plot_lim(data, log=kwargs["log"])

Expand Down
4 changes: 2 additions & 2 deletions src/arpes/xarray_extensions/accessor/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def enumerate_iter_coords(
which shows the relationship between pixel position and physical (like "eV" and "phi").
"""
assert isinstance(self._obj, xr.DataArray | xr.Dataset)
dim_names = dim_names if dim_names else tuple(self._obj.dims)
dim_names = dim_names or tuple(self._obj.dims)
dim_names = [dim_names] if isinstance(dim_names, str) else dim_names
coords_list = [self._obj.coords[d].values for d in dim_names]
for indices in itertools.product(*[range(len(c)) for c in coords_list]):
Expand All @@ -302,7 +302,7 @@ def iter_coords(
Iterator of the physical position like ("eV" and "phi")
{'phi': -0.2178031280148764, 'eV': 9.002}
"""
dim_names = dim_names if dim_names else tuple(self._obj.dims)
dim_names = dim_names or tuple(self._obj.dims)
dim_names = [dim_names] if isinstance(dim_names, str) else dim_names
the_iterator: Iterator = itertools.product(*[self._obj.coords[d].values for d in dim_names])
the_iterator = always_reversible(the_iterator) if reverse else the_iterator
Expand Down
2 changes: 1 addition & 1 deletion src/arpes/xarray_extensions/accessor/property.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def energy_notation(self) -> EnergyNotation:
if notation.lower() in final_notations:
self._obj.attrs["energy_notation"] = "Final"
return EnergyNotation.FINAL
if notation.lower() in {"binding"}:
if notation.lower() == "binding":
self._obj.attrs["energy_notation"] = "Binding"
return EnergyNotation.BINDING
msg = f"Invalid energy notation found: {notation!r}"
Expand Down
Loading