asgardpy.base.geom module

Classes containing the Geometry config parameters for the high-level interface and also some functions to support creating the base Geometry of various DL4 datasets.

pydantic model asgardpy.base.geom.EnergyAxisConfig[source]

Bases: BaseConfig

Config section for getting main information for creating an Energy type MapAxis object.

Fields:
field max: Annotated[str | Quantity] = <Quantity 1. TeV>
Constraints:
  • func = <function <lambda> at 0x7f5167d95ee0>

  • json_schema_input_type = PydanticUndefined

  • return_type = <class ‘str’>

  • when_used = json-unless-none

field min: Annotated[str | Quantity] = <Quantity 1. GeV>
Constraints:
  • func = <function <lambda> at 0x7f5167d95ee0>

  • json_schema_input_type = PydanticUndefined

  • return_type = <class ‘str’>

  • when_used = json-unless-none

field nbins: int = 5
field per_decade: bool = True
pydantic model asgardpy.base.geom.GeomConfig[source]

Bases: BaseConfig

Config section for getting main information for creating a base Geometry.

Fields:
field axes: list[MapAxesConfig] = [MapAxesConfig(name='energy', axis=EnergyAxisConfig(min=<Quantity 1. GeV>, max=<Quantity 1. TeV>, nbins=5, per_decade=True), axis_custom=EnergyEdgesCustomConfig(edges=[], unit='TeV'))]
field from_events_file: bool = True
field reco_psf: bool = False
field selection: SelectionConfig = SelectionConfig(offset_max=<Quantity 2.5 deg>)
field wcs: WcsConfig = WcsConfig(skydir=SkyPositionConfig(frame='icrs', lon=<Quantity 0. deg>, lat=<Quantity 0. deg>, radius=<Quantity 0. deg>), binsize=<Quantity 0.1 deg>, proj='TAN', map_frame_shape=MapFrameShapeConfig(width=<Quantity 5. deg>, height=<Quantity 5. deg>), binsize_irf=<Quantity 0.2 deg>)
pydantic model asgardpy.base.geom.MapAxesConfig[source]

Bases: BaseConfig

Config section for getting main information for creating a MapAxis object.

Fields:
field axis: EnergyAxisConfig = EnergyAxisConfig(min=<Quantity 1. GeV>, max=<Quantity 1. TeV>, nbins=5, per_decade=True)
field axis_custom: EnergyEdgesCustomConfig = EnergyEdgesCustomConfig(edges=[], unit='TeV')
field name: str = 'energy'
pydantic model asgardpy.base.geom.SkyPositionConfig[source]

Bases: BaseConfig

Config section for getting main information for creating a SkyCoord object.

Fields:
field frame: FrameEnum = FrameEnum.icrs
field lat: Annotated[str | Quantity] = <Quantity 0. deg>
Constraints:
  • func = <function <lambda> at 0x7f5167d95da0>

  • json_schema_input_type = PydanticUndefined

  • return_type = <class ‘str’>

  • when_used = json-unless-none

field lon: Annotated[str | Quantity] = <Quantity 0. deg>
Constraints:
  • func = <function <lambda> at 0x7f5167d95da0>

  • json_schema_input_type = PydanticUndefined

  • return_type = <class ‘str’>

  • when_used = json-unless-none

field radius: Annotated[str | Quantity] = <Quantity 0. deg>
Constraints:
  • func = <function <lambda> at 0x7f5167d95da0>

  • json_schema_input_type = PydanticUndefined

  • return_type = <class ‘str’>

  • when_used = json-unless-none

pydantic model asgardpy.base.geom.WcsConfig[source]

Bases: BaseConfig

Config section for getting main sky projection information for creating a base Geometry.

Fields:
field binsize: Annotated[str | Quantity] = <Quantity 0.1 deg>
Constraints:
  • func = <function <lambda> at 0x7f5167d95da0>

  • json_schema_input_type = PydanticUndefined

  • return_type = <class ‘str’>

  • when_used = json-unless-none

field binsize_irf: Annotated[str | Quantity] = <Quantity 0.2 deg>
Constraints:
  • func = <function <lambda> at 0x7f5167d95da0>

  • json_schema_input_type = PydanticUndefined

  • return_type = <class ‘str’>

  • when_used = json-unless-none

field map_frame_shape: MapFrameShapeConfig = MapFrameShapeConfig(width=<Quantity 5. deg>, height=<Quantity 5. deg>)
field proj: ProjectionEnum = ProjectionEnum.tan
field skydir: SkyPositionConfig = SkyPositionConfig(frame='icrs', lon=<Quantity 0. deg>, lat=<Quantity 0. deg>, radius=<Quantity 0. deg>)
asgardpy.base.geom.create_counts_map(geom_config, center_pos)[source]

Generate the counts Map object using the information provided in the geom section of the Config and the dict information on the position and Counts Map size of the target source. Used currently only for Fermi-LAT DL3 files.

Parameters:
  • geom_config (asgardpy.base.geom.GeomConfig) – Config information on creating the Base Geometry of the DL4 dataset.

  • center_pos (dict) – Dict information on the central astropy.coordinates.SkyCoord position and astropy.units.Quantity angular radius.

Returns:

counts_map – Map object of the Counts information.

Return type:

gammapy.maps.Map

asgardpy.base.geom.generate_geom(tag, geom_config, center_pos)[source]

Generate from a given target source position, the geometry of the ON events and the axes information on reco energy and true energy, for which a DL4 dataset of a given tag, can be defined.

Can also generate Base geometry for the excluded regions for a 3D dataset.

Parameters:
  • tag (str) – Determining either the {1, 3}d Dataset type of “excluded”, for creating base geometry for the excluded regions.

  • geom_config (asgardpy.base.geom.GeomConfig) – Config information on creating the Base Geometry of the DL4 dataset.

  • center_pos (dict) – Dict information on the central astropy.coordinates.SkyCoord position and astropy.units.Quantity angular radius.

Returns:

geom – appropriate Base geometry objects for {1, 3}D type of DL4 Datasets.

Return type:

‘gammapy.maps.RegionGeom’ or gammapy.maps.WcsGeom

asgardpy.base.geom.get_energy_axis(axes_config, only_edges=False, custom_range=False)[source]

Read from a MapAxesConfig section to return the required energy axis/range.

Parameters:
  • axes_config (asgardpy.base.geom.MapAxesConfig) – COnfig for generating an energy axis

  • only_edges (bool) – If True, only return an array of energy edges

  • custom_range (bool) – If True, use the given list of energy edges and energy unit.

Returns:

energy_range – Energy Axis formed from the given config parameters

Return type:

gammapy.maps.MapAxis

asgardpy.base.geom.get_source_position(target_region, fits_header=None)[source]

Function to fetch the target source position and the angular radius for the generating the Counts Map or ON region.

Parameters:
  • target_region (asgardpy.data.geom.SkyPositionConfig) – Config containing the information on the target source position

  • fits_header (astropy.io.fits.Header) – FITS Header information of the events fits file, only for Fermi-LAT DL3 files. If None is passed, the information is collected from the config_target.

Returns:

center_pos – Dict information on the central astropy.coordinates.SkyCoord position and astropy.units.Quantity angular radius.

Return type:

dict