ConstantDensitySphere#
- class agabpylib.simulation.starclusters.spacedistributions.ConstantDensitySphere(r)#
Bases:
SpaceDistribution
Constant space density distribution.
The cluster is assumed to be spherical with a given radius.
- radius#
Radius of the cluster in pc.
- Type:
astropy.units.Quantity
Methods Summary
addinfo
()- returns:
info -- String with specific information about the space distribution.
generate_positions
(n, rng)Generate the positions of the stars randomly according to the prescribed space distribution.
getmeta
()- returns:
meta -- Metadata on the space distribution of the cluster stars.
Methods Documentation
- addinfo()#
- Returns:
info – String with specific information about the space distribution.
- Return type:
str
- generate_positions(n, rng)#
Generate the positions of the stars randomly according to the prescribed space distribution.
- Parameters:
n (int) – Number of star positions to generate.
rng (numpy.random.Generator) – Random number generator. This is provided separately to enable user control over the random number sequence.
- Returns:
x, y, z – The x, y, z positions of the stars in units of pc.
- Return type:
astropy.units.Quantity arrays
- getmeta()#
- Returns:
meta – Metadata on the space distribution of the cluster stars.
- Return type:
dict