Skip to content

Commit

Permalink
Remove degree units check
Browse files Browse the repository at this point in the history
  • Loading branch information
domna committed Apr 4, 2024
1 parent fb70a8f commit e5fa444
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions arpes/endstations/plugin/nexus.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import h5py
import numpy as np
import xarray as xr
from pint import DimensionalityError, Quantity
from pint import Quantity

from arpes.config import ureg
from arpes.endstations import SingleFileEndstation, add_endstation
Expand All @@ -30,10 +30,6 @@
}


class IncompatibleUnitsError(Exception):
pass


class NeXusEndstation(SingleFileEndstation):
"""An endstation for reading arpes data from a nexus file."""

Expand Down Expand Up @@ -135,15 +131,9 @@ def load_nx_data(nxdata: h5py.Group, attributes: dict) -> xr.DataArray:

coords = {}
for axis, new_axis in zip(axes, new_axes):
if "units" not in nxdata[axis].attrs:
raise IncompatibleUnitsError(f"Axis {axis} does not have units.")
coords[new_axis] = nxdata[axis][:] * ureg(nxdata[axis].attrs["units"])
try:
if coords[new_axis].units == "degree":
coords[new_axis] = coords[new_axis].to(ureg.rad)
except DimensionalityError as exc:
raise IncompatibleUnitsError(
f"Unit {coords[new_axis].units} of axis {axis} is not a unit of angle."
) from exc
data = nxdata[nxdata.attrs["signal"]][:]
dims = new_axes

Expand Down

0 comments on commit e5fa444

Please sign in to comment.