Utility functions

Utility functions#

Monte Carlo#

montecarlo_utils.get_random_location([size, ...])

Computes random longitude and latitude values.

montecarlo_utils.get_random_impact_angle([...])

Sample impact angles from a distribution centered on 45deg.

montecarlo_utils.get_random_velocity(vmean)

Sample impact velocities from a Rayleigh distribution given a mean velocity.

montecarlo_utils.get_random_size(diameters, cdf)

Sample diameters from a cumulative size-frequency distribution (SFD).

montecarlo_utils.bounded_norm(loc, scale[, ...])

Sample from a truncated normal distribution that is bounded by either an upper and lower bound, or if None is provided, by the 1-sigma stdev.

General utilities#

general_utils.Parameter(fget[, fset, fdel, doc])

A property descriptor that tracks user-defined properties.

general_utils.normalize_coords(location)

Normalize geographic coordinates to ensure longitude is within [-180, 180) degrees and latitude within [-90, 90] degrees.

general_utils.validate_and_normalize_location(...)

Validate and normalize a given location into a standard structured format.

general_utils.format_large_units(value, quantity)

Format a value and automatically shift units based on threshold.

general_utils.toggle_pyvista_actor(plotter, ...)

Toggle the visibility of a given actor in a PyVista plotter and updates the plotter.

general_utils.update_pyvista_help_message(plotter)

Add a help message to a PyVista plotter with instructions for user interactions.

general_utils.cleanup([simdir])

Remove output files and directories for a clean environment.