1. Install
pip install petroharness
Python 3.10 or later; Petrophys comes with it.
From source, to change the code
git clone https://github.com/sambalshikhar/PetroHarness.git && cd PetroHarness
python3.10 -m venv .venv && source .venv/bin/activate
pip install -r requirements.lock # the versions the tests run with
pip install -e .
2. Launch the UI
petroharness --launch-ui
The page opens at http://localhost:7860. With nothing else set, the model is WellLogLLM-3.7B, our post-trained
model for well-log interpretation, run by Ollama on your computer, with or without a GPU
(a Mac's GPU, an NVIDIA or an AMD one is used):
install Ollama first, and PetroHarness downloads the model (5.4 GB) the first time. Pick one of Petrophys's sample wells
or drop your own LAS file, choose the interval, and ask in your own words. On a remote machine, forward the port first
(ssh -L 7860:localhost:7860 HOST) and open the same address.
3. Or choose another model
Model (top right of the page) connects WellLogLLM-7B or the full WellLogLLM-3.7B on your own GPU server (the dialog shows the vLLM commands that start them, with a Copy button), any model a vLLM server or Ollama serves, or a hosted model through OpenRouter with your API key. PetroHarness keeps the choice for the next start and for the command. From the command line:
petroharness --launch-ui --model Qwen/Qwen3-32B --model-url http://localhost:8000/v1 # any model a server serves
Every step, per system, with sizes and what to do when something goes wrong: Install and set up. Serving models and model cards: Models.
4. Or ask from the command line
GeoLink well 30/6-5 ships with Petrophys, so this runs as it is:
LAS=$(python -c "import petrophys; print(petrophys.sample('30/6-5'))")
TOPS=$(python -c "import petrophys; print(petrophys.sample('formations_30_6-5.csv'))")
petroharness --las $LAS --tops $TOPS --formation "BRENT GP." \
--question "What are the porosity, water saturation and permeability of the Brent Group, and is any of it hydrocarbon-bearing?"
It uses the model you chose in the page, or WellLogLLM-3.7B in Ollama when you chose none. The answer is printed, and
answer.md and trace.json (every model call and every result opened) go to ./.
Go further
| To | Run | Read |
|---|---|---|
| Ask in the browser | petroharness --launch-ui (petroharness ui starts the server without opening a browser) |
Web UI |
| Use another model | --model NAME --model-url URL, or --model-card FILE |
Models |
| Keep asking about the interval | petroharness chat --las $LAS --tops $TOPS --formation "BRENT GP." --session brent |
Conversations |
| Audit every answer of a conversation | petroharness audit brent |
Audit an answer |
| Use your own well | --las FILE with --tops FILE --formation NAME, or --top D --base D, or neither for the whole log |
Evaluate a formation |
| Call it from Python | from petroharness. |
Python API |
What you can ask
Ask what you would ask a petrophysicist, about a formation, a depth window or the whole log.
| Ask it to | For example |
|---|---|
| Interpret | Where are the best reservoir intervals, and is any of them hydrocarbon-bearing? |
| Check the data | Where is the hole washed out, and does it affect the density log? |
| Recompute with another method | Compute saturation with Simandoux and give me the statistics. |
| Test a what-if | How does net pay change if the water saturation cutoff is 0.5? |
| Estimate a parameter | What cementation exponent does a Pickett plot give? |
More kinds of question, and the topics the skill library covers
| Ask it to | For example |
|---|---|
| Describe and compare | Is porosity higher where shale volume is lower? · Which zone has the highest resistivity? |
| Classify | What minerals make up this formation? · Define flow units. · Is there any moveable hydrocarbon? |
| Summarize | Net pay, net-to-gross and hydrocarbon pore thickness per zone at a 0.5 SW cutoff. · What would the oil in place be for a 640-acre drainage area? |
| Calibrate and model | Fit a saturation-height function with the free-water level at 870 m. · Predict the shear sonic from the compressional sonic. |
| Go further | Split the shale into laminated, dispersed and structural parts with Thomas–Stieber. · How heterogeneous is the permeability (Lorenz, Dykstra–Parsons)? |
When a method needs what the well does not carry (Rwb for dual water, CEC for Waxman–Smits, a normal-compaction trend for Eaton), the answer says what is missing.
The skill library holds a sourced guide for each of these topic areas, and the model picks the guides a question needs. They guide the investigation; they do not limit what you can ask.
| Rock | Fluids | Reservoir quality | Data and methods |
|---|---|---|---|
| lithology and mineralogy | water saturation | porosity | data quality |
| shale and clay | hydrocarbon detection | permeability and rock quality | statistics and data analysis |
| log facies and stratigraphy | fluid contacts | net reservoir and pay | core-log integration |
| elastic properties | invasion and movability |
Eleven questions worked through on wells that ship with Petrophys: Examples.

