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-0.1.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

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

pydarkdiv-0.1.0-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pydarkdiv-0.1.0.tar.gz
  • Upload date:
  • Size: 8.5 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-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5dc8d569384a7243d14487a04dc2b6d215191931ead11ac7201a3e6d4742cc71
MD5 9f4e3332cb342a3e85bf4f301b877e96
BLAKE2b-256 25a7c396b66cd66a1f6bc3468fbf8e847c91b37b0cc16ab288c8a5d4215ffc1e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pydarkdiv-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.7 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-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d65aeb6a342befb6a3f2fcea7d073bd7157562dd4f649ac849865009886512a8
MD5 67d41a0644264d60268b3151f0cbf2bf
BLAKE2b-256 026bed1a69a4f7d7981309aafdd0b3c8896c1aad9781a48d67953147cb742eaa

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