Distribution
ocelot.model.distribution.King62
¤
Bases: BaseClusterDistributionModel, Implements3DMethods
r_50
property
¤
Median radius of the cluster (equivalent to half-light and half-mass for this model), in on-sky units.
pdf(x)
¤
Probability density function of the model.
cdf(x)
¤
Cumulative density function of the model.
rvs(size=1, seed=None)
¤
Sample a random variate from the model. Returns an array of shape (n_stars, n_dims), or a single float if size is 1.
__init__(r_core, r_tidal, dimensions=3)
¤
Implementation of the King+1962 [1] empirical star cluster model.
Methods are available in 1D, 2D, and 3D form.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r_core
|
Quantity
|
Core radius of the cluster. Must be defined with astropy units. May be in angular units when dimensions is 1 or 2. |
required |
r_tidal
|
Quantity
|
Tidal radius of the cluster. Must be defined with astropy units. May be in angular units when dimensions is 1 or 2. |
required |
dimensions
|
int
|
Number of dimensions of the model - must be 1, 2, or 3. In 1D mode, radii from the centre of the cluster are returned. In 2D mode, X/Y coordinates to the centre of the cluster are returned. In 3D mode, X/Y/Z coordinates to the centre of the cluster are returned. Angles are not supported in 3D mode. Default: 3 |
3
|
References
[1] https://ui.adsabs.harvard.edu/abs/1962AJ.....67..471K/abstract
ocelot.model.distribution.king62.king_surface_density(radius, r_core, r_tidal, k=1.0, normalize=False)
¤
Compute the King1962 cluster surface density, i.e. the density of stars per unit area in 2D on-sky coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
radius
|
float | ndarray
|
Radius values to compute the surface density at. |
required |
r_core
|
float | ndarray
|
Cluster core radius. Must be positive and less than r_tidal. |
required |
r_tidal
|
float | ndarray
|
Cluster tidal radius. Must be positive and greater than r_core. |
required |
k
|
float | ndarray
|
Normalization constant. Default: 1.0 |
1.0
|
normalize
|
bool
|
Whether or not to return the normalized surface density, turning this into an estimate of the 2D PDF of the cluster on-sky. Default: False |
False
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Surface density values at the requested radius/r_core/r_tidal values. |
ocelot.model.distribution.king62.king_number_density(radius, r_core, r_tidal, k=1, cumulative=False)
¤
Calculates the King1962 number density (Eqn. 18 in the paper.)
Unnormalised by default (i.e. k=1.)
Returns cumulative distribution function for cumulative=True.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
radius
|
float | ndarray
|
Radius values to compute the surface density at. |
required |
r_core
|
float | ndarray
|
Cluster core radius. Must be positive and less than r_tidal. |
required |
r_tidal
|
float | ndarray
|
Cluster tidal radius. Must be positive and greater than r_core. |
required |
k
|
float | ndarray
|
Normalization constant. Default: 1.0 |
1
|
cumulative
|
bool
|
Whether or not to return the cumulative number density. Doing so means that this function will instead estimate the cumulative density function of the King number density. Default: False. |
False
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Number density values at the requested radius/r_core/r_tidal values. If cumulative is True, this will instead be an array of estimates of the CDF of the cluster's number density at a given radius. |
ocelot.model.distribution.king62.king_spatial_density(radius, r_core, r_tidal, k=1)
¤
Returns the spatial (3D) surface density of a King62 cluster distribution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
radius
|
float | ndarray
|
Radii at which to sample the profile. |
required |
r_core
|
float | ndarray
|
Cluster core radius. Must be positive and less than r_tidal. |
required |
r_tidal
|
float | ndarray
|
Cluster tidal radius. Must be positive and greater than r_core. |
required |
k
|
float | ndarray
|
King density parameter. Default: 1 |
1
|
Returns:
| Type | Description |
|---|---|
float | ndarray
|
King spatial surface densities. |
ocelot.model.distribution.king62.sample_2d_king_profile(r_core, r_tidal, n_samples, seed=None, return_generator=False, resolution=500)
¤
Samples a 2D King profile to return n_samples sample radii.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r_core
|
float | ndarray
|
Cluster core radius. Must be positive and less than r_tidal. |
required |
r_tidal
|
float | ndarray
|
Cluster tidal radius. Must be positive and greater than r_core. |
required |
n_samples
|
int
|
Number of samples to return. |
required |
seed
|
None | int | Generator
|
Seed for the random generator, or a np.random.generator to use for sampling. Default: None |
None
|
resolution
|
int
|
Resolution of the internal estimate of the percentile point function of the cluster's number density function. (Wow - that's a mouthful.). Default: 500, which should be high enough to be accurate in all cases. |
500
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Radius samples. |
Notes
To turn these radii into 2D random coordinates, assign each radius a random angle between 0 and 2 pi.
ocelot.model.distribution.king62.sample_3d_king_profile(r_core, r_tidal, n_samples, seed=None)
¤
Sample random star locations in a King1962 model and return them in 3D Cartesian coordinates.
This method uses rejection sampling, and is a bit slower than sampling in 2D. If you only need 2D positions, then it's easier to use sample_2d_king_profile.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r_core
|
float | ndarray
|
Cluster core radius. Must be positive and less than r_tidal. |
required |
r_tidal
|
float | ndarray
|
Cluster tidal radius. Must be positive and greater than r_core. |
required |
n_samples
|
int
|
Number of samples to return. |
required |
seed
|
None | int | Generator
|
Seed for the random generator, or a np.random.generator to use for sampling. Default: None |
None
|
Returns:
| Type | Description |
|---|---|
ndarray
|
An array of cluster location samples with shape (n_samples, 3). |
ocelot.model.distribution.BaseClusterDistributionModel
¤
Bases: ABC
base_unit
abstractmethod
property
¤
Property defining the basic unit of the model. Returned whenever possible.
pdf(x)
¤
Probability density function of the model.
cdf(x)
¤
Cumulative density function of the model.
rvs(size=1, seed=None)
¤
Sample a random variate from the model. Returns an array of shape (n_stars, n_dims), or a single float if size is 1.
ocelot.model.distribution.Implements1DMethods
¤
Bases: ABC
Empty interface that serves as an indicator that the methods of a class implement methods in 1D (i.e. with a single r coordinate.)
ocelot.model.distribution.Implements2DMethods
¤
Bases: ABC
Empty interface that serves as an indicator that the methods of a class implement methods in 1D (i.e. with x,y coordinates.)
ocelot.model.distribution.Implements3DMethods
¤
Bases: ABC
Empty interface that serves as an indicator that the methods of a class implement methods in 1D (i.e. with x,y,z coordinates.)