Skip to content

Commit

Permalink
Merge pull request #588 from scipp/remote-attrs
Browse files Browse the repository at this point in the history
Remove uses of attrs and meta and remove deprecated Mantid functions
  • Loading branch information
jl-wynen authored Jan 17, 2025
2 parents cb602e1 + 80ae9f1 commit 7734ed2
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 792 deletions.
1 change: 0 additions & 1 deletion docs/api-reference/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
:toctree: ../generated/functions
:recursive:
array_from_mantid
from_mantid
load_with_mantid
to_mantid
Expand Down
4 changes: 0 additions & 4 deletions src/scippneutron/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@
from .core import convert
from .mantid import (
from_mantid,
array_from_mantid,
to_mantid,
load_with_mantid,
load,
fit,
)
from .instrument_view import instrument_view
Expand All @@ -59,11 +57,9 @@
"two_theta",
"convert",
"from_mantid",
"array_from_mantid",
"to_mantid",
"io",
"load_with_mantid",
"load",
"fit",
"instrument_view",
"atoms",
Expand Down
28 changes: 0 additions & 28 deletions src/scippneutron/_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
Internal utilities; do not use outside scippneutron!
"""

from collections.abc import MutableMapping

import scipp as sc
from scipp.typing import VariableLike

Expand All @@ -28,29 +26,3 @@ def float_dtype(var: VariableLike) -> sc.DType:

def as_float_type(var: VariableLike, ref: VariableLike) -> VariableLike:
return var.astype(float_dtype(ref), copy=False)


def get_attrs(da: sc.DataArray) -> MutableMapping[str, sc.Variable]:
try:
# During deprecation phase
return da.deprecated_attrs
except AttributeError:
try:
# Before deprecation phase
return da.attrs
except AttributeError:
# After deprecation phase / removal of attrs
return da.coords


def get_meta(da: sc.DataArray) -> MutableMapping[str, sc.Variable]:
try:
# During deprecation phase
return da.deprecated_meta
except AttributeError:
try:
# Before deprecation phase
return da.meta
except AttributeError:
# After deprecation phase / removal of attrs
return da.coords
4 changes: 1 addition & 3 deletions src/scippneutron/instrument_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import scipp as sc
from scipy.spatial.transform import Rotation as Rot

from ._utils import get_meta

try:
import pythreejs as p3
except ImportError as ex:
Expand Down Expand Up @@ -274,7 +272,7 @@ def instrument_view(

import plopp as pp

positions_var = get_meta(scipp_obj)[positions]
positions_var = scipp_obj.coords[positions]
if pixel_size is None:
pos_array = positions_var.values
if len(pos_array) > 1:
Expand Down
Loading

0 comments on commit 7734ed2

Please sign in to comment.