PyDarkDiv
Python implementation of the DarkDiv R package for calculating dark diversity from species co-occurrence data.
Overview
PyDarkDiv estimates dark diversity - the unobserved portion of a site's species pool consisting of species that could potentially occur but are currently absent. This package implements the methods described in Carmona & Pärtel (2021).
Based on: DarkDiv R package by Carlos P. Carmona and Meelis Pärtel
Installation
pip install pydarkdiv
Quick Start
import pandas as pd
import pydarkdiv as pdd
# Load your species data (sites × species matrix)
data = pd.read_csv('species_data.csv', index_col=0)
# Calculate dark diversity
dd = pdd.DarkDiv(data, method='Hypergeometric')
# Get results as DataFrames
dfs = dd.to_dataframes()
dark_diversity = dfs['dark']
species_pool = dfs['pool']
# Summary statistics
dark_richness = (dark_diversity > 0.5).sum(axis=1)
print(f"Average dark diversity: {dark_richness.mean():.1f} species")
Methods
- Hypergeometric (recommended): Compares observed vs. expected co-occurrences
- RawBeals: Beals smoothing for occurrence probabilities
- Favorability: Favorability-corrected Beals values
- ThresholdBeals: Binary predictions using thresholds
Usage Examples
See usage_examples.py for detailed examples including:
- Basic usage
- Method comparisons
- Reference data usage
- Abundance weighting
Requirements
- Python ≥ 3.8
- numpy ≥ 1.21.0
- pandas ≥ 1.3.0
- scipy ≥ 1.7.0
Reference
Carmona, C.P. & Pärtel, M. (2021). Estimating probabilistic site-specific species pools and dark diversity from co-occurrence data. Global Ecology and Biogeography, 30(1), 316-326. DOI link
License
MIT License
Metadata
Release files for pydarkdiv 1.0.1
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 | Actions |
|---|---|---|---|---|
| pydarkdiv-1.0.1.tar.gz | 8.9 kB | Without provenance | Details for pydarkdiv-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pydarkdiv-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for pydarkdiv-1.0.1-py3-none-any.whl |
Total release size: 20.1 kB
Release files / pydarkdiv-1.0.1.tar.gz
| Download URL | pydarkdiv-1.0.1.tar.gz |
|---|---|
| Size | 8.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4d6b188d8bb9b48a3c0e71993f46523042b4d3fab01f3a66422b83870573b07f
|
|
BLAKE2b-256 checksum How to use checksums |
d24eb7ac29dc71460515aef0ca0ced1f83b0b2f2dfed5ba7ca17149baa5afd1a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.13.5 Windows/11
|
Release files / pydarkdiv-1.0.1-py3-none-any.whl
| Download URL | pydarkdiv-1.0.1-py3-none-any.whl |
|---|---|
| Size | 11.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c4854fb40e90cc5c94ab7a2dea7075f4d58494fc74d844522251902b12dac82c
|
|
BLAKE2b-256 checksum How to use checksums |
da8969e4add45ea26bebbcaa853b2c61ac91c8ed951a1639e375839e11b1cfaa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.13.5 Windows/11
|
Security for pydarkdiv 1.0.1
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.