standardise_unit

gammapy.utils.units.standardise_unit(unit)[source]

Standardise unit.

Changes applied by this function:

  • Drop “photon” == “ph” from the unit
  • Drop “count” == “ct” from the unit
Parameters:
unit : Unit or str

Any old unit

Returns:
unit : Unit

Shiny new, standardised unit

Examples

>>> from gammapy.utils.units import standardise_unit
>>> standardise_unit('ph cm-2 s-1')
Unit("1 / (cm2 s)")
>>> standardise_unit('ct cm-2 s-1')
Unit("1 / (cm2 s)")
>>> standardise_unit('cm-2 s-1')
Unit("1 / (cm2 s)")