-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introducing Two Compartment exchange Model #48
Open
MohamedNasser8
wants to merge
11
commits into
main
Choose a base branch
from
Two-CXM
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+249
−3
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
1639ce5
Initial implementation for 2CXM
MohamedNasser8 5216dad
Add test for 2cxm
MohamedNasser8 1a91070
Add some tests
MohamedNasser8 1429150
Merge branch 'main' into Two-CXM
MohamedNasser8 6dd6763
Added 2CXM documentation and example
MohamedNasser8 2188bf5
Added use case and corrected units
MohamedNasser8 2ae41e2
Added initial implementation for two compartment exchange model
MohamedNasser8 f40ae1a
Added TCXM adapted from MJT implementation
MohamedNasser8 50cd665
Corrected some errors
MohamedNasser8 3535067
some fixes
MohamedNasser8 c703ed6
Add some tests
MohamedNasser8 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
""" | ||
============= | ||
The Two Compartment Exchange Model | ||
============= | ||
|
||
Simulating tissue concentrations from two compartment models with different settings. | ||
""" | ||
|
||
import matplotlib.pyplot as plt | ||
|
||
# %% | ||
# Import necessary packages | ||
import numpy as np | ||
import osipi | ||
|
||
# %% | ||
# Generate Parker AIF with default settings. | ||
|
||
# Define time points in units of seconds - in this case we use a time | ||
# resolution of 1 sec and a total duration of 6 minutes. | ||
t = np.arange(0, 5 * 60, 1, dtype=float) | ||
|
||
# Create an AIF with default settings | ||
ca = osipi.aif_parker(t) | ||
|
||
# %% | ||
# Plot the tissue concentrations for an extracellular volume fraction | ||
# of 0.2, plasma volume fraction of 0.1, permeability serface area of 5 ml/min | ||
# and flow rate of 10 ml/min | ||
PS = 15 # Permeability surface area product in ml/min | ||
Fp = [10, 25] # Flow rate in ml/min | ||
ve = 0.1 # Extracellular volume fraction | ||
vp = [0.1, 0.02] # Plasma volume fraction | ||
|
||
ct = osipi.two_compartment_exchange_model(t, ca, Fp=Fp[0], PS=PS, ve=ve, vp=vp[0]) | ||
plt.plot(t, ct, "b-", label=f" Fp = {Fp[0]},PS = {PS}, ve = {ve}, vp = {vp[0]}") | ||
|
||
ct = osipi.two_compartment_exchange_model(t, ca, Fp=Fp[1], PS=PS, ve=ve, vp=vp[0]) | ||
plt.plot(t, ct, "r-", label=f" Fp = {Fp[1]},PS = {PS}, ve = {ve}, vp = {vp[0]}") | ||
|
||
ct = osipi.two_compartment_exchange_model(t, ca, Fp=Fp[0], PS=PS, ve=ve, vp=vp[1]) | ||
plt.plot(t, ct, "g-", label=f" Fp = {Fp[0]},PS = {PS}, ve = {ve}, vp = {vp[1]}") | ||
|
||
ct = osipi.two_compartment_exchange_model(t, ca, Fp=Fp[1], PS=PS, ve=ve, vp=vp[1]) | ||
plt.plot(t, ct, "y-", label=f" Fp = {Fp[1]},PS = {PS}, ve = {ve}, vp = {vp[1]}") | ||
|
||
|
||
plt.xlabel("Time (sec)") | ||
plt.ylabel("Tissue concentration (mM)") | ||
plt.legend() | ||
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# osipi.Two Compartment Exchange Model | ||
|
||
::: osipi.two_compartment_exchange_model | ||
|
||
|
||
## Example using `osipi.two_compartment_exchange_model` | ||
|
||
<figure class="mkd-glr-thumbcontainer" tooltip="Simulating tissue concentrations from two compartment exchange model with different settings."> | ||
<img alt="The Two Compartment Exchange Model" src="..\..\..\..\generated\gallery\tissue\images\thumb\mkd_glr_plot_two_cxm_thumb.png" /> | ||
<figcaption class="caption"> | ||
<span class="caption-text"> | ||
<a class="reference internal" href="..\..\..\..\generated\gallery\tissue\plot_two_cxm"> | ||
<span class="std std-ref">The Two Compartment Exchange Model</span> | ||
</a> | ||
</span> | ||
</figcaption> | ||
</figure> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
|
||
- [tofts](tofts.md) | ||
- [extended_tofts](extended_tofts.md) | ||
- [two_cxm](2cxm.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ltorres6 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Permeability-surface area product is PS not Ps
volume fractions are small letters not capitals
Volume fractions in CAPLEX are ml/100ml
Flow in CAPLEX is in ml/100ml/min
PS is in ml/100ml/min
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MohamedNasser8 if you have fixed these please resolve this comment