A Python implenentation of the calculations and evaluations done by the Dew Point Calculator found at https://www.dpcalc.org/.
Project description
preservationeval
A Python implenentation of the calculations and evaluations done by the Dew Point Calculator found at https://www.dpcalc.org/.
Details
The preservation evaluation code was taken from the Dew point calulator created by the Image Permanence Institute. For details of the calculations see:
Installation
pip install preservationeval
Usage
Basic Examples
from preservationeval import pi, emc, mold
# Calculate Preservation Index
pi_value = pi(20, 50) # temperature=20°C, RH=50%
print(f"Preservation Index: {pi_value}")
# Calculate EMC (Equilibrium Moisture Content)
emc_value = emc(20, 50)
print(f"EMC: {emc_value}%")
# Calculate Mold Risk
mold_risk = mold(20, 50)
print(f"Mold Risk: {mold_risk}")
Interpreting Restults
TBD
Development
Setup
# Clone the repository
git clone https://github.com/petter-b/preservationeval
cd preservationeval
# Install development dependencies
pip install -e ".[dev]"
Development Tools
black: Code formattingruff: Linting and code qualitymypy: Static type checkingpytest: Testing frameworkpre-commit: Git hooks for code quality
Common Tasks
# Format code
black .
# Run linter
ruff check .
# Type checking
mypy .
# Run tests with coverage
pytest --cov
Testing
Validation Testing
The package includes a validation framework that compares our Python implementation against the original JavaScript implementation from dpcalc.org.
Requirements
- Node.js and npm must be installed (download)
- Python test dependencies:
pip install -e ".[test]"
Test Data Setup
The test framework automatically:
- Creates the
tests/datadirectory (git-ignored) - Downloads the JavaScript reference implementation
- Generates and saves test cases
- Caches results for future test runs
You can manually trigger this setup:
# Download JavaScript reference implementation
# This happens automatically when running tests, or manually:
python -m tests.validate_core
# Run all tests
pytest
# Run only validation tests
pytest tests/test_validation.py
# Run with verbose output
pytest -v tests/test_validation.py
# Generate new test cases (ignore cached)
pytest tests/test_validation.py --force-update
Code Quality
Automation
Development Notes
This project was developed with assistance from Claude AI (Anthropic) and to some extent GitHub Copilot. All code has been validated and tested for accuracy.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Changelog
See CHANGELOG.md for all changes and versioning details.
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
File details
Details for the file preservationeval-0.1.3b0.tar.gz.
File metadata
- Download URL: preservationeval-0.1.3b0.tar.gz
- Upload date:
- Size: 29.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
444c2c3026834b6ac5b78e8bad09841023655d19797d3e8c074bed2a0ee220a9
|
|
| MD5 |
3986778dd167cca883e38f001abf0b03
|
|
| BLAKE2b-256 |
a3fa9e97f3b0130dbef1ed41c5986887debc9970e8071f94bda67c0b967fa036
|