DimensionlessUnitSystem

class gala.units.DimensionlessUnitSystem[source]

Bases: gala.units.UnitSystem

Methods Summary

decompose(self, q)

A thin wrapper around astropy.units.Quantity.decompose() that knows how to handle Quantities with physical types with non-default representations.

get_constant(self, name)

Retrieve a constant with specified name in this unit system.

to_dict(self)

Return a dictionary representation of the unit system with keys set by the physical types and values set by the unit objects.

Methods Documentation

decompose(self, q)

A thin wrapper around astropy.units.Quantity.decompose() that knows how to handle Quantities with physical types with non-default representations.

Parameters
qQuantity

An instance of an astropy Quantity object.

Returns
qQuantity

A new quantity, decomposed to represented in this unit system.

get_constant(self, name)[source]

Retrieve a constant with specified name in this unit system.

Parameters
namestr

The name of the constant, e.g., G.

Returns
constfloat

The value of the constant represented in this unit system.

Examples

>>> usys = UnitSystem(u.kpc, u.Myr, u.radian, u.Msun)
>>> usys.get_constant('c')
306.6013937879527
to_dict(self)[source]

Return a dictionary representation of the unit system with keys set by the physical types and values set by the unit objects.