neurorosettes.simulation#
This module deals with the neuron structure and functions
Module Contents#
Classes#
Class to store the simulation time data. |
|
Class that represents the environment where neurons exist. |
|
Class to create and run a simulation. |
Functions#
|
|
|
- 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.
- 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:
grid (neurorosettes.grid.UniformGrid) – The grid where simulation objects will be stored, to improve neighbor interactions.
simulation_2d (bool) – If the simulation is 2D or 3D.
neuron_factory (neurorosettes.neurons.NeuronFactory) – The factory object to be used to create new neurons.
contact_factory (neurorosettes.physics.ContactFactory) – The factory object to be used to create interactions.
drag_coefficient (float) – The drag coefficient of the extracellular space.
density_check (Optional[neurorosettes.grid.CellDensityCheck]) – Optional contact inhibition function to inhibit proliferation when the cell density is too high.
- 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
- 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:
- 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:
- 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