Sampling (sample)¶
The sample module contains the main functions for sampling binary systems.
Initial binary tables¶
InitialBinaryTable
Classes¶
InitialCMCTable
Classes¶
|
Independent sampler¶
independent
Functions¶
|
Generates an initial binary sample according to user specified models |
Classes¶
|
Multidimensional sampler¶
multidim
Functions¶
|
adapted version of Maxwell Moe's IDL code that generates a population of single and binary stars |
Classes¶
|
CMC related functions¶
cmc
Functions¶
|
Generates an initial cluster sample according to user specified models |
Classes¶
Elson
Functions¶
|
Compute the mass enclosed in an Elson profile at radius r with slope gamma, central concentration rho_0, and assumed scale factor a = 1 |
|
Compute the gravitational potential of an Elson profile at radius r with slope gamma, central concentration rho_0, and assumed scale factor a = 1 |
|
Compute the density of the Elson profile at radius r Best to use the same normalized rho_0 from M_enclosed |
|
Virial radius is best calculated directly, since rmax may be pretty far from infinity. |
|
This is a little tricky: because the virial radius of the Elson profile depends on the maximum radius, if the profile is very flat (e.g. gamma~2) then you need a large maximum radius to get a large number of virial radius in there. |
|
Find the 1D velocity dispersion at a given radius r using one of the spherial Jeans equations (and assuming velocity is isotropic) |
|
This one's easy: the mass enclosed function is just the CDF of the mass density, so just invert that, and you've got positions. |
|
The correct way to generate velocities: generate the distribution function from rho, then use rejection sampling. |
|
The correct way to generate velocities |
|
Uses the spherical Jeans functions to sample the velocity dispersion for the cluster at different radii, then draws a random, isotropic velocity for each star |
|
Scale the positions and velocities to be in N-body units If we add binaries we'll do this again in initialcmctable.py |
|
Draw random velocities and positions from the Elson profile. |
King
Functions¶
|
Returns the density (unnormalized) given w = psi/sigma^2 Note that w(0) = w_0, the main parameter of a King profile |
|
Integrate a King Profile of a given w_0 until the density (or phi/sigma^2) drops below tidal_boundary limit (1e-8 times the central density by default) |
|
Virial radius is best calculated directly. |
|
Find the 1D velocity dispersion at a given radius r using one of the spherial Jeans equations (and assuming velocity is isotropic) |
|
This one's easy: the mass enclosed function is just the CDF of the mass density, so just invert that, and you've got positions. |
|
The correct way to generate velocities: start from the distribution function and use rejection sampling. |
|
Scale the positions and velocities to be in N-body units If we add binaries we'll do this again in initialcmctable.py |
|
Draw random velocities and positions from the King profile. |