phrenic 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- phrenic-0.1.0/LICENSE +21 -0
- phrenic-0.1.0/PKG-INFO +137 -0
- phrenic-0.1.0/README.md +107 -0
- phrenic-0.1.0/pyproject.toml +61 -0
- phrenic-0.1.0/setup.cfg +4 -0
- phrenic-0.1.0/src/phrenic/__init__.py +45 -0
- phrenic-0.1.0/src/phrenic/api.py +467 -0
- phrenic-0.1.0/src/phrenic/cli.py +332 -0
- phrenic-0.1.0/src/phrenic/drive.py +406 -0
- phrenic-0.1.0/src/phrenic/gas.py +141 -0
- phrenic-0.1.0/src/phrenic/mechanics.py +226 -0
- phrenic-0.1.0/src/phrenic/plot.py +78 -0
- phrenic-0.1.0/src/phrenic/presets.py +110 -0
- phrenic-0.1.0/src/phrenic/replay.py +385 -0
- phrenic-0.1.0/src/phrenic/sensors.py +539 -0
- phrenic-0.1.0/src/phrenic.egg-info/PKG-INFO +137 -0
- phrenic-0.1.0/src/phrenic.egg-info/SOURCES.txt +20 -0
- phrenic-0.1.0/src/phrenic.egg-info/dependency_links.txt +1 -0
- phrenic-0.1.0/src/phrenic.egg-info/entry_points.txt +2 -0
- phrenic-0.1.0/src/phrenic.egg-info/requires.txt +8 -0
- phrenic-0.1.0/src/phrenic.egg-info/top_level.txt +1 -0
- phrenic-0.1.0/tests/test_phrenic.py +503 -0
phrenic-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Shane Lindsay
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
phrenic-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: phrenic
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Mechanistic lung, chest-wall, and multi-sensor modelling of human breathing in Python
|
|
5
|
+
Author: Shane Lindsay
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://brain-body-cognition.github.io/phrenic/
|
|
8
|
+
Project-URL: Repository, https://github.com/brain-body-cognition/phrenic
|
|
9
|
+
Project-URL: Issues, https://github.com/brain-body-cognition/phrenic/issues
|
|
10
|
+
Project-URL: Documentation, https://brain-body-cognition.github.io/phrenic/docs/
|
|
11
|
+
Keywords: respiration,breathing,lung-mechanics,physiology,capnography,spirometry,RIP,ECG,PPG,simulation
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
|
|
19
|
+
Requires-Python: >=3.11
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: numpy>=1.26
|
|
23
|
+
Requires-Dist: scipy>=1.11
|
|
24
|
+
Requires-Dist: pandas>=2.0
|
|
25
|
+
Requires-Dist: matplotlib>=3.8
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
28
|
+
Requires-Dist: ruff>=0.5; extra == "dev"
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
<p align="center">
|
|
32
|
+
<img src="https://raw.githubusercontent.com/brain-body-cognition/phrenic/main/docs/assets/logo.png" alt="phrenic logo" width="440">
|
|
33
|
+
</p>
|
|
34
|
+
|
|
35
|
+
<p align="center">
|
|
36
|
+
<strong>Mechanistic modelling of human breathing across physiological sensors.</strong>
|
|
37
|
+
</p>
|
|
38
|
+
|
|
39
|
+
`phrenic` models a breathing human in pure NumPy and SciPy and projects one shared physiological trajectory simultaneously onto airway, chest-wall, cardiac, and neuroimaging sensors.
|
|
40
|
+
|
|
41
|
+
- **Lung and chest-wall mechanics:** One- and two-unit nonlinear Rohrer-RC lung mechanics with post-inspiratory braking, dynamic hyperinflation, Konno-Mead ribcage-abdomen phase lag, and 13 named resting, airway-narrowing, restrictive, ageing, and sleep presets.
|
|
42
|
+
- **Coupled multi-sensor forward models:** Calibrated airway flow, quadratic nasal cannula pressure with oral leak, branched dead-space capnography, thermal thermistor lag, dual DC RIP, AC scanner belt (with rail clipping and loose-strap freezes), thoracic impedance, QRS-modulated ECG, finger PPG with pulsus paradoxus, MEG head-coil nodding, sub-TR and whole-volume MRI B0 shifts, and two-pool CO₂ BOLD waves.
|
|
43
|
+
- **Cross-sensor replay:** Anchor the breathing clock to one recorded sensor (airflow, belt, dual RIP, capnogram, or ECG) and generate 5th–95th percentile envelopes across the unobserved sensors, with optional demographic lifespan priors.
|
|
44
|
+
- **Interactive browser companion:** Explore the same mechanics live with 3D anatomy, 2D cutaway, and bell-jar views in the [interactive breathing simulator](https://brain-body-cognition.github.io/phrenic/).
|
|
45
|
+
|
|
46
|
+

|
|
47
|
+
|
|
48
|
+
*Live browser companion to `phrenic` across resting, airway-narrowing, stiff-lung, and sleep regimes.*
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Install
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
python -m pip install phrenic
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
`phrenic` requires Python 3.11+ and depends only on `numpy`, `scipy`, `pandas`, and `matplotlib`.
|
|
59
|
+
|
|
60
|
+
## Quickstart
|
|
61
|
+
|
|
62
|
+
### Command line
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
# List all 13 named physiological and sleep presets
|
|
66
|
+
phrenic presets
|
|
67
|
+
|
|
68
|
+
# Generate coupled recordings with a sigh, a peak breath hold, rail clipping, and a loose strap
|
|
69
|
+
phrenic simulate --out demo --preset quiet_rest --duration-s 90 \
|
|
70
|
+
--sigh-times 18 --hold 42:6 --hold-phase peak \
|
|
71
|
+
--belt-clip-quantile 0.92 --loose 68:5
|
|
72
|
+
|
|
73
|
+
# Moderate resting bronchoconstriction (lower tPTEF/Te, shark-fin capnogram, dynamic hyperinflation)
|
|
74
|
+
phrenic simulate --out demo-narrow --preset moderate_bronchoconstriction --duration-s 90
|
|
75
|
+
|
|
76
|
+
# Project a recorded belt or airflow file across unobserved sensors with 90% envelopes
|
|
77
|
+
phrenic replay demo/flow.csv --source airflow --fs 100 --age 35 --sex female --out demo-replay
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+

|
|
81
|
+
|
|
82
|
+
*Five coupled sensor views of one simulated breathing trace: airway flow, DC RIP vs. AC scanner belt (clipping at the sigh, decaying during the 6 s peak hold, and freezing during a loose-strap window), nasal cannula pressure, sub-TR vs. whole-volume MRI sampling, and chest ECG.*
|
|
83
|
+
|
|
84
|
+
### Python API
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
from phrenic import (
|
|
88
|
+
simulate_respiration,
|
|
89
|
+
simulate_sensors_from_flow,
|
|
90
|
+
simulate_two_pool_co2,
|
|
91
|
+
replay_sensor_array,
|
|
92
|
+
solve_lung_mechanics,
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
# 1. Forward multi-sensor simulation from a named preset
|
|
96
|
+
sim = simulate_respiration(
|
|
97
|
+
duration_s=90,
|
|
98
|
+
preset="mild_bronchoconstriction",
|
|
99
|
+
sigh_times_s=(25,),
|
|
100
|
+
belt_clip_quantile=0.92,
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
# 2. Run recorded spirometry through the Konno-Mead chest wall and sensor models
|
|
104
|
+
replayed = simulate_sensors_from_flow(sim["flow_l_s"], fs=sim["fs"], mri_tr_s=1.8)
|
|
105
|
+
|
|
106
|
+
# 3. Two-pool alveolar and arterial CO2 kinetics -> delayed cortical BOLD
|
|
107
|
+
gas = simulate_two_pool_co2(sim["flow_l_s"], fs=sim["fs"])
|
|
108
|
+
|
|
109
|
+
# 4. Project one recorded sensor across unobserved sensors with 90% intervals
|
|
110
|
+
env = replay_sensor_array(sim["ac_belt"], fs=sim["fs"], source="belt", age=42, sex="female")
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Working with `neuroresp`
|
|
114
|
+
|
|
115
|
+
`phrenic` is the sister package to [`neuroresp`](https://github.com/brain-body-cognition/neuroresp). `phrenic` runs forward from respiratory physiology to coupled sensor signals; `neuroresp` works backwards from recorded fMRI, MEG, ECG, belts, and airflow to recover breathing and clean neuroimaging scans. The CSV, BIDS-physio TSV/JSON, and NPZ files written by `phrenic simulate` plug directly into `neuroresp airflow`, `neuroresp belt`, `neuroresp meg`, and `neuroresp fuse`.
|
|
116
|
+
|
|
117
|
+
## Documentation
|
|
118
|
+
|
|
119
|
+
The documentation site is at [brain-body-cognition.github.io/phrenic/docs](https://brain-body-cognition.github.io/phrenic/docs/).
|
|
120
|
+
|
|
121
|
+
- [Model & Calibration](docs/model.md): architecture, lung and chest-wall equations, physiological parameter map, 30-adult quiet-rest validation figures, and sensor calibration status.
|
|
122
|
+
- [Interactive breathing simulator](https://brain-body-cognition.github.io/phrenic/): browser-based version of the lung and sensor core.
|
|
123
|
+
|
|
124
|
+
## References
|
|
125
|
+
|
|
126
|
+
- Albanese, A., Cheng, L., Ursino, M., & Chbat, N. W. (2016). An integrated mathematical model of the human cardiopulmonary system: model development. *American Journal of Physiology-Heart and Circulatory Physiology*, 310(7), H899–H921. https://doi.org/10.1152/ajpheart.00230.2014
|
|
127
|
+
- Bates, J. H. T. (2009). *Lung Mechanics: An Inverse Modeling Approach*. Cambridge University Press. https://doi.org/10.1017/CBO9780511627156
|
|
128
|
+
- Birn, R. M., Smith, M. A., Jones, T. B., & Bandettini, P. A. (2008). The respiration response function: The temporal dynamics of fMRI signal fluctuations related to changes in respiration. *NeuroImage*, 40(2), 644–654. https://doi.org/10.1016/j.neuroimage.2007.11.059
|
|
129
|
+
- Charlton, P. H., Bonnici, T., Tarassenko, L., Clifton, D. A., Beale, R., & Watkinson, P. J. (2017). Extraction of respiratory signals from the electrocardiogram and photoplethysmogram: technical and physiological determinants. *Physiological Measurement*, 38(5), 669–690. https://doi.org/10.1088/1361-6579/aa670e
|
|
130
|
+
- Konno, K., & Mead, J. (1967). Measurement of the separate volume changes of rib cage and abdomen during breathing. *Journal of Applied Physiology*, 22(3), 407–422. https://doi.org/10.1152/jappl.1967.22.3.407
|
|
131
|
+
- Otis, A. B., McKerrow, C. B., Bartlett, R. A., Mead, J., McIlroy, M. B., Selverstone, N. J., & Radford, E. P. (1956). Mechanical factors in distribution of pulmonary ventilation. *Journal of Applied Physiology*, 8(4), 427–443. https://doi.org/10.1152/jappl.1956.8.4.427
|
|
132
|
+
- Power, J. D., Lynch, C. J., Silver, B. M., Dubin, M. J., Martin, A., & Jones, R. M. (2019). Distinctions among real and apparent respiratory motions in human fMRI data. *NeuroImage*, 201, 116041. https://doi.org/10.1016/j.neuroimage.2019.116041
|
|
133
|
+
- Raj, D., Anderson, A. W., & Gore, J. C. (2001). Respiratory effects in human functional magnetic resonance imaging due to bulk susceptibility changes. *Physics in Medicine and Biology*, 46(12), 3331–3340. https://doi.org/10.1088/0031-9155/46/12/318
|
|
134
|
+
|
|
135
|
+
## Citation and licence
|
|
136
|
+
|
|
137
|
+
MIT Licence (see [LICENSE](LICENSE)). Citation metadata is provided in [CITATION.cff](CITATION.cff).
|
phrenic-0.1.0/README.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/brain-body-cognition/phrenic/main/docs/assets/logo.png" alt="phrenic logo" width="440">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<strong>Mechanistic modelling of human breathing across physiological sensors.</strong>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
`phrenic` models a breathing human in pure NumPy and SciPy and projects one shared physiological trajectory simultaneously onto airway, chest-wall, cardiac, and neuroimaging sensors.
|
|
10
|
+
|
|
11
|
+
- **Lung and chest-wall mechanics:** One- and two-unit nonlinear Rohrer-RC lung mechanics with post-inspiratory braking, dynamic hyperinflation, Konno-Mead ribcage-abdomen phase lag, and 13 named resting, airway-narrowing, restrictive, ageing, and sleep presets.
|
|
12
|
+
- **Coupled multi-sensor forward models:** Calibrated airway flow, quadratic nasal cannula pressure with oral leak, branched dead-space capnography, thermal thermistor lag, dual DC RIP, AC scanner belt (with rail clipping and loose-strap freezes), thoracic impedance, QRS-modulated ECG, finger PPG with pulsus paradoxus, MEG head-coil nodding, sub-TR and whole-volume MRI B0 shifts, and two-pool CO₂ BOLD waves.
|
|
13
|
+
- **Cross-sensor replay:** Anchor the breathing clock to one recorded sensor (airflow, belt, dual RIP, capnogram, or ECG) and generate 5th–95th percentile envelopes across the unobserved sensors, with optional demographic lifespan priors.
|
|
14
|
+
- **Interactive browser companion:** Explore the same mechanics live with 3D anatomy, 2D cutaway, and bell-jar views in the [interactive breathing simulator](https://brain-body-cognition.github.io/phrenic/).
|
|
15
|
+
|
|
16
|
+

|
|
17
|
+
|
|
18
|
+
*Live browser companion to `phrenic` across resting, airway-narrowing, stiff-lung, and sleep regimes.*
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Install
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
python -m pip install phrenic
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`phrenic` requires Python 3.11+ and depends only on `numpy`, `scipy`, `pandas`, and `matplotlib`.
|
|
29
|
+
|
|
30
|
+
## Quickstart
|
|
31
|
+
|
|
32
|
+
### Command line
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
# List all 13 named physiological and sleep presets
|
|
36
|
+
phrenic presets
|
|
37
|
+
|
|
38
|
+
# Generate coupled recordings with a sigh, a peak breath hold, rail clipping, and a loose strap
|
|
39
|
+
phrenic simulate --out demo --preset quiet_rest --duration-s 90 \
|
|
40
|
+
--sigh-times 18 --hold 42:6 --hold-phase peak \
|
|
41
|
+
--belt-clip-quantile 0.92 --loose 68:5
|
|
42
|
+
|
|
43
|
+
# Moderate resting bronchoconstriction (lower tPTEF/Te, shark-fin capnogram, dynamic hyperinflation)
|
|
44
|
+
phrenic simulate --out demo-narrow --preset moderate_bronchoconstriction --duration-s 90
|
|
45
|
+
|
|
46
|
+
# Project a recorded belt or airflow file across unobserved sensors with 90% envelopes
|
|
47
|
+
phrenic replay demo/flow.csv --source airflow --fs 100 --age 35 --sex female --out demo-replay
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+

|
|
51
|
+
|
|
52
|
+
*Five coupled sensor views of one simulated breathing trace: airway flow, DC RIP vs. AC scanner belt (clipping at the sigh, decaying during the 6 s peak hold, and freezing during a loose-strap window), nasal cannula pressure, sub-TR vs. whole-volume MRI sampling, and chest ECG.*
|
|
53
|
+
|
|
54
|
+
### Python API
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
from phrenic import (
|
|
58
|
+
simulate_respiration,
|
|
59
|
+
simulate_sensors_from_flow,
|
|
60
|
+
simulate_two_pool_co2,
|
|
61
|
+
replay_sensor_array,
|
|
62
|
+
solve_lung_mechanics,
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
# 1. Forward multi-sensor simulation from a named preset
|
|
66
|
+
sim = simulate_respiration(
|
|
67
|
+
duration_s=90,
|
|
68
|
+
preset="mild_bronchoconstriction",
|
|
69
|
+
sigh_times_s=(25,),
|
|
70
|
+
belt_clip_quantile=0.92,
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
# 2. Run recorded spirometry through the Konno-Mead chest wall and sensor models
|
|
74
|
+
replayed = simulate_sensors_from_flow(sim["flow_l_s"], fs=sim["fs"], mri_tr_s=1.8)
|
|
75
|
+
|
|
76
|
+
# 3. Two-pool alveolar and arterial CO2 kinetics -> delayed cortical BOLD
|
|
77
|
+
gas = simulate_two_pool_co2(sim["flow_l_s"], fs=sim["fs"])
|
|
78
|
+
|
|
79
|
+
# 4. Project one recorded sensor across unobserved sensors with 90% intervals
|
|
80
|
+
env = replay_sensor_array(sim["ac_belt"], fs=sim["fs"], source="belt", age=42, sex="female")
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Working with `neuroresp`
|
|
84
|
+
|
|
85
|
+
`phrenic` is the sister package to [`neuroresp`](https://github.com/brain-body-cognition/neuroresp). `phrenic` runs forward from respiratory physiology to coupled sensor signals; `neuroresp` works backwards from recorded fMRI, MEG, ECG, belts, and airflow to recover breathing and clean neuroimaging scans. The CSV, BIDS-physio TSV/JSON, and NPZ files written by `phrenic simulate` plug directly into `neuroresp airflow`, `neuroresp belt`, `neuroresp meg`, and `neuroresp fuse`.
|
|
86
|
+
|
|
87
|
+
## Documentation
|
|
88
|
+
|
|
89
|
+
The documentation site is at [brain-body-cognition.github.io/phrenic/docs](https://brain-body-cognition.github.io/phrenic/docs/).
|
|
90
|
+
|
|
91
|
+
- [Model & Calibration](docs/model.md): architecture, lung and chest-wall equations, physiological parameter map, 30-adult quiet-rest validation figures, and sensor calibration status.
|
|
92
|
+
- [Interactive breathing simulator](https://brain-body-cognition.github.io/phrenic/): browser-based version of the lung and sensor core.
|
|
93
|
+
|
|
94
|
+
## References
|
|
95
|
+
|
|
96
|
+
- Albanese, A., Cheng, L., Ursino, M., & Chbat, N. W. (2016). An integrated mathematical model of the human cardiopulmonary system: model development. *American Journal of Physiology-Heart and Circulatory Physiology*, 310(7), H899–H921. https://doi.org/10.1152/ajpheart.00230.2014
|
|
97
|
+
- Bates, J. H. T. (2009). *Lung Mechanics: An Inverse Modeling Approach*. Cambridge University Press. https://doi.org/10.1017/CBO9780511627156
|
|
98
|
+
- Birn, R. M., Smith, M. A., Jones, T. B., & Bandettini, P. A. (2008). The respiration response function: The temporal dynamics of fMRI signal fluctuations related to changes in respiration. *NeuroImage*, 40(2), 644–654. https://doi.org/10.1016/j.neuroimage.2007.11.059
|
|
99
|
+
- Charlton, P. H., Bonnici, T., Tarassenko, L., Clifton, D. A., Beale, R., & Watkinson, P. J. (2017). Extraction of respiratory signals from the electrocardiogram and photoplethysmogram: technical and physiological determinants. *Physiological Measurement*, 38(5), 669–690. https://doi.org/10.1088/1361-6579/aa670e
|
|
100
|
+
- Konno, K., & Mead, J. (1967). Measurement of the separate volume changes of rib cage and abdomen during breathing. *Journal of Applied Physiology*, 22(3), 407–422. https://doi.org/10.1152/jappl.1967.22.3.407
|
|
101
|
+
- Otis, A. B., McKerrow, C. B., Bartlett, R. A., Mead, J., McIlroy, M. B., Selverstone, N. J., & Radford, E. P. (1956). Mechanical factors in distribution of pulmonary ventilation. *Journal of Applied Physiology*, 8(4), 427–443. https://doi.org/10.1152/jappl.1956.8.4.427
|
|
102
|
+
- Power, J. D., Lynch, C. J., Silver, B. M., Dubin, M. J., Martin, A., & Jones, R. M. (2019). Distinctions among real and apparent respiratory motions in human fMRI data. *NeuroImage*, 201, 116041. https://doi.org/10.1016/j.neuroimage.2019.116041
|
|
103
|
+
- Raj, D., Anderson, A. W., & Gore, J. C. (2001). Respiratory effects in human functional magnetic resonance imaging due to bulk susceptibility changes. *Physics in Medicine and Biology*, 46(12), 3331–3340. https://doi.org/10.1088/0031-9155/46/12/318
|
|
104
|
+
|
|
105
|
+
## Citation and licence
|
|
106
|
+
|
|
107
|
+
MIT Licence (see [LICENSE](LICENSE)). Citation metadata is provided in [CITATION.cff](CITATION.cff).
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "phrenic"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Mechanistic lung, chest-wall, and multi-sensor modelling of human breathing in Python"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
requires-python = ">=3.11"
|
|
13
|
+
authors = [{ name = "Shane Lindsay" }]
|
|
14
|
+
keywords = [
|
|
15
|
+
"respiration",
|
|
16
|
+
"breathing",
|
|
17
|
+
"lung-mechanics",
|
|
18
|
+
"physiology",
|
|
19
|
+
"capnography",
|
|
20
|
+
"spirometry",
|
|
21
|
+
"RIP",
|
|
22
|
+
"ECG",
|
|
23
|
+
"PPG",
|
|
24
|
+
"simulation",
|
|
25
|
+
]
|
|
26
|
+
classifiers = [
|
|
27
|
+
"Development Status :: 4 - Beta",
|
|
28
|
+
"Intended Audience :: Science/Research",
|
|
29
|
+
"Operating System :: OS Independent",
|
|
30
|
+
"Programming Language :: Python :: 3.11",
|
|
31
|
+
"Programming Language :: Python :: 3.12",
|
|
32
|
+
"Programming Language :: Python :: 3.13",
|
|
33
|
+
"Topic :: Scientific/Engineering :: Medical Science Apps.",
|
|
34
|
+
]
|
|
35
|
+
dependencies = [
|
|
36
|
+
"numpy>=1.26",
|
|
37
|
+
"scipy>=1.11",
|
|
38
|
+
"pandas>=2.0",
|
|
39
|
+
"matplotlib>=3.8",
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
[project.urls]
|
|
43
|
+
Homepage = "https://brain-body-cognition.github.io/phrenic/"
|
|
44
|
+
Repository = "https://github.com/brain-body-cognition/phrenic"
|
|
45
|
+
Issues = "https://github.com/brain-body-cognition/phrenic/issues"
|
|
46
|
+
Documentation = "https://brain-body-cognition.github.io/phrenic/docs/"
|
|
47
|
+
|
|
48
|
+
[project.optional-dependencies]
|
|
49
|
+
dev = ["pytest>=8.0", "ruff>=0.5"]
|
|
50
|
+
|
|
51
|
+
[project.scripts]
|
|
52
|
+
phrenic = "phrenic.cli:main"
|
|
53
|
+
|
|
54
|
+
[tool.setuptools]
|
|
55
|
+
package-dir = { "" = "src" }
|
|
56
|
+
|
|
57
|
+
[tool.setuptools.packages.find]
|
|
58
|
+
where = ["src"]
|
|
59
|
+
|
|
60
|
+
[tool.pytest.ini_options]
|
|
61
|
+
testpaths = ["tests"]
|
phrenic-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"""Mechanistic lung, chest-wall, and multi-sensor modelling of human breathing."""
|
|
2
|
+
|
|
3
|
+
__version__ = "0.1.0"
|
|
4
|
+
|
|
5
|
+
from .api import simulate_respiration, simulate_sensors_from_flow
|
|
6
|
+
from .drive import simulate_mechanics_core
|
|
7
|
+
from .gas import simulate_two_pool_co2
|
|
8
|
+
from .mechanics import solve_lung_mechanics
|
|
9
|
+
from .plot import save_simulation_figure
|
|
10
|
+
from .presets import (
|
|
11
|
+
MECHANICS_PRESETS,
|
|
12
|
+
PRESET_SHARED_DEFAULTS,
|
|
13
|
+
resolve_mechanics_params,
|
|
14
|
+
)
|
|
15
|
+
from .replay import replay_sensor_array
|
|
16
|
+
from .sensors import (
|
|
17
|
+
apply_dc_rip_realism,
|
|
18
|
+
bold_rrf_from_volume,
|
|
19
|
+
capnogram_from_flow,
|
|
20
|
+
meg_head_coils_from_volume,
|
|
21
|
+
motion_artifact_wave,
|
|
22
|
+
thermistor_from_flow,
|
|
23
|
+
thoracic_impedance_from_chest,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
__all__ = [
|
|
27
|
+
"MECHANICS_PRESETS",
|
|
28
|
+
"PRESET_SHARED_DEFAULTS",
|
|
29
|
+
"__version__",
|
|
30
|
+
"apply_dc_rip_realism",
|
|
31
|
+
"bold_rrf_from_volume",
|
|
32
|
+
"capnogram_from_flow",
|
|
33
|
+
"meg_head_coils_from_volume",
|
|
34
|
+
"motion_artifact_wave",
|
|
35
|
+
"replay_sensor_array",
|
|
36
|
+
"resolve_mechanics_params",
|
|
37
|
+
"save_simulation_figure",
|
|
38
|
+
"simulate_mechanics_core",
|
|
39
|
+
"simulate_respiration",
|
|
40
|
+
"simulate_sensors_from_flow",
|
|
41
|
+
"simulate_two_pool_co2",
|
|
42
|
+
"solve_lung_mechanics",
|
|
43
|
+
"thermistor_from_flow",
|
|
44
|
+
"thoracic_impedance_from_chest",
|
|
45
|
+
]
|