neurorosettes.utilities#

Module Contents#

Classes#

Tissue

Class to represent a multicellular tissue through the cell cooridnates.

RectangularTissue

Class to represent a tissue that is a rectangular grid.

HexagonalTissue

Class to represent a tissue that is a hexagonal grid.

Animator

Class to render the simulaiton results through vedo.

Functions#

get_random_position(scaling_factor)

Returns the coordinates for a random position between -scaling_factor and scaling factor.

get_random_unit_vector([two_dimensions])

Returns a vector for a random point in a unit sphere.

class neurorosettes.utilities.Tissue(use_2d=True)[source]#

Bases: abc.ABC

Class to represent a multicellular tissue through the cell cooridnates.

Parameters

use_2d (bool) – If the cells are placed in a single plane or if the tissue is a 3D tissue.

abstract get_coordinates()[source]#

Returns the initial cell coordinates according to the tissue geometry

Return type

numpy.ndarray

class neurorosettes.utilities.RectangularTissue(size, spacing=16.0, use_2d=True)[source]#

Bases: Tissue

Class to represent a tissue that is a rectangular grid.

Parameters
  • size (float) – The domain bounds of the tissue.

  • spacing (float) – The distance between cell centres.

  • use_2d (bool) – If the cells are placed in a single plane or if the tissue is a 3D tissue.

get_coordinates()[source]#

Returns the initial cell coordinates according to the tissue geometry

Return type

numpy.ndarray

class neurorosettes.utilities.HexagonalTissue(size, spacing=20.0, use_2d=True)[source]#

Bases: Tissue

Class to represent a tissue that is a hexagonal grid.

Parameters
  • size (float) – The domain bounds of the tissue.

  • spacing (float) – The distance between cell centres.

  • use_2d (bool) – If the cells are placed in a single plane or if the tissue is a 3D tissue.

get_coordinates()[source]#

Returns the initial cell coordinates according to the tissue geometry

Return type

numpy.ndarray

neurorosettes.utilities.get_random_position(scaling_factor)[source]#

Returns the coordinates for a random position between -scaling_factor and scaling factor.

Parameters

scaling_factor (float) – The range of the interval where coorinates will be sampled from.

Return type

numpy.ndarray

neurorosettes.utilities.get_random_unit_vector(two_dimensions=False)[source]#

Returns a vector for a random point in a unit sphere.

Return type

numpy.ndarray

class neurorosettes.utilities.Animator[source]#

Class to render the simulaiton results through vedo.

show(interactive=False)[source]#

Shows the simulation results in a display window.

Parameters

interactive (bool) – If the plot should support user interaction.

update_clock(time_point)[source]#

Updates the simulation clock string with the new time point.

Parameters

time_point (float) – The new time point to be shown on the clock string.

Return type

None

add_grid(x_grid, y_grid)[source]#

Adds a 2D grid object to the middle plane of the domain.

Parameters
  • x_grid (numpy.ndarray) – The x coordinates of the cells of the grid.

  • y_grid (numpy.ndarray) – The y coordinates of the cell of the grid.

Return type

None

set_camera(height)[source]#

Places the plotter camera at a given height.

Parameters

height (float) – The height to place the camera at.

draw_spring(base_point, top_point, radius)[source]#

Plots a spring and a sphere to represent a cylinder object.

The spring connects the two points passed as coordinates, and a sphere is placed centred on the top point.

Parameters
  • base_point (numpy.ndarray) – The coordinates for the base of the spring.

  • top_point (numpy.ndarray) – The coordinates for the top of the spring.

  • radius (float) – The radius of the cylinder object.

draw_sphere(center, radius, **kwargs)[source]#

Plots a sphere to represent a sphere object.

Parameters
  • center (numpy.ndarray) – The coordinates for the sphere center.

  • radius (float) – The radius of the sphere.

Return type

vedo.Sphere

save_screenshot(file_name)[source]#

Saves the current rendering to a PNG file.

Parameters

file_name (str) – The name of the PNG file to be created.

Return type

None