From b4b5cf610b46e1194ea3c56437f9a0db8f1b84e0 Mon Sep 17 00:00:00 2001 From: Adrian Price-Whelan Date: Tue, 5 Dec 2023 16:30:40 -0500 Subject: [PATCH] fix make_getter move in astropy 6 --- gala/dynamics/representation_nd.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/gala/dynamics/representation_nd.py b/gala/dynamics/representation_nd.py index d7e4f8588..ec539d638 100644 --- a/gala/dynamics/representation_nd.py +++ b/gala/dynamics/representation_nd.py @@ -8,6 +8,12 @@ __all__ = ['NDCartesianRepresentation', 'NDCartesianDifferential'] +# TODO: Remove when astropy min version >=v6.0 +try: + _make_getter = coord.representation._make_getter +except AttributeError: + _make_getter = coord.representation.base._make_getter + class NDMixin(object): @@ -95,8 +101,9 @@ def __init__(self, x, differentials=None, unit=None, copy=True): if not hasattr(cls, name): setattr(cls, name, property( - coord.representation._make_getter(name), - doc=(f"The '{name}' component of the points(s)."))) + _make_getter(name), + doc=(f"The '{name}' component of the points(s).")) + ) def get_xyz(self, xyz_axis=0): """Return a vector array of the x, y, and z coordinates. @@ -181,7 +188,7 @@ def __init__(self, d_x, unit=None, copy=True): cls = self.__class__ if not hasattr(cls, name): setattr(cls, name, - property(coord.representation._make_getter(name), + property(_make_getter(name), doc=("The '{0}' component of the points(s)." .format(name))))