Bases: object
Dimensional physical unit class
Parameters : | dims : 6-tuple of int
val : float
|
---|
Examples
>>> V_km_s = Unit((1,0,-1,0,0), 1000.0)
>>> print "1.0 km/s = %.1e m/h"%(V_km_s.express(m/hour))
1.0 km/s = 3.6e+06 m/h
Unit conversion method. Gives the conversion factor of this Unit object expressed into another (dimension-compatible) given unit.
Checks that :
Parameters : | unit : Unit object
|
---|---|
Returns : | fact : float
|
Examples
Conversion of a kpc expressed in light-years :
>>> factor = kpc.express(ly)
>>> print "1 kpc = %f ly"%factor
1 kpc = 3261.563163 ly
Conversion of 1 M_{\odot} into kilometers :
>>> print Msun.express(km)
ValueError: Incompatible dimensions between (1.9889e+30 kg) and (1000.0 m)
Print all available constants list:
none, m, cm, km, pc, au, kpc, Mpc, Gpc, kg, g, mH, Msun, s, hour, day, year, Myr, Gyr, N, dyne, K, J, W, erg, eV, G, kB, c, ly, H, rhoc, H_cc, h, sigmaSB, a_R, T, Gauss, uGauss