Adding a type to MapAxis based on its unit
@@ -355,6 +355,14 @@ class MapAxis(object):
self._node_type = node_type
self._unit = u.Unit('' if unit is None else unit)
+ # Set axis type from its unit
+ if self._unit.is_equivalent("eV"):
+ self._type = 'energy'
+ elif self._unit.is_equivalent("s"):
+ self._type = 'time'
+ else:
+ self._type = 'any'
+
# Set pixel coordinate of first node
if node_type == 'edge':
self._pix_offset = -0.5
@@ -417,6 +425,11 @@ class MapAxis(object):
"""Return coordinate axis unit."""
return self._unit
+ @property
+ def type(self):
+ """Return coordinate axis type."""
+ return self._type
+
@classmethod
def from_bounds(cls, lo_bnd, hi_bnd, nbin, **kwargs):
"""Generate an axis object from a lower/upper bound and number of bins.
