Petrology tools
Project description
Lydwhitt_tools
A collection of functions and tools I have developed and find useful during my volcanology PhD.
Whilst I have a lot of tools and functions on my computer that I use regularly, I haven't yet put them all in a place to help others. There are a lot of very simple tasks that waste time, which I've created tools to complete, and I will be adding them to this repository over time.
I started collating this in August 2025 — so bear with me whilst I get it going!
Install
pip install lydwhitt-tools
Quickstart
Here’s the simplest way to run the geochemical filter tool: import pandas as pd import lydwhitt_tools as lwt Load your geochemical dataset df = pd.read_csv("my_data.csv") Apply the filter (defaults: total_perc=96, percentiles=(98, 98)) filtered_df = lwt.geochemical_filter(df, phase="Cpx") print(filtered_df.head())
Detailed Usage
The geochemical_filter function filters geochemical datasets using the Mahalanobis distance method in two passes.
Function signature: lwt.geochemical_filter(df, phase, total_perc=None, percentiles=None)
Parameters:
phase(str) – e.g.,"Cpx","Plg","Liq". Must match the suffix used after oxide wt% values in your dataset.total_perc(float, optional) – Minimum total oxide percentage allowed. Defaults to96.percentiles(int, float, or tuple, optional) – Percentile cutoffs for Pass 1 and Pass 2.- Single value applies to both passes (e.g.,
percentiles=98). - Tuple gives different cutoffs for each pass (e.g.,
percentiles=(95, 99)).
- Single value applies to both passes (e.g.,
Example: Use different percentiles for each pass filtered_df = lwt.geochemical_filter(df, phase="Plg", total_perc=97, percentiles=(95, 99))
Output
The function returns the filtered DataFrame, including flags for each pass:
Mahalanobis– Mahalanobis distance for each row in the given pass.P1_Outlier– Boolean flag indicating if the row was an outlier in Pass 1.P2_Outlier– Boolean flag indicating if the row was an outlier in Pass 2.
Features Coming Soon
This repository will grow to include: -formula recalculations for different phases -simple plotting frameworks -data re-oragnisation tools for popular gothermobarometry packages
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lydwhitt_tools-1.0.1.tar.gz.
File metadata
- Download URL: lydwhitt_tools-1.0.1.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f9935403b3fd6d8dbfd9d8546cc4ffecde7a4b40c9fdc538cac9022dbc9ce634
|
|
| MD5 |
281293358b016db805156e15dc8d9b5f
|
|
| BLAKE2b-256 |
dde3b44d888dfe8f5894876d415c333f81ef83936792921d9f971f76f7b6ae0a
|
Provenance
The following attestation bundles were made for lydwhitt_tools-1.0.1.tar.gz:
Publisher:
publish.yml on lydwhitt7/Lydwhitt_tools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lydwhitt_tools-1.0.1.tar.gz -
Subject digest:
f9935403b3fd6d8dbfd9d8546cc4ffecde7a4b40c9fdc538cac9022dbc9ce634 - Sigstore transparency entry: 389179805
- Sigstore integration time:
-
Permalink:
lydwhitt7/Lydwhitt_tools@727e3e7fbc3cbe27da3154317d42e7f53a830fca -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/lydwhitt7
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@727e3e7fbc3cbe27da3154317d42e7f53a830fca -
Trigger Event:
push
-
Statement type:
File details
Details for the file lydwhitt_tools-1.0.1-py3-none-any.whl.
File metadata
- Download URL: lydwhitt_tools-1.0.1-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e132a2aa3712eabbd823a17390a555aabe3431af51fb037e5b4d4cb38dfe0905
|
|
| MD5 |
d0deede473e3dfdaf542610ed221a07a
|
|
| BLAKE2b-256 |
36888d309bf4b68ae8614bc6dbb6409082496a0b80d6782d2d64857e78d40427
|
Provenance
The following attestation bundles were made for lydwhitt_tools-1.0.1-py3-none-any.whl:
Publisher:
publish.yml on lydwhitt7/Lydwhitt_tools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lydwhitt_tools-1.0.1-py3-none-any.whl -
Subject digest:
e132a2aa3712eabbd823a17390a555aabe3431af51fb037e5b4d4cb38dfe0905 - Sigstore transparency entry: 389179824
- Sigstore integration time:
-
Permalink:
lydwhitt7/Lydwhitt_tools@727e3e7fbc3cbe27da3154317d42e7f53a830fca -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/lydwhitt7
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@727e3e7fbc3cbe27da3154317d42e7f53a830fca -
Trigger Event:
push
-
Statement type: