astrovascpy.bloodflow

Functions

boundary_flows_A_based(graph, entry_nodes, ...)

Compute the boundary flows on the exit nodes based on their areas.

compute_edge_resistances(radii, blood_viscosity)

Compute the resistances as a function of radii.

compute_static_laplacian(graph, blood_viscosity)

Compute the time-independent Laplacian.

construct_static_incidence_matrix(graph)

Compute the oriented graph opposite and transposed incidence matrix for static computations.

generate_endfeet(graph, endfeet_coverage, seed)

Generates endfeet ids on randomly selected edges :param graph: :type graph: utils.Graph :param endfeet_coverage: Percentage of edges connected with endfeet.

get_closest_edges(args, graph)

Get a list of the closest edges ids (section_id, segment_id) from the starting edge.

get_radii_at_endfeet(graph)

Get the radii at endfeet.

get_radius_at_endfoot(graph, endfoot_id)

Get the radius at endfoot.

set_edge_resistances(graph, blood_viscosity)

Set the edge resistances on graph.edge_properties.

set_endfeet_ids(graph, edge_ids, endfeet_ids)

Set endfeet ids to graph.edge_properties.

set_endfoot_id(graph, endfoot_id, ...)

Set endfoot_id on (section_id, segment_id) edge.

set_radii_at_endfeet(graph, endfeet_radii)

Set radii at endfeet.

set_radius_at_endfoot(graph, endfoot_id, ...)

Set radius at endfoot.

simulate_ou_process(graph, entry_nodes, ...)

Update value according to the reflected Ornstein-Ulenbeck.

simulate_vasodilation_ou_process(graph, dt, ...)

Simulate vasodilation according to the Ornstein-Uhlenbeck process.

update_static_flow_pressure(graph, ...[, ...])

Compute the time-independent pressure and flow.

astrovascpy.bloodflow.boundary_flows_A_based(graph: Graph, entry_nodes: ndarray[Any, dtype[float64]], input_flows: ndarray[Any, dtype[float64]]) ndarray[Any, dtype[float64]]

Compute the boundary flows on the exit nodes based on their areas.

Parameters:
  • graph (Graph) – graph containing point vasculature skeleton.

  • entry_nodes (numpy.array) – Ids of the entry nodes.

  • input_flows (numpy.array) – Flows on the entry nodes.

Returns:

boundary flow vector for every node in the graph.

Return type:

np.ndarray

Concerns: This function is part of the public API. Any change of signature or functional behavior may be done thoroughly.

astrovascpy.bloodflow.compute_edge_resistances(radii, blood_viscosity, with_hematocrit=True)

Compute the resistances as a function of radii.

Parameters:
  • radii (numpy.array) – (nb_edges, ) radii of each edge (units: µm).

  • blood_viscosity (float) – 1.2e-6, standard value of the plasma viscosity \(g\, \mu m^{-1}\, s^{-1}\). Should be between 0 and 1.

  • with_hematocrit (bool) – consider hematrocrit for resistance model

Returns:

resistances’ values per edge.

Return type:

float

Raises:

BloodFlowError – if blood_viscosity < 0 or >= 1.

astrovascpy.bloodflow.compute_static_laplacian(graph, blood_viscosity, with_hematocrit=True)

Compute the time-independent Laplacian.

Parameters:
  • graph (utils.Graph) – graph containing point vasculature skeleton.

  • blood_viscosity (float) – plasma viscosity in \(g\, \mu m^{-1}\, s^{-1}\).

  • with_hematocrit (bool) – consider hematrocrit for resistance model.

Returns:

laplacian matrix

Return type:

scipy.sparse.csc_matrix

astrovascpy.bloodflow.construct_static_incidence_matrix(graph)

Compute the oriented graph opposite and transposed incidence matrix for static computations.

Parameters:

graph (utils.Graph) – graph containing point vasculature skeleton.

Returns:

returns the opposite and transposed incidence matrix of graph (considered as directed graph, -1: incident nodes, 1: out nodes).

Return type:

scipy.sparse.csc_matrix

astrovascpy.bloodflow.generate_endfeet(graph, endfeet_coverage, seed)

Generates endfeet ids on randomly selected edges :param graph: :type graph: utils.Graph :param endfeet_coverage: Percentage of edges connected with endfeet. :type endfeet_coverage: float :param seed: random number generator seed. :type seed: int

astrovascpy.bloodflow.get_closest_edges(args, graph)

Get a list of the closest edges ids (section_id, segment_id) from the starting edge.

Explore the graph starting from an edge until endfeet_length is depleted.

Parameters:
  • args (tuple) – (3,) with args[0] being segment_id (int) i.e. id of the corresponding segment, args[1] section_id (int) i.e. id of the corresponding section and args[2], endfeet_length (float) i.e. is the corresponding endfoot length in µm.

  • graph (utils.Graph) – graph containing point vasculature skeleton.

Returns:

list of edges close to the original edge id.

Return type:

np.ndarray

Raises:

BloodFlowError – if endfoot_id does not correspond to a real endfoot id in the graph.

astrovascpy.bloodflow.get_radii_at_endfeet(graph)

Get the radii at endfeet.

Parameters:

