Architecture¶
Petrophys is organized by processing stage at the top level and by physical
problem inside interpretation and evaluation. Each feature has one home,
even when import petrophys as pp re-exports it.
Functions and packages¶
The top-level functions are verbs that do a whole job in one call; the packages are nouns that hold the individual methods behind them.
Function (verb) |
Package (noun) |
Contains |
|---|---|---|
|
|
readers for LAS, DLIS, CSV, Excel and geology tables |
|
|
clay volume, porosity, saturation, permeability, lithology, geochemistry, … |
|
|
log panels, crossplots, specialist displays |
|
|
curve imputation |
|
|
context summaries and packages for LLMs |
import petrophys as pp holds these five functions, pp.read_formations,
pp.sample, pp.list_samples, pp.Well and pp.DynamicWorkflowConfig.
Everything else is imported from its package.
pp.interpret(well) runs the interpretation methods in petrophysical order
and returns the result with its step trace. Import from the package to run or
combine single methods yourself, for example
from petrophys.interpretation.geochemistry import interpret_spectral_gamma.
Package map¶
Generated from the installed package. Public names come from each package’s
__all__; dependencies come from the imports that run when it loads.
| Package | What it holds | Public names | Sub-packages | Imports when loaded |
|---|---|---|---|---|
| petrophys (pp) | The names most users need | 38 | ||
| api | The front door: pp.read, pp.interpret, pp.plot | 3 | ||
| datasets | Bundled samples and repository fixtures | 10 | ||
| evaluation | Reservoir decisions: net pay, rock quality, flow units, summaries | 37 | bvw, diagnostics, flow_units, intervals, mhi, net_pay, rock_quality, summaries, volumetrics | interpretation, model |
| exceptions | Warnings and errors raised by Petrophys | 1 | ||
| function_schema | What each parameter of the library's analysis functions takes, as data. | 8 | ||
| interpretation | Physical properties from measurements | 16 | borehole_imaging, clay_volume, core_analysis, electrical, geochemistry, lithology, nmr, permeability, pore_pressure, porosity, rock_physics, saturation, temperature | model |
| io | Read and write LAS, DLIS, CSV, ASCII and Excel; geology and core tables | 21 | model | |
| mcp | Model Context Protocol server | 5 | ||
| model | Data structures: wells, curves, core, formations, units, class tables | 32 | ||
| preprocessing | Standardization, normalization, quality control, imputation | 21 | imputation, normalization, quality, standardization | model |
| reporting | Delivery packages, audit reports, LLM context | 22 | evaluation, interpretation, io, model, preprocessing | |
| visualization | Log panels, crossplots, specialist displays | 48 | evaluation, interpretation, io, model, preprocessing | |
| workflow | Dependency-aware sequencing and method routing | 33 | evaluation, interpretation, io, model, preprocessing |
Dependency direction¶
When a package loads, it imports only from the rows below it. So the science never needs workflows or plotting, and the model needs no other package.
api, mcp entry points: pp.read, pp.interpret, pp.plot, MCP
↓
workflow visualization reporting
↓
evaluation
↓
interpretation preprocessing io
↓
model (datasets holds bundled files and stands apart)
A few functions import upward when called, never at load time. For example,
Well.from_las uses io. Shared private helpers live in petrophys._internal
and are not public API.
How a run moves through the packages¶
Stage |
Package |
Result |
|---|---|---|
Read |
|
A |
Prepare |
|
Standard names and units, quality flags |
Calculate |
|
Clay volume, porosity, saturation, permeability and more |
Decide |
|
Rock quality, flow units, net pay, summaries |
Sequence |
|
The steps above, routed by the inputs present, with a trace |
Deliver |
|
Plots, LAS/JSON exports, reports and context |
Contributing¶
Where new code belongs, and how to test and document it, is in CONTRIBUTING.md.
Go deeper¶
A tour of the packages and the bundled data.
How workflow calls the science packages, step by step.
Every public function and class, by package.