check_if_unit_is_per_solid_angle#

jdaviz.core.unit_conversion_utils.check_if_unit_is_per_solid_angle(unit, return_unit=False)[source]#

Check if a given Unit or unit string (that can be converted to a Unit) represents some unit per solid angle. If ‘return_unit’ is True, then a Unit of the solid angle will be returned (or None if no solid angle is present in the denominator).

Parameters:
unitstr or u.Unit

u.Unit object or string representation of unit.

return_unitbool

If True, the u.Unit of the solid angle unit will be returned (or None if unit is not a solid angle).

Returns:
resultUnit, bool, or None

See explanation in return_unit.

Raises:
ValueError

Invalid input.

Examples

>>> check_if_unit_is_per_solid_angle('erg / (s cm^2 sr)')
True
>>> check_if_unit_is_per_solid_angle('erg / s cm^2')
False
>>> check_if_unit_is_per_solid_angle('Jy * sr^-1')
True