Skip to content

Commit

Permalink
add entry_noise option (#41)
Browse files Browse the repository at this point in the history
Enable/Disable noise on entry nodes
  • Loading branch information
nico-canta authored Sep 16, 2024
1 parent 546b801 commit d40a16b
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

### v0.1.6
* New parameter `entry_noise` to enable or disable the endfeet activity on entry nodes. (#41)
* Add helper script to load archngv graphs and convert them in pickle binary format. (#40)

### v0.1.5
* Lazy import of mpi4py module (#27)

Expand Down
12 changes: 12 additions & 0 deletions astrovascpy/bloodflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,11 @@ def simulate_ou_process(
- np.ndarray: (nb_iteration, n_edges) radius values at each time-step for each edge.
"""

if "entry_noise" not in params:
raise BloodFlowError("Missing boolean parameter: entry_noise")
if not isinstance(params["entry_noise"], bool):
raise BloodFlowError("The parameter entry_noise must be true or false")

nb_iteration = round(simulation_time / time_step)
# nb_iteration_noise = number of time_steps before relaxation starts:
nb_iteration_noise = round(relaxation_start / time_step)
Expand Down Expand Up @@ -587,6 +592,13 @@ def simulate_ou_process(
if radii is not None:
graph.edge_properties.loc[end_df.index, "radius"] = radii[:, time_it]

if params["entry_noise"]:
radii_at_entry_edges = graph.edge_properties["radius"].iloc[input_edge].to_numpy()
else:
radii_at_entry_edges = (
graph.edge_properties["radius_origin"].iloc[input_edge].to_numpy()
)

radii_at_entry_edges = graph.edge_properties["radius"].iloc[input_edge].to_numpy()
input_flows = entry_speed[time_it] * np.pi * radii_at_entry_edges**2
else:
Expand Down
3 changes: 3 additions & 0 deletions astrovascpy/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ class VasculatureParams(TypedDict):
Args:
entry_noise: Boolean value to enable or disable the endfeet activity on entry nodes.
threshold_r: radius (µm) threshold. A radius smaller than the threshold is considered a capillary. A radius bigger than the threshold is considered an artery.
c_cap: constant used in the ROU parameter calibration for capillaries
Expand All @@ -62,6 +64,7 @@ class VasculatureParams(TypedDict):
blood_viscosity: float
base_pressure: float

entry_noise: NotRequired[bool]
c_cap: NotRequired[float]
c_art: NotRequired[float]
threshold_r: NotRequired[float]
Expand Down
2 changes: 1 addition & 1 deletion astrovascpy/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.

VERSION = "0.1.5"
VERSION = "0.1.6"
version = VERSION
2 changes: 2 additions & 0 deletions examples/data/params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ max_nb_inputs: 3 # maximum number of inputs to inject flow/pressure into vascula

base_pressure: 1.33e-3 # reference pressure in g * um^{-1} * s^{-2}. At resting state equal to the external pressure

# Enable/Disable endfeet activity on entry nodes.
entry_noise: true

### OU calibration parameters

Expand Down
1 change: 1 addition & 0 deletions tests/test_bloodflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def params():
"max_nb_inputs": 3,
"depth_ratio": 0.05,
"vasc_axis": 1,
"entry_noise": True,
"threshold_r": 3,
"max_r_capill": 1.38,
"t_2_max_capill": 2.7,
Expand Down

0 comments on commit d40a16b

Please sign in to comment.