MapCoord¶
-
class
gammapy.maps.MapCoord(data, coordsys=None, copy=False, match_by_name=True)[source]¶ Bases:
objectRepresents 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 :
OrderedDictofndarrayDictionary 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.
copy : bool
Make copies of the input arrays. If False then this object will store views.
match_by_name : bool
Match coordinates to axes by name. If false coordinates will be matched by index.
Attributes Summary
coordsysCoordinate system (str) latLatitude coordinate in degrees. lonLongitude coordinate in degrees. match_by_nameBoolean flag indicating whether axis lookup should be performed by name (True) or index (False). ndimNumber of dimensions. shapeCoordinate array shape. sizeskycoordMethods Summary
apply_mask(mask)Return a masked copy of this coordinate object. create(data[, coordsys, copy])Create a new MapCoordobject.to_coordsys(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 indicating whether axis lookup should be performed by name (True) or index (False).
-
ndim¶ Number of dimensions.
-
shape¶ Coordinate array shape.
-
size¶
-
skycoord¶
Methods Documentation
-
apply_mask(mask)[source]¶ Return a masked copy of this coordinate object.
Parameters: mask :
ndarrayBoolean mask.
Returns: coords :
MapCoordA coordinates object.
-
classmethod
create(data, coordsys=None, copy=False)[source]¶ Create a new
MapCoordobject. This method can be used to create either unnamed (with tuple input) or named (via dict input) axes.Parameters: data :
tuple,dict, orMapCoordObject containing coordinate arrays.
coordsys : {‘CEL’, ‘GAL’, None}, optional
Set the coordinate system for longitude and latitude. If None longitude and latitude will be assumed to be in the coordinate system native to a given map geometry.
copy : bool
Make copies of the input coordinate arrays. If False this object will store views.
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))
-