MakeSphericalMassEnclModel

class amuse_util.ic.invcdf.MakeSphericalMassEnclModel(number_of_particles: int, encl_mass_func: function, vel_potential, convert_nbody=None, radius_cutoff: unit<kpc> = quantity<100 kpc>, do_scale: bool = False, _vel_adj: float = 1.0, random_state=None, random=None)[source]

Bases: object

Make Mass Model from Enclosed Mass Function.

References

https://github.com/peterewills/itsample/blob/master/itsample.py https://codereview.stackexchange.com/questions/196286/inverse-transform-sampling https://usmanwardag.github.io/python/astronomy/2016/07/10/inverse-transform-sampling-with-python.html https://en.wikipedia.org/wiki/Inverse_transform_sampling

Instantiate spatial / velocity distribution from enclosed mass.

Parameters
number_of_particles: int
encl_mass_func:

signature:: encl_mass_func(R)

vel_potential: amuse potential

potential from which to sample for the velocities signature:: vel_potential(position)

Attributes Summary

result

Result.

Methods Summary

calculate_radius_invcdf_distribution(self)

Calculate Radius from Inverted CDF sampling.

coordinates_from_spherical(self, radius, …)

Convert Coordinates to Cartesian from Spherical Coords.

new_model(self)

Make New Model.

new_positions_spherical_coordinates(self)

Create positions in spherical coordinates.

new_velocities_spherical_coordinates(self, …)

Create velocities in spherical coordinates.

Attributes Documentation

result

Result.

Returns
result: Particles

Particles datamodel

Methods Documentation

calculate_radius_invcdf_distribution(self)[source]

Calculate Radius from Inverted CDF sampling.

Returns
rs: ndarray

radii for spatial distribution units of kpc

Notes

calls encl_mass_func(R), where R has units, and returns units

coordinates_from_spherical(self, radius: unit<kpc>, theta, phi)[source]

Convert Coordinates to Cartesian from Spherical Coords.

Returns
x, y, z: distance quantity ndarray

units from radius

new_model(self)[source]

Make New Model.

Returns
m: ndarray

masses

position: ndarray
velocity: ndarray
new_positions_spherical_coordinates(self)[source]

Create positions in spherical coordinates.

Returns
radius: distance quantity array
theta, phi: ndarray

units of radiuas

new_velocities_spherical_coordinates(self, x, y, z)[source]

Create velocities in spherical coordinates.

Parameters
x, y, z: array

unit-ed

Returns
velocityndarray

velocity

theta, phi: ndarray

units of radii

Notes

adjusts velocity be 1 / sqrt(_vel_adj), default of 1.