cratermaker.utils.montecarlo_utils.get_random_velocity

cratermaker.utils.montecarlo_utils.get_random_velocity#

cratermaker.utils.montecarlo_utils.get_random_velocity(vmean, vescape=None, size=1, rng=None, rng_seed=None, rng_state=None, **kwargs)[source]#

Sample impact velocities from a Rayleigh distribution given a mean velocity. Optionally account for the escape velocity.

Parameters:
  • vmean (np.float64) – The mean velocity of the distribution.

  • vescape (np.float64 | None, optional) – The escape velocity of the target body. If None, the escape velocity is not used in the calculation, and the disrtribution will be a maxwellian. If it is included, then the distribution will depend on the value of vmean. If vmean > vescape, then the distribution will adjusted so that the escape velocity is the minimum velocity by computing an encounter velocity then summing the encounter and escape velocities in quadrature. If vmean < vescape, then the distirbution will be a truncated maxwellian.

  • size (int or tuple of ints, optional) – The number of samples to generate. If the shape is (m, n, k), then m * n * k samples are drawn. If size is None (the default), a single value is returned if diameters is a scalar, otherwise an array of samples is returned with the same size as diameters.

  • rng (numpy.random.Generator | None) – A numpy random number generator. If None, a new generator is created using the rng_seed if it is provided.

  • rng_seed (Any type allowed by the rng_seed argument of numpy.random.Generator, optional) – The rng_seed for the RNG. If None, a new RNG is created.

  • rng_state (dict, optional) – The state of the random number generator. If None, a new state is created.

  • **kwargs (Any) – Additional keyword arguments that are either ignored or passed to internal functions as needed.

Returns:

ndarray – An array of impact velocities (in m/s).