Skip to content
This repository was archived by the owner on Sep 4, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
python-version: 3.12
- name: Install system dependencies
run: |
sudo apt-get update
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Deploy Documentation
permissions:
contents: write
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]


jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake libhdf5-dev

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true

- name: Generate Documentation
run: cargo doc --workspace --no-deps --document-private-items

- name: Deploy Docs
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: ./target/doc
force_orphan: true
71 changes: 48 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ members = [
resolver = "2"

[workspace.package]
version = "0.3.4"
version = "0.4.4"
edition = "2021"
license = "MIT"
repository = "https://github.com/Benncs/BioMC_PostProcess/"
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


## Project Overview
The **BioMC Postprocessor API** is a Rust module designed to facilitate interaction with post-processing simulation results via the BiomC API.
The **BioMC Postprocessor API** is a Rust API designed to interact with and perform post-processing on simulation results obtained with the [BioMC code](https://github.com/Benncs/BioCMA-MCST).
It also includes **PyO3 bindings** to provide a high-level Python API for end users.


Expand Down Expand Up @@ -35,3 +35,4 @@ It also includes **PyO3 bindings** to provide a high-level Python API for end us
### LICENSE


This code is under [MIT](./LICENSE) license
39 changes: 39 additions & 0 deletions biomc_pp/rtd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import biomc_pp
import numpy as np
import matplotlib.pyplot as plt

def get_rtd_from_scalar(pp,time,step_concentration):

c = pp.get_spatial_average_concentration(0,biomc_pp.Phase.Liquid)
c0 = c[0]
delta_c = c - c0
step_concentration = 5

# Cumulative probability
f_rtd = delta_c / step_concentration
# By defintion F(t)=integral 0 to t (E(t))
e_rtd = np.diff(f_rtd) / np.diff(time)

return f_rtd,e_rtd

def get_rtd_particle(pp):
probes = pp.get_probes()/3600
return np.histogram(probes, bins=100,density=True)

def plot_rtd(pp,time,step_concentration):

f_rtd,e_rtd = get_rtd_from_scalar(pp,time,step_concentration)
plt.figure()
plt.plot(time[1:],e_rtd,'--',color='red',label='Scalar')
c,e = get_rtd_particle(pp)
plt.bar(
e[:-1],
c,
width=np.diff(e),
edgecolor="black",
alpha=0.7,
color="blue",
label="Particles"
)
return f_rtd,e_rtd

3 changes: 3 additions & 0 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ authors.workspace = true
publish = true

[dependencies]
csv = "1.3.1"
hdf5 = "0.8.1"
ndarray = "0.16.1"
serde = { version = "1.0.219", features = ["derive"] }
serde_json = "1.0.140"
thiserror = "2.0.11"
#hdf5-sys = { version = "0.8.1", features = ["static"] }

Expand Down
Loading
Loading