Skip to content

Commit aeecb0f

Browse files
committed
Small edits from Dan for a more user friendly experience
1 parent 0ae7e14 commit aeecb0f

2 files changed

Lines changed: 136 additions & 18 deletions

File tree

README.md

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Numerics Python Examples
22

3-
This repository contains Python notebooks that demonstrate the Numerics .NET library through pythonnet. The goal is to provide practical, reproducible examples for distributions, MCMC, optimization, statistics, time series, machine learning, and linear models.
3+
This repository contains Python notebooks that demonstrate the Numerics .NET library through pythonnet. The notebooks provide practical, reproducible examples of Numerics applications, including distribution fitting, MCMC, optimization, statistical analysis, time series analysis, machine learning, and linear model fitting.
44

55
## Contents
66
- `notebooks/` Jupyter notebooks organized by topic
@@ -23,14 +23,52 @@ This repository contains Python notebooks that demonstrate the Numerics .NET lib
2323

2424
## Prerequisites
2525
- Windows with .NET installed (or .NET 6+ runtime on Linux/macOS)
26-
- Python with pythonnet
27-
- Numerics built locally so the DLL exists at the path used in notebooks
26+
- Python with [pythonnet](https://github.com/pythonnet/pythonnet)
27+
- Numerics built and compiled locally. The resulting DLL path must match the path referenced in the notebooks — see Quick Start and/or notebook 00 for setup instructions.
2828

2929
## Quick Start
30-
1. Create and activate a Python environment.
31-
2. Install notebook requirements: `pip install -r notebook-requirements.txt`.
32-
3. Build Numerics and confirm the DLL path matches what the notebooks expect.
33-
4. Open notebooks in Jupyter or VS Code and run cells top to bottom.
30+
The quick start will step through the creation of an active python environment, installing the notebook requirements & RMC-Numerics, and getting the methods ready to be used. For a more in depth walk through see notebook 00.
31+
**NOTE:** This set up is geared towards Windows users. For other operating systems see notebook 00.
32+
33+
1. Create and activate a virtual Python environment
34+
```bash
35+
python -m venv .venv
36+
.venv\Scripts\Activate.ps1
37+
pip install ipykernel
38+
python -m ipykernel install --user --name=.venv --display-name "Python (.venv)"
39+
```
40+
41+
2. Install notebook requirements
42+
```bash
43+
pip install -r notebook-requirements.txt
44+
```
45+
46+
3. Install and build Numerics
47+
```bash
48+
git clone https://github.com/USACE-RMC/Numerics.git
49+
cd Numerics
50+
dotnet build Numerics.sln --configuration Release
51+
```
52+
53+
4. Load and confirm the DLL path
54+
```bash
55+
import pythonnet
56+
pythonnet.load("coreclr")
57+
58+
import clr
59+
from pathlib import Path
60+
61+
# Path to your Numerics.dll
62+
# MODIFY THIS PATH to make your installation
63+
dll_path = Path(r"C:\GIT\Numerics\Numerics\bin\Debug\net8.0\Numerics.dll")
64+
clr.AddReference(str(dll_path))
65+
```
66+
67+
5. Create a Normal Distribution
68+
```bash
69+
from Numerics.Distributions import Normal
70+
dist = Normal(100,15)
71+
```
3472

3573
## Notes
3674
- These notebooks compare Numerics to common Python libraries where relevant. When comparing MCMC chains, align warmup/thinning settings.

notebooks/06_mcmc_diagnostics.ipynb

Lines changed: 91 additions & 11 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)