Examples

Worked examples ported from the USACE-RMC Numerics-Python-Examples repository (0BSD licensed). Each example exists in a Python version (corehydropy, a Jupyter notebook you can download and run) and an R version (corehydror, a Quarto document). The pair uses the same seeds and prints the same numbers: both packages run the same compiled core with a bit-exact Mersenne Twister.

Some pages carry a condition on that, and say so where it applies. On the callback surface (examples 13, 14, 15, 17, 18, and 19) the ported routine’s input is a function you write, so the draws come from the core generator but your own R or Python arithmetic decides the values. A seeded run there reproduces across the two languages if and only if your function returns bit-identical values.

Every example ends with an executable reproduction check. Where the example has an upstream counterpart the check compares against the outputs embedded in the upstream notebooks, run by the original C# library, exactly where the result is seeded and deterministic and statistically where the example was recast onto this package’s API. Where it has no counterpart the check asserts the same literals in both languages, which is what pins the cross-language identity. The coverage page lists every upstream example and its status here.

# Example Python R
00 Getting started Python R
01 Probability distributions Python R
02 Distribution fitting Python R
03 MCMC basics Python R
04 Bayesian inference Python R
05 Adaptive MCMC samplers Python R
06 MCMC diagnostics Python R
09 Statistics toolbox Python R
12 Model evaluation Python R
13 A custom objective Python R
14 A custom posterior Python R
15 A custom bootstrap Python R
16 Ranking fifteen candidate families Python R
17 A pivotal bootstrap Python R
18 Numerical methods Python R
19 Global, constrained, and network optimization Python R
20 Bayesian regression Python R
21 Flood frequency analysis Python R
22 Reliability analysis Python R
23 Censored flood frequency Python R
24 Nonstationary frequency analysis Python R
25 Estimation methods Python R
26 Copulas and joint frequency Python R
27 Composite distributions Python R
28 Hypothesis tests and paired data Python R
29 Machine learning Python R
30 Time series Python R

Numbers 00-09 mirror the upstream notebooks and 20-22 the upstream’s three standalone scripts. Of the rest, 18, 19, 29 and 30 cover the upstream’s remaining four topics (integration and root finding, optimization, time series, machine learning) but are organized differently, and the others have no upstream counterpart at all: they reach parts of RMC-BestFit and the Numerics toolbox the upstream examples never exercise.