semvec/pypi-packages huggingface dataset:
rtdpy 0.6.1
Python package for residence time distribution analysis
License: MIT
Requires Python: >=3.10

# rtdpy

Residence Time Distribution modeling in Python.

[https://merck.github.io/rtdpy](https://merck.github.io/rtdpy/)

[![DOI](https://joss.theoj.org/papers/10.21105/joss.01621/status.svg)](https://doi.org/10.21105/joss.01621)

## A simple example
Create a family of tanks in series (N-CSTRs) and analyze them
```python
import matplotlib.pyplot as plt
import rtdpy
for n in [1, 2, 5, 10, 100]:
    a = rtdpy.Ncstr(tau=1, n=n, dt=.001, time_end=5)
    plt.plot(a.time, a.exitage, label="n={}".format(n))
plt.legend()
plt.xlabel('Time')
plt.ylabel('Exit Age Function')
plt.title('Impulse Responses')
```

![N-Cstr RTDs](images/ncstr.png?raw=true "N-Cstr RTDs")

## Installation
```bash
pip install rtdpy
```

## Issues/Requests/Contributions
See [CONTRIBUTING.md](CONTRIBUTING.md)

## Development and Testing
It is recommended to use a virtual environment for developing/testing.

```bash
git clone https://github.com/Merck/rtdpy.git  # or use your forked repo
cd rtdpy
python3 -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
pip install -e ".[dev]"  # install package with dev dependencies

# run all tests with coverage
pytest
```

Tests are written using `pytest` and configuration is in `pyproject.toml`. See [pytest documentation](https://docs.pytest.org/en/latest/) for more details.

Author: Matthew Flamm

Email: <matthew.flamm@merck.com>
DAPyr 1.0.0
A Python package for running idealized model data assimilation experiments
License: MIT
Requires Python: >=3.10
Keywords: DA, Lorenz, data assimilation

# DAPyr: (D)ata (A)ssimilation (Py)ton (R)elease

DAPyr (pronounced "dapper") is a Python package for running, testing, and experimenting with data assimilation methods using Lorenz models. DAPyr supports quick configuration and running of experiments, allowing one to setup and run data assimilation cycles in as little as two lines. In addition, DAPyr utilizes [numbalsoda](https://github.com/Nicholaswogan/numbalsoda/tree/main) and [numba](https://numba.pydata.org/) for model integration, allowing for faster runtimes.

For a in-depth tutorials and explanations, see the [documentation](https://dapyr.readthedocs.io/en/latest/).

DAPyr currently supports the following:

secret readme edit

### Models:
1. Lorenz 1963
2. Lorenz 1996
3. Lorenz 2005

### Data Assimilation Methods:
1. Ensemble Square Root Filter [(Whitaker and Hamill, 2002)](https://journals.ametsoc.org/view/journals/mwre/130/7/1520-0493_2002_130_1913_edawpo_2.0.co_2.xml)
2. Localized Particle Filter [(Poterjoy, 2022)](https://rmets.onlinelibrary.wiley.com/doi/10.1002/qj.4328)

### Measurement Operators:
1. Linear
2. Quadratic
3. Logarithmic

## Installation

Pip:
```
python -m pip install DAPyr
```

## Basic Usage

```python
import DAPyr as dap
import numpy as np

# Use the Expt class to initialize an new experiment and calculate all necessary initial states
# Experiment will use Lorenz 63 (model_flag: 0), run for 300 time steps, and use the EnSRF method (expt_flag: 0)
expt = dap.Expt('Basic_L63', {'model_flag': 0, 'expt_flag': 0, 'T': 300})

# Run the experiment using the runDA function
dap.runDA(expt)

# Access RMSE and spread using the rmse and spread attributes
print('Avg. RMSE: {:.3f}'.format(np.mean(expt.rmse)))
print('Avg. Prior Spread: {:.3f}'.format(np.mean(expt.spread[:, 0])))
print('Avg. Posteriod Spread: {:.3f}'.format(np.mean(expt.spread[:, 1])))

#Save the experiment to filesystem using saveExpt, the file will be called it's experiment name
dap.saveExpt('./', expt)

#Load in previous experiments using loadExpt
expt2 = dap.loadExpt('./Basic_L63.expt')

```

For more examples, see `tutorial.ipynb` in `src`.

## Citation 
Please cite this repository [![DOI](https://zenodo.org/badge/967644537.svg)](https://doi.org/10.5281/zenodo.15792171) if you use DAPyr in your research publications or presentations.

## Contributions

Many thanks to the following for their contributions to DAPyr:
- Henry Santer (LPF Python implementation and many, many bug discoveries)
- Raelynn Wonacott (For advice on speeding up model integration using numba)

## Acknowledgement

The development of this software is supported by the following funding sources:
- NSF CAREER Award #1848363