Skip to content

Commit

Permalink
Merge pull request #12 from mjt320/develop
Browse files Browse the repository at this point in the history
change AIF interpolation to linear
  • Loading branch information
mjt320 authored Feb 27, 2024
2 parents ca2f1fb + d4ff12e commit f0ccec1
Show file tree
Hide file tree
Showing 17 changed files with 174 additions and 131 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ dmypy.json
cython_debug/

# User-specific stuff
.idea/
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
Expand Down
3 changes: 0 additions & 3 deletions .idea/.gitignore

This file was deleted.

1 change: 0 additions & 1 deletion .idea/.name

This file was deleted.

18 changes: 0 additions & 18 deletions .idea/SEPAL.iml

This file was deleted.

9 changes: 0 additions & 9 deletions .idea/codeStyles/Project.xml

This file was deleted.

5 changes: 0 additions & 5 deletions .idea/codeStyles/codeStyleConfig.xml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/inspectionProfiles/profiles_settings.xml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/other.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

84 changes: 72 additions & 12 deletions demo/demo_fit_dce.ipynb

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions demo/demo_interpolation.ipynb

Large diffs are not rendered by default.

60 changes: 54 additions & 6 deletions demo/demo_pk_models.ipynb

Large diffs are not rendered by default.

44 changes: 29 additions & 15 deletions demo/demo_simulation.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "sepal"
version = "1.0.1"
version = "1.0.2"
description = "Quantitative MRI processing"
readme = "README.md"
authors = [{ name = "Michael Thrippleton", email = "[email protected]" }]
Expand Down
11 changes: 1 addition & 10 deletions src/sepal/aifs.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from abc import ABC, abstractmethod

import numpy as np
from scipy.interpolate import interp1d, Akima1DInterpolator


class AIF(ABC):
Expand Down Expand Up @@ -71,19 +70,11 @@ def __init__(self, t_data, c_ap_data):
"""
self.t_data = t_data
self.c_ap_data = c_ap_data
self.c_ap_func = Akima1DInterpolator(t_data, c_ap_data)

def c_ap(self, t):
"""Get AIF plasma concentration(t). Overrides superclass method."""
# calculate concentration(t) using interpolation function
c_ap = self.c_ap_func(t)
# replace values outside time range with first/last values
idx_before = t < min(self.t_data)
idx_after = t > max(self.t_data)
c_ap_before = self.c_ap_data[0]
c_ap_after = self.c_ap_data[-1]
c_ap[idx_before] = c_ap_before
c_ap[idx_after] = c_ap_after
c_ap = np.interp(t, self.t_data, self.c_ap_data)
return c_ap


Expand Down

0 comments on commit f0ccec1

Please sign in to comment.