neurorosettes.simulation#

This module deals with the neuron structure and functions

Module Contents#

Classes#

Timer

Class to store the simulation time data.

Container

Class that represents the environment where neurons exist.

Simulation

Class to create and run a simulation.

Functions#

ccw(A, B, C)

intersect(A, B, C, D)

neurorosettes.simulation.ccw(A, B, C)[source]#
neurorosettes.simulation.intersect(A, B, C, D)[source]#
class neurorosettes.simulation.Timer[source]#

Class to store the simulation time data.

total_time :float#

The total time of a simulation (in minutes).

step :float#

The time between simulation points (in minutes).

current_time :float = 0.0#

The current time point of the simulation.

get_progress_bar()[source]#

Returns a progress bar with the simulation time

Return type

vedo.ProgressBar

class neurorosettes.simulation.Container(grid, simulation_2d, neuron_factory, contact_factory, drag_coefficient=10.0, density_check=None)[source]#

Class that represents the environment where neurons exist.

Parameters
set_density_check(density_check)[source]#

Sets the contact inhibition function to be used before proliferation.

Parameters

density_check (neurorosettes.grid.CellDensityCheck) – The contact inhibition function to be used.

Return type

None

register_neuron(neuron, color='gray')[source]#

Registers a neuron and its representation into the container.

Parameters
  • neuron (neurorosettes.neurons.Neuron) – The new neuron to be registered.

  • color – The color of the sphere that will represent the new neuron in the renderings of the simulation.

Return type

None

update_drawings()[source]#

Updates the representations of the neurons

Return type

None

advance_cycles(time_step)[source]#

Updates the biological clocks of every object in the simulation.

Parameters

time_step (float) – The time between simulation time points.

Return type

None

create_new_neuron(coordinates, outgrowth_axis=None, color='darkblue')[source]#

Creates a new neuron and registers it to the container’s grid.

The new neuron is created as an undifferentiated cell body centred at the passed coordinates. An outgrowth axis vector can be passed to model neurite outgrowth along this direction.

Parameters
  • coordinates (Union[numpy.ndarray, List[float]]) – The center position of the neuron’s cell body.

  • outgrowth_axis (Optional[Union[List[float], numpy.ndarray]]) – The direction of growth of the neuron’s neurites.

  • color – The color of the new neurite in the simulation renders.

Return type

neurorosettes.neurons.Neuron

differentiate()[source]#

Checks for neurons that are flagged for differentiation and deals with differentiation

Return type

None

kill()[source]#

Checks for neurons that are flagged for death and removes them from the container

Return type

None

divide()[source]#

Checks for neurons that are flagged for division and deals with division

Return type

None

get_displacement_from_force(force, time_step)[source]#

Returns the displacemnt value that a force originates, based on the equation of motion.

Parameters
  • force (numpy.ndarray) – The force value to be converted to a displacement

  • time_step (float) – The time passed between simulation time points.

Return type

numpy.ndarray

move_cell(neuron, new_coordinates)[source]#

Moves the cell to a new position and updates the proximal point of the first neurite.

Parameters
  • neuron (neurorosettes.neurons.Neuron) – The neuron object to be moved.

  • new_coordinates (Union[numpy.ndarray, List[float]]) – The new coordinates to be assigned to the cell body’s centre.

Return type

None

move_neurite(neurite, new_coordinates)[source]#

Deals with moving a neurite’s distal point and updating it on the grid.

Parameters
  • neurite (neurorosettes.subcellular.Neurite) – The neurite object to be moved.

  • new_coordinates (numpy.ndarray) – The new coordinates to be assigned to the neurite’s distal point.

Return type

None

compute_displacements(time_step)[source]#

Computes the displacement for each object based on the resulting force.

Parameters

time_step – The time passed between simulation time points.

Return type

None

update_cell_positions()[source]#

Updates the positions of all the simulation objects based on their velocity.

Return type

None

solve_mechanics(time_step)[source]#

Solves the mechanical interactions and updates the neurons’ positions.

Goes through each object and computes the resulting force acting on it, then gets the object’s velocity based on the equation of motion. When all of the objects are checked, the positions are updated based on the calculated velocity.

Parameters

time_step – The time passed between simulation time points.

Return type

None

class neurorosettes.simulation.Simulation(timer, container)[source]#

Class to create and run a simulation.

Parameters
  • timer (Timer) – The structure to store the time data of the simulation.

  • container (Container) – The structure to store the spatial data of the simulation.

run()[source]#

Runs the entire simulation by solving the mechanics at each time point.

Return type

None

save_meshes(file_name)[source]#

Saves the neurons as PLY objects. Cell bodies are saved as spheres. Neurites are saved as cylinders.

Parameters

file_name (str) –

Return type

None

classmethod from_file(config_path)[source]#

Initializes a Simulation object from a YAML config file.

Parameters

config_path (Union[pathlib.Path, str]) – The path to the YAML file config file.

Return type

Simulation