resprpy is a complete Python port of the respR 2.3.4 R package (Harianto & Carey, Methods in Ecology and Evolution 2019, doi:10.1111/2041-210X.13162) for processing and analysis of respirometry (oxygen uptake / metabolic rate) data.
The goal is numeric parity with R: every exported function is verified against outputs generated by R 4.5.3 (pytest parity tests, all 57 passing).
🇨🇳 中文版说明见 README.zh-CN.md · Full usage guide (EN): docs/respR_resprpy_guide.en.html · 使用手册(中文): docs/respR_resprpy_guide.zh.html
pip install -e . # or: pip install -e ".[plot,test]"Dependencies: numpy, scipy (optional: matplotlib, pytest, openpyxl).
| respR (R) | resprpy (Python) | Status |
|---|---|---|
calc_rate |
calc_rate |
✅ ≤1e-13 |
calc_rate.int |
calc_rate_int |
✅ ≤1e-6 |
calc_rate.bg |
calc_rate_bg |
✅ ≤1e-6 |
calc_rate.ft |
calc_rate_ft |
✅ ≤1e-5 |
auto_rate |
auto_rate |
✅ bw.SJ/density bit-exact |
auto_rate.int |
auto_rate_int |
✅ ≤1e-5 |
adjust_rate |
adjust_rate |
✅ 6 methods |
adjust_rate.ft |
adjust_rate_ft |
✅ ≤1e-6 |
select_rate |
select_rate |
✅ all 34 methods |
select_rate.ft |
select_rate_ft |
✅ ≤1e-5 |
convert_DO |
convert_DO |
✅ ≤1e-12 |
convert_MR |
convert_MR |
✅ ≤1e-12 |
convert_rate |
convert_rate |
✅ ≤1e-12 |
convert_rate.ft |
convert_rate_ft |
✅ ≤1e-8 |
convert_val |
convert_val |
✅ ≤1e-12 |
format_time |
format_time |
✅ exact |
inspect |
inspect |
✅ checks/locs match |
inspect.ft |
inspect_ft |
✅ |
oxy_crit |
oxy_crit |
✅ bsr + segmented |
import_file |
import_file |
✅ NeoFox exact (14 parsers) |
sim_data |
sim_data |
✅ structure |
subsample |
subsample |
✅ |
subset_data |
subset_data |
✅ |
select |
select |
✅ |
%>% |
— (Python chaining) | ➖ n/a |
test_lin |
test_lin |
🟡 structure matches |
unit_args |
unit_args |
✅ |
S3 plot() |
plot_inspect plot_calc_rate plot_auto_rate plot_oxy_crit |
✅ matplotlib |
- Segmented (Muggeo 2003) breakpoint analysis ported from the
segmented2.2-1 package including R's MT19937 RNG (bit-exactset.seedsequences, bootstrap-restart search) — crit values match R exactly (e.g. 7.719111…). select_rate— all 34 methods verified against R, including error behaviour (methods R rejects raise the same errors).convert_*— physical anchors exact (sw_dens=1024.64077347883, molvol=24.03038425, mg/L→%Air=108.4419).- No C/C++ runtime: the rolling regression, kernel density, marelac physics and segmented algorithm used by respR's dependencies are all inlined into pure numpy/scipy — PyInstaller-friendly.
python -m pytest tests/ -v # 57 tests, all greenReference CSVs under tests/reference/ were generated by R 4.5.3
(reference/gen_refs_*.R); pytest compares element-wise with graded
tolerances (coeffs 1e-8, rsq 1e-12, time 1e-9, density 1e-3).
See the structure comparison section in the usage guides.
resprpy is a Python port of the R package respR. If you use resprpy in publications or derived software, please cite the original respR work:
Harianto, J., Carey, N., & Byrne, M. (2019). respR — An R package for the manipulation and analysis of respirometry data. Methods in Ecology and Evolution, 10(6), 912–920. doi:10.1111/2041-210X.13162
- respR source: https://github.com/januarharianto/respR
- respR documentation: https://januarharianto.github.io/respR/
- CRAN: https://cran.r-project.org/package=respR
Machine-readable citation metadata: CITATION.cff.
GPL-3 (same as respR). This is a clean-room style port of respR's algorithms and its dependencies' algorithms; distributing it requires GPL-3 compliance.