pyPetrograph
v0.0.5
pyPetrograph is a machine-learning toolkit for thin-section petrography. You can draw pores and grains by hand in an interactive label window (wand or polygon), train a LightGBM pixel model, and get porosity with a confidence range. You can count grains on a painted mineral map by matching legend colors and splitting grains that touch. Or you can line up plane-polarized (PPL) and cross-polarized (XPL) photos, let a U-Net outline the grains, and build one table row per object for grouping and naming.
The current version is primarily developed by Larry Syu-Heng Lai, based on early source code scripted by Zoltan Sylvester, at the Quantitative Clastic Laboratory, Bureau of Economic Geology, The University of Texas at Austin. This development is also part of a collaboration with Priyanka Periwal, Lucy Tingwei Ko, Kelly Hattori, and Amanda Calle across multiple research groups and the e-MAGE lab in the Bureau of Economic Geology.
Install
From PyPI:
pip install pypetrograph
Alternatively, from this repo:
conda env create -f environment.yml
conda activate pypetrograph
pip install -e .
# Optional: finer grain-boundary mapping (SegmentEveryGrain)
# https://github.com/zsylvester/segmenteverygrain
pip install segmenteverygrain
This is SegmentEveryGrain’s “existing environment” path (install into the activated pypetrograph env). SAM 2.1 weights (~860 MB) are a further opt-in on their page, not part of this pip install.
Demo notebooks
pyPetrograph_rgb_porosity.ipynb— draw labels, train LightGBM, get porositypyPetrograph_mineralmap_count.ipynb— count grains on painted mineral mapspyPetrograph_multimodal_grains.ipynb— line up PPL + XPL, outline grains, build an object table
Example thin-section images are in Test images/. Analyzed results go to outputs/.
License
GNU Affero General Public License 3.0 or later (LICENSE).
Metadata
Release files for pyPetrograph 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pypetrograph-0.0.5.tar.gz | 131.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pypetrograph-0.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 286.4 kB
Release files / pypetrograph-0.0.5.tar.gz
| Download URL | pypetrograph-0.0.5.tar.gz |
|---|---|
| Size | 131.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c9f17d5955585ef5eb5b919b1dd5d82db29776983201776aadc2008c3ad95a28
|
|
BLAKE2b-256 checksum How to use checksums |
1892efe454db902084b1a4b7bc740592fd4bd5a082531f5b3c0f152034995292
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.9
|
Release files / pypetrograph-0.0.5-py3-none-any.whl
| Download URL | pypetrograph-0.0.5-py3-none-any.whl |
|---|---|
| Size | 155.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c8176bf003050a9943cf209c1523a2de7df856e6646be1c9fcfc9386b916b900
|
|
BLAKE2b-256 checksum How to use checksums |
321e0cff4eb462ea4cdeed41302388dc3180a63f772e8f684e8f24ca20536111
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.9
|
Security for pyPetrograph 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.