Utils#

Binning#

utils.bin_to_precision(x, delta_x)

Rounds float numbers within the array x to a given precision.

utils.get_fmd(magnitudes, fmd_bin[, ...])

Calculates event counts per magnitude bin.

utils.get_cum_fmd(magnitudes, fmd_bin[, ...])

Calculates cumulative event counts across all magnitude units (summed from the right).

Synthetic Magnitude Distributions#

utils.simulate_magnitudes(n, beta, mc[, mag_max])

Generates a vector of n elements drawn from an exponential distribution \(f = e^{-beta*M}\).

utils.simulate_magnitudes_binned(n, b, mc, ...)

Simulate magnitudes and bin them to a given precision delta_m.

Coordinates#

Spatial Transformations#

utils.bounding_box_to_polygon(x_min, x_max, ...)

Create a shapely Polygon from a bounding box.

utils.polygon_to_bounding_box(polygon)

Get the bounding box of a Polygon.

Coordinate Transformer#

utils.CoordinateTransformer

Class to transform between a external geographic (default ESPG:4326, also known as WGS84), and a local cartesian CRS.

Spatial Filtering#

utils.cat_intersect_polygon

Returns a DataFrame containing only the rows with points inside a given polygon.