Skip to content

Commit

Permalink
🔨
Browse files Browse the repository at this point in the history
  • Loading branch information
arafune committed Apr 21, 2024
1 parent 41b42a5 commit 9fba92b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/arpes/xarray_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2031,7 +2031,7 @@ def cut_nan_coords(self: Self) -> xr.DataArray:

def reference_plot(
self,
**kwargs: Unpack[LabeledFermiSurfaceParam] | Unpack[PColorMeshKwargs],
**kwargs: Incomplete,
) -> Axes | Path | tuple[Figure, NDArray[np.object_]]:
"""Generates a reference plot for this piece of data according to its spectrum type.
Expand Down Expand Up @@ -2910,13 +2910,14 @@ def first_exceeding( # noqa: PLR0913
data = data / data.max(dim)

cond = data > value
cond_values = cond.values
reindex = data.coords[dim]

if reverse:
reindex = np.flip(reindex)
cond = np.flip(cond, data.dims.index(dim)).values
cond_values = np.flip(cond_values, axis=data.dims.index(dim))

indices = cond.argmax(axis=data.dims.index(dim))
indices = cond_values.argmax(axis=data.dims.index(dim))
if as_index:
new_values = indices
if reverse:
Expand All @@ -2927,7 +2928,7 @@ def first_exceeding( # noqa: PLR0913
with contextlib.suppress(AttributeError):
new_values = new_values.values

return data.isel({dim: 0}).S.rith_values(new_values)
return data.isel({dim: 0}).S.with_values(new_values)

def last_exceeding(self, dim: str, value: float, *, relative: bool = False) -> xr.DataArray:
return self.first_exceeding(dim, value, relative=relative, reverse=False)
Expand Down

0 comments on commit 9fba92b

Please sign in to comment.