GAGDET-2 units

Function to convert back and forth between standard units and units used in the \(N\)-body code GADGET-2. You are importing Gadget-2 units. For more information about the unit system have a look at Gadget-2 user manual online. Gadget-2 defines mass(gM), length(gL), and velocity(gV) as fundamental units. Therefore time(gT) is a derived unit. The units are also defined in terms of hubble parameter. This is neglected here for reasons explained in the manual. Remember to the graviational constant(gG) as well, when doing calculations. That is, import gM,gL,gT,gV,gG from this module

unitconvert.gadget.fromGadget(q, finalUnits=None)

Find the conversion factor that is used to convert the given quantity q given in units of \(N\)-body code GAGDGET-2 to SI units

Args :

q (astropy quantity) : the quantity for which unit conversion must be done

finalUnits : optional argument to specify the units to which q must be converted. Defaults to standard astronomical units [kpc, solMass, Gyr] if not specified.

Returns :

(astropy quantity) : the input quantity q in astronomical units or specified units.

Example :
>>> from unitconvert.natural import toGadget
>>> from astropy import units as u
>>> toGadget(0.001*gL)
<Quantity 0.001 kpc>
unitconvert.gadget.toGadget(q)

Find the conversion factor that is used to convert the given quantity q to and from units used in the \(N\)-body code GAGDGET-2 and SI units

Args :

q (astropy quantity) : the quantity for which unit conversion must be done

Returns :

(astropy quantity) : the input quantity q in gadget units

Example :
>>> from unitconvert.natural import toGadget
>>> from astropy import units as u
>>> toGadget(1*u.pc)
<Quantity 0.001 gL>