graph (utils.Graph) – graph containing point vasculature skeleton.

Returns:

(endfeet_id, radius) pandas dataframe with endfeet_id and corresponding radius.

Return type:

DataFrame

astrovascpy.bloodflow.get_radius_at_endfoot(graph, endfoot_id)

Get the radius at endfoot.

Parameters:
  • graph (utils.Graph) – graph containing point vasculature skeleton.

  • endfoot_id (int) – is the corresponding endfoot id.

Returns:

corresponding radius.

Return type:

Float

Raises:

BloodFlowError – if endfoot_id does not correspond to a real endfoot id in the graph.

astrovascpy.bloodflow.set_edge_resistances(graph, blood_viscosity, with_hematocrit=True)

Set the edge resistances on graph.edge_properties.

Parameters:
  • graph (utils.Graph) – graph containing point vasculature skeleton.

  • blood_viscosity (float) – 1.2e-6 , standard value of the plasma viscosity (g.µm^-1.s^-1).

  • with_hematocrit (bool) – consider hematrocrit for resistance model.

astrovascpy.bloodflow.set_endfeet_ids(graph, edge_ids, endfeet_ids)

Set endfeet ids to graph.edge_properties.

Parameters:
  • graph (utils.Graph) – graph containing point vasculature skeleton.

  • edge_ids (pandas IndexSlice) – is the corresponding id for each edge.

  • endfeet_ids (numpy.array) – (nb_endfeet_ids,) is the corresponding endfeet ids.

Raises:

BloodFlowError – if edge_ids and endfeet_ids don’t have the same size.

astrovascpy.bloodflow.set_endfoot_id(graph, endfoot_id, section_id, segment_id, endfeet_length)

Set endfoot_id on (section_id, segment_id) edge.

Explore the graph starting from an edge until endfeet_length is depleted and set the explored edges to the endfoot_id.

Parameters:
  • graph (utils.Graph) – graph containing point vasculature skeleton.

  • endfoot_id (int) – id of the endfoot.

  • segment_id (int) – id of the corresponding segment.

  • section_id (int) – id of the corresponding section.

  • endfeet_length (float) – is the corresponding endfoot length in µm.

astrovascpy.bloodflow.set_radii_at_endfeet(graph, endfeet_radii)

Set radii at endfeet.

Parameters:
  • graph (utils.Graph) – raph containing point vasculature skeleton.

  • endfeet_radii (DataFrame) – (endfeet_id, radius) pandas dataframe with endfeet_id and the corresponding radius.

astrovascpy.bloodflow.set_radius_at_endfoot(graph, endfoot_id, endfoot_radius)

Set radius at endfoot.

Parameters:
  • graph (utils.Graph) – graph containing point vasculature skeleton.

  • endfoot_id (int) – is the corresponding endfoot id.

  • endfoot_radius (float or numpy.array) – corresponding radius.

Raises:

BloodFlowError – if endfoot_id does not correspond to a real endfoot id in the graph and if endfoot_radius < 0.

astrovascpy.bloodflow.simulate_ou_process(graph, entry_nodes, simulation_time, relaxation_start, time_step, entry_speed, params)

Update value according to the reflected Ornstein-Ulenbeck.

Parameters:
  • graph (utils.Graph) – graph containing point vasculature skeleton.

  • entry_nodes (numpy.array) – (nb_entry_nodes,) ids of entry_nodes.

  • simulation_time (float) – total time of the simulation, in seconds.

  • relaxation_start (float) – time at which the noise is set to zero.

  • time_step (float) – size of the time-step.

  • entry_speed (numpy.array)

  • params (VasculatureParams) – general parameters for vasculature.

Returns:

  • np.ndarray: (nb_iteration, n_edges) flow values at each time-step for each edge,

  • np.ndarray: (nb_iteration, n_nodes) pressure values at each time-step for each edge,

  • np.ndarray: (nb_iteration, n_edges) radius values at each time-step for each edge.

Return type:

tuple of 3 elements

astrovascpy.bloodflow.simulate_vasodilation_ou_process(graph, dt, nb_iteration, nb_iteration_noise, params)

Simulate vasodilation according to the Ornstein-Uhlenbeck process.

Parameters:
  • graph (Graph) – graph containing point vasculature skeleton.

  • dt (float) – time-step.

  • nb_iteration (int) – number of iteration.

  • nb_iteration_noise (int) – number of time steps with non-zero noise.

  • params (VasculatureParams) – general parameters for vasculature.

Returns:

(endfeet_id, time-step, nb_of_edge_per_endfoot) array where each edge is linked to the endfoot located at the edge’s position.

Return type:

np.ndarray

astrovascpy.bloodflow.update_static_flow_pressure(graph: Graph, input_flow: ndarray[Any, dtype[float64]], params: VasculatureParams, with_hematocrit: bool = True)

Compute the time-independent pressure and flow.

Parameters:
  • graph (utils.Graph) – graph containing point vasculature skeleton.

  • input_flow (numpy.array) – input flow for each graph node.

  • params (VasculatureParams) – general parameters for vasculature.

  • with_hematocrit (bool) – consider hematrocrit for resistance model

Concerns: This function is part of the public API. Any change of signature or functional behavior may be done thoroughly.