Skip to main content

Description

detritalPy is a Python module for visualizing and analyzing detrital geo-thermochronologic data. Designed to be implemented via a Jupyter Notebook, detritalPy aims to provide an efficient means of processing and analyzing large detrital mineral isotopic and geochemical datasets. For more information, please refer to Sharman et al., 2018.

Manual

A manual for detritalPy can be found here.

Installation

pip install detritalpy

Upgrading

pip install detritalpy --upgrade

Requirements

Installation of the open data science platform Anaconda by Continuum Analytics will provide most of the required Python modules needed to run detritalPy. The following is a full list of dependencies for all detritalPy functions:

  • numpy
  • matplotlib
  • pandas
  • xlrd
  • folium
  • vincent
  • simplekml
  • scipy
  • sklearn
  • statsmodels
  • peakutils

Data Formatting

detritalPy requires that input data be organized using a specific format. Example datasets can be found in the example-data folder, and additional information is provided in the detritalPy manual. Dr. Jeff Amato (New Mexico State University) has put together a beginner's guide to detritalPy (geared towards MacOS) that can be found here.

Data Import and Selection

One or more spreadsheets can be simultaneously imported using a number of different ways of specifying the file path. Additional examples are provided in tutorial_dataLoading.ipynb.

# Import relative file pathway(s)
from pathlib import Path

# Specify file paths to data input file(s)
dataToLoad = [Path("example-data/") / "ExampleDataset_1.xlsx",
              Path("example-data/") / "ExampleDataset_2.xlsx"]

main_df, main_byid_df, samples_df, analyses_df = dFunc.loadDataExcel(dataToLoad)

Or filepaths can be written this way if using a PC:

# Specify file paths to data input file(s)
dataToLoad = [r'C:\Users\gsharman\Documents\GitHub\detritalPy\example-data\ExampleDataset_1.xlsx',
              r'C:\Users\gsharman\Documents\GitHub\detritalPy\example-data\ExampleDataset_2.xlsx']

main_df, main_byid_df, samples_df, analyses_df = dFunc.loadDataExcel(dataToLoad)

Or this way if using a Mac or PC:

# Specify file paths to data input file(s)
dataToLoad = ['/Users/gsharman/Documents/GitHub/detritalPy/example-data/ExampleDataset_1.xlsx',
			  '/Users/gsharman/Documents/GitHub/detritalPy/example-data/ExampleDataset_1.xlsx']

main_df, main_byid_df, samples_df, analyses_df = dFunc.loadDataExcel(dataToLoad)

Once data is loaded, samples can be selected either as a list of sample names

sampleList = [(['POR-1','POR-2','POR-3','BUT-5','BUT-4','BUT-3','BUT-2','BUT-1'],'All')]
ages, errors, numGrains, labels = dFunc.sampleToData(sampleList, main_byid_df, sigma = '1sigma');

or as groups using a tuple structure.

sampleList = [(['POR-1','POR-2','POR-3'],'Point of Rocks Sandstone'),
              (['BUT-5','BUT-4','BUT-3','BUT-2','BUT-1'],'Butano Sandstone')]
ages, errors, numGrains, labels = dFunc.sampleToData(sampleList, main_byid_df, sigma = '1sigma');

Selected Examples

Plot detrital age distributions

fig = dFunc.plotAll(sampleList, ages, errors, numGrains, labels, x1=0, x2=300)

Plot rim age versus core age

sampleList = [(['11-Escanilla','12-Escanilla','10-Sobrarbe','7-Guaso','13-Guaso','5-Morillo','6-Morillo','14AB-M02','14AB-A04','14AB-A05','4-Ainsa','14AB-A06','15AB-352','15AB-118','15AB-150','3-Gerbe','14AB-G07','2-Arro','1-Fosado','14AB-F01'],'All Ainsa Basin')]    
ages, errors, numGrains, labels = dFunc.sampleToData(sampleList, main_byid_df, sigma = '1sigma');
rimsVsCores = dFunc.plotRimsVsCores(main_byid_df, sampleList, ages, errors, labels, x1=0, x2=3500, y1=0, y2=3500, plotLog=False, plotError=True, w=8, c=8)

Plot detrital age distributions in comparison to another variable (e.g., Th/U)

figDouble = dFunc.plotDouble(sampleList, main_byid_df, ages, errors, numGrains, labels, variableName='Th_U', plotError=False, variableError=0.05, normPlots=False, plotKDE=False, colorKDE=False, colorKDEbyAge=False, plotPDP=True, colorPDP=False, colorPDPbyAge=True, plotHist=False, x1=0, x2=300, autoScaleY=False, y1=0, y2=2, b=5, bw=10, xdif=1, agebins=[0, 23, 65, 85, 100, 135, 200, 300, 500, 4500], agebinsc=['slategray','royalblue','gold','red','darkred','purple','navy','gray','saddlebrown'], w=10, t=3, l=1, plotLog=False, plotColorBar=False, plotMovingAverage=True, windowSize=25, KDElw=1, PDPlw=1);

Multi-dimensional scaling

Revised and updated in detritalPy version 1.3

model = dFunc.MDS_class(ages, errors, labels, sampleList, criteria='Vmax')
model.MDSplot(figsize=(6,6), savePlot=True, fileName='MDSplot.pdf', plotLabels=True, 
              plotPie=True, pieType='Age', pieSize=0.02, agebins=[0, 23, 65, 85, 100, 135, 200, 300, 500, 4500],
              agebinsc=['slategray','royalblue','gold','red','darkred','purple','navy','gray','saddlebrown'], equalAspect=False)

(U-Th)/He vs U-Pb age "double dating" plot

figDoubleDating = dFunc.plotDoubleDating(main_byid_df, sampleList, x1=0, x2=3500, y1=0, y2=500, plotKDE=False, colorKDE=False, colorKDEbyAge=True, plotPDP=True, colorPDP=True, colorPDPbyAge=False, plotHist=False, b=25, bw=10, xdif=1, width=10, height=10, savePlot=True, agebins=[0, 66, 180, 280, 310, 330, 410, 520, 700, 900, 1200, 1500, 3500], agebinsc=['olivedrab','purple','lightskyblue','lightseagreen','lightsteelblue','gold','sandybrown','orange','darkorange','firebrick','orchid','gray']);

If you find this code helpful in your research, please cite the accompanying article published in the Depositional Record.

Sharman G.R., Sharman J.P., and Sylvester Z., 2018, detritalPy: A Python-based toolset for visualizing and analyzing detrital geo-thermochronologic Ddata: The Depositional Record, v. 4, p. 202-215, https://doi.org/10.1002/dep2.45.

Code for maximum depositional age (MDA) calculations was first presented in:

Sharman, G.R., and Malkowski, M.A., 2020, Needles in a haystack: Detrital zircon UPb ages and the maximum depositional age of modern global sediment: Earth-Science Reviews, v. 203, doi:10.1016/j.earscirev.2020.103109.

License

detritalPy is licensed under the Apache License 2.0.

Metadata

Release files for detritalpy 1.4.15

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for detritalpy 1.4.15
File Size Uploaded
detritalpy-1.4.15.tar.gz 102.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for detritalpy 1.4.15
File Interpreter ABI Platform
detritalpy-1.4.15-py3-none-any.whl Python 3 none any Details

Total release size: 204.2 kB

Release files / detritalpy-1.4.15.tar.gz

Download URL detritalpy-1.4.15.tar.gz
Size 102.3 kB
Tags Source
SHA-256 checksum
How to use checksums
584575bca379d5b63367caef0bc3d30a9f9fa9705af85a1bfa0f400d1acbbd3a
BLAKE2b-256 checksum
How to use checksums
459d1a5e220ed5b89754b2699b98e0d45c1830acdea69b98e6bd822ce02e967d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / detritalpy-1.4.15-py3-none-any.whl

Download URL detritalpy-1.4.15-py3-none-any.whl
Size 101.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0a9d4a23a1b9379c21f6a84d08dabb2b76d04453a2ba216012b3e7d9c2ed9d9e
BLAKE2b-256 checksum
How to use checksums
4fd039c1b360d496f244d0c7f11dbc6f7b10b9d18a52cb1f1d7602628d01bafe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release history Release notifications | RSS feed

This release

1.4.15 This release

2 release files

1.4.13

2 release files

1.4.12

2 release files

1.4.8

1 release file

1.4.6

1 release file

1.4.5

1 release file

1.4.4

1 release file

1.4.3

1 release file

1.4.2

1 release file

1.4.1

1 release file

1.4.0

1 release file

1.3.39

1 release file

1.3.38

1 release file

1.3.37

1 release file

1.3.36

1 release file

1.3.35

1 release file

1.3.34

1 release file

1.3.33

1 release file

1.3.32

1 release file

1.3.31

1 release file

1.3.30

1 release file

1.3.29

1 release file

1.3.28

1 release file

1.3.27

1 release file

1.3.26

1 release file

1.3.25

1 release file

1.3.24

1 release file

1.3.23

1 release file

1.3.22

1 release file

1.3.21

1 release file

1.3.20

1 release file

1.3.19

1 release file

1.3.18

1 release file

1.3.17

1 release file

1.3.16

1 release file

1.3.15

1 release file

1.3.14

1 release file

1.3.13

1 release file

1.3.12

1 release file

1.3.11

1 release file

1.3.10

1 release file

1.3.8

1 release file

1.3.7

1 release file

1.3.6

1 release file

1.3.5

1 release file

1.3.4

1 release file

1.3.3

1 release file

1.3.2

1 release file

1.3.1

1 release file

1.3.0

1 release file

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page