Skip to main content

Python implementation of the DarkDiv R package for calculating dark diversity from co-occurrence data

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydarkdiv-1.0.1.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pydarkdiv-1.0.1-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file pydarkdiv-1.0.1.tar.gz.

File metadata

  • Download URL: pydarkdiv-1.0.1.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.5 Windows/11

File hashes

Hashes for pydarkdiv-1.0.1.tar.gz
Algorithm Hash digest
SHA256 4d6b188d8bb9b48a3c0e71993f46523042b4d3fab01f3a66422b83870573b07f
MD5 a04aa3239f3651c2c200c33102cb6de6
BLAKE2b-256 d24eb7ac29dc71460515aef0ca0ced1f83b0b2f2dfed5ba7ca17149baa5afd1a

See more details on using hashes here.

File details

Details for the file pydarkdiv-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pydarkdiv-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.5 Windows/11

File hashes

Hashes for pydarkdiv-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c4854fb40e90cc5c94ab7a2dea7075f4d58494fc74d844522251902b12dac82c
MD5 8a4c05f4c7976ee1c12a4e65d91a5dd6
BLAKE2b-256 da8969e4add45ea26bebbcaa853b2c61ac91c8ed951a1639e375839e11b1cfaa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page