MapCoord¶
-
class
gammapy.maps.
MapCoord
(data, coordsys=None, match_by_name=True)[source]¶ Bases:
object
Represents a sequence of n-dimensional map coordinates.
Contains coordinates for 2 spatial dimensions and an arbitrary number of additional non-spatial dimensions.
For further information see MapCoord.
- Parameters
- data
dict
ofndarray
Dictionary of coordinate arrays.
- coordsys{‘CEL’, ‘GAL’, None}
Spatial coordinate system. If None then the coordinate system will be set to the native coordinate system of the geometry.
- match_by_namebool
Match coordinates to axes by name? If false coordinates will be matched by index.
- data
Attributes Summary
Coordinate system (str).
Latitude coordinate in degrees.
Longitude coordinate in degrees.
Boolean flag: axis lookup by name (True) or index (False).
Number of dimensions.
Phi longitude angle in radians.
Coordinate array shape.
Theta co-latitude angle in radians.
Methods Summary
apply_mask
(self, mask)Return a masked copy of this coordinate object.
copy
(self)Copy
MapCoord
object.create
(data[, coordsys])Create a new
MapCoord
object.to_coordsys
(self, coordsys)Convert to a different coordinate frame.
Attributes Documentation
-
coordsys
¶ Coordinate system (str).
-
lat
¶ Latitude coordinate in degrees.
-
lon
¶ Longitude coordinate in degrees.
-
match_by_name
¶ Boolean flag: axis lookup by name (True) or index (False).
-
ndim
¶ Number of dimensions.
-
phi
¶ Phi longitude angle in radians.
-
shape
¶ Coordinate array shape.
-
size
¶
-
skycoord
¶
-
theta
¶ Theta co-latitude angle in radians.
Methods Documentation
-
classmethod
create
(data, coordsys=None)[source]¶ Create a new
MapCoord
object.This method can be used to create either unnamed (with tuple input) or named (via dict input) axes.
- Parameters
Examples
>>> from astropy.coordinates import SkyCoord >>> from gammapy.maps import MapCoord
>>> lon, lat = [1, 2], [2, 3] >>> skycoord = SkyCoord(lon, lat, unit='deg') >>> energy = [1000] >>> c = MapCoord.create((lon,lat)) >>> c = MapCoord.create((skycoord,)) >>> c = MapCoord.create((lon,lat,energy)) >>> c = MapCoord.create(dict(lon=lon,lat=lat)) >>> c = MapCoord.create(dict(lon=lon,lat=lat,energy=energy)) >>> c = MapCoord.create(dict(skycoord=skycoord,energy=energy))