[docs]def create_neurons(n=1, params=None, num_neurites=0, neurite_params=None,
neurite_names=None, culture=None, on_area=None,
neurites_on_area=False, return_ints=False, **kwargs):
'''
Create `n` neurons with specific parameters.
Parameters
----------
n : int, optional (default: 1)
params : dict, optional (default: None)
Parameters of the object (or shape object for obstacle).
neurite_params : dict, optional (default: same as `params`)
Specific parameters for neurite growth. Entries of the dict can
be lists to give different parameters for the neurites of each
neuron.
To provide different parameters for each neurite, one can
provide `neurite_params` as a dict of dict, with the neurite
names as keys.
num_neurites : int, optional (default: 0)
Number of neurites (same for all neurons).
neurite_names : list, optional (default: None)
Names of the neurites. If not provided, defaults to keys of
`dendrite_params`. If `dendrite_params` is also empty, defaults
to ["axon", "dendrite_1", dendrite_2", ...] (without "axon" if
the neurite has "has_axon" set to False).
culture : :class:`Shape`, optional (default: existing environment if any)
Spatial environment where the neurons will grow.
on_area : str or list, optional (default: everywhere in `culture`)
Restrict the space where neurons will be randomly seeded to an
area or a set of areas.
neurites_on_area : bool, str, area, or list, optional (default: False)
Restrict the points where neurites will extend from the soma.
This is typically used to account for the fact that, when seeded
on patterned surfaces, neurons will extend their neurites only
on the patterns.
If `True`, then `on_area` must be set and the same area will be
used. If `False`, neurite are not constrained.
return_ints : bool, optional (default: False)
Whether the neurons are returned as :class:`Neuron` objects or
simply as integers (the neuron gids).
Returns
-------
neurons : Neuron, Population, or ints
By default, returns a :class:`~dense.elements.Neuron` object if a
single neuron is requested, a
:class:`~dense.elements.Popuulation` if several neurons are
created, or a tuple of the neurons' GIDs if `return_ints` is
True.
Example
-------
Creating one neuron: ::
neuron_prop = {
"position": (5., 12.)*um,
"description": "my_special_neuron"
}
neurite_prop = {
"axon": {
"speed_growth_cone": 1.*um/hour,
"persistence_length": 300.*um
},
"dendrite_1": {"speed_growth_cone": 0.2*um/hour},
"dendrite_2": {"speed_growth_cone": 0.3*um/hour}
}
neuron = ds.create_neurons(params=neuron_prop,
num_neurites=3, # axon + 2 dendrites
neurite_params=neurite_prop)
Note
----
When specifying `num_neurites`, the first neurite created is an axon
unless `has_axon` is set to False, the subsequent neurites are
dendrites.
If `has_axon` is set to False, then only dendrites are created.
'''
pass
[docs]def create_neurites(neurons, num_neurites=1, params=None, angles=None,
names=None):
'''
Create neurites on the specified neurons.
Neurite types (axon or dendrite) are based on the neurite names: axon must
always be named "axon", all other names will be associated to a dendrite.
Parameters
----------
neurons : :class:`~dense.elements.Neuron`, list, or GIDs
Neurons on which neurites should be created.
num_neurites : int, optional (default: 1)
Number of neurites that will be added to each neuron.
params : dict, optional (default: None)
Parameters of the neurites.
angle : list, optional (default: automatically positioned)
Angles of the newly created neurites.
names : list, optional (default: "axon" and "dendrite_X")
Names of the created neurites, if not provided, will an "axon" or
a dendrite with default name "dendrite_X" (X being a number) will be
created, depending on whether the neuron is supposed to have an axon
or not, and depending on the number of pre-existing neurites.
Note
----
When using this function, the same number and types of neurites will
be created for each neuron; to create varying numbers, types, or
relative angles for the neurites, the function must be called
separately on the different sets of neurons.
'''
pass
[docs]def create_recorders(targets, observables, sampling_intervals=None,
start_times=None, end_times=None, levels="auto",
restrict_to=None, record_to="memory", buffer_size=100):
'''
Create recorders to monitor the state of target neurons in the environment.
One recorder is created on each thread containing target neurons for every
observable.
Note
----
One recorder records only from the neurons located on the same thread. This
means that, when using multithreading, several recorders might be created
even for only one observable if the target neurons are handled by several
different threads.
Note
----
For observables that are available at different levels, the recording at
the upper levels is the sum of the values at the lower levels.
E.g. for "length", the neurite level give the sum of all branch lengths and
the neuron level the sum of all neurite lengths.
Parameters
----------
targets : int or array of ints
Gids of the neurons to record from.
observables : string or list of strings
Names of the properties that will be recorded for each of the target
neurons. One recorder will be in charge of only one observable.
(see below for the list of possible observables)
sampling_intervals : int or list of ints, optional (default: resolution)
Interval between two successive recordings for a continuous observable,
expressed in seconds. Must be a multiple of the resolution for the
current simulation.
start_times : Time or list of Times, optional (default: initial time)
Time at which the recording should start. (not implemented yet)
end_times : Time or list of Times, optional (default: final time)
Time at which the recording should stop. (not implemented yet)
levels : string or list of strings, optional (default: "auto")
Level at which the observable should be recorded, if several levels are
possible (e.g. "length" can be measure at the "growth_cone", "neurite",
or full "neuron" level, each higher level being the sum of its
sublevels).
restrict_to : string or list of strings, optional (default: None)
Restrict recording to a specific neurite, either "axon" or one of the
dendrites ("dendriteX", with X the dendrite number).
record_to : string or list of strings (default: "memory")
Where the recordings should be stored. Default is in memory, otherwise
a filename can be passed, to which the recording will be saved.
buffer_size : int or list of ints, optional (default: 100)
Number of measurements that will be kept in memory before the recorder
writes to the file. Only used if `record_to` contains a filename.
Returns
-------
recorders : tuple
Gids of the recorders created. `recorders` contains one entry per value
in `observables` since at least recorder in created for each observable.
See also
--------
:func:`~dense.get_default_properties` to find the observables associated
to various elements; e.g. use
``ds.get_default_properties("neuron", "observables", False)`` to get the
available observables for a neuron.
'''
pass
[docs]def delete_neurons(neurons=None):
'''
Delete neurons.
Parameters
----------
neurons : list of neurons, optional (default: all neurons)
Neurons to delete.
'''
pass
[docs]def delete_neurites(neurite_names=None, neurons=None):
'''
Delete neurites.
Parameters
----------
neurite_names : str or list, optional (default: all neurites)
Neurites which will be deleted.
neurons : list of neurons, optional (default: all neurons)
Neurons for which the neurites will be deleted.
'''
pass
[docs]def generate_model(elongation, steering, direction_selection):
'''
Returns a Model object giving the method to use for each of the three main
properties:
- the elongation type (how the growth cone speed is computed)
- the steering method (how forces are exerted on the growth cone)
- the direction selection method (how the new direction is chosen at each
step)
Parameters
----------
elongation : str
Among "constant", "gaussian-fluctuations", or "resource-based".
steering : str
Among "pull-only", "memory-based", or "self-referential-forces"
(not yet).
direction_selection : str
Either "noisy-maximum", "noisy-weighted-average", or "run-and-tumble".
Returns
-------
model : the complete model.
Note
----
The properties of the model can be obtained through ``model.elongation``,
``model.steering`` and ``model.direction_selection``.
For more information on the models, see :ref:`pymodels`.
'''
pass
[docs]def generate_simulation_id(*args):
'''
Generate the Hash from the elements passed and add date and time of the
kernel initialization.
'''
pass
[docs]def get_environment():
'''
Return the environment as a :class:`~dense.environment.Shape` object.
'''
pass
[docs]def get_kernel_status(property_name=None):
'''
Get the configuration properties.
Parameters
----------
property_name : str, optional (default: None)
Name of the property that should be queried. By default, the full
configuration is returned.
Returns
-------
status : dict or specific type
Configuration: either a single value if `property_name` was specified,
or a dictionary containing the full configuration.
'''
pass
[docs]def get_simulation_id():
'''
Get the identifier for the simulation
'''
pass
[docs]def get_object_properties(obj, property_name=None, level=None,
neurite=None, settables_only=False,
return_iterable=False):
'''
Return the object's properties.
Parameters
----------
obj : Neuron, list of neurons/gids, Neurite or list of neurites
Elements for which the state will be returned.
property_name : str, optional (default: None)
Name of the property that should be queried. By default, the full
dictionary is returned.
level : str, optional (default: highest)
Level at which the status should be obtained (only for neurons).
Should be among "neuron", "neurite", or "growth_cone".
neurite : str optional (default: None)
Neurite of neurons `gids` that should be queried (either `axon` or
`dendrites`). By default, both dictionaries are returned inside the
neuronal status dictionary. If `neurite` is specified, only the
parameters of this neurite will be returned.
settables_only : bool, optional (default: False)
Return only settable values; read-only values are hidden.
return_iterable : bool, optional (default: False)
If true, returns a dict or an array, even if only one gid is
passed.
Returns
-------
status : variable
Properties of the objects' status:
* single value if `gids` contained only one node and
`property_name` was specified (unless `return_iterable` is True)
* ``dict`` if `gids` contained only one node and `property_name` was
not specified.
* array of values if `gids` contained several nodes and `property_name`
was specified.
* array of ``dict``s if `gids` contained several nodes and
`property_name` was not specified.
'''
pass
[docs]def get_object_state(obj, observable=None, level=None,
return_iterable=False):
'''
Return the state of a neuron or neurite at the current time.
Parameters
----------
obj : Neuron, list of neurons/gids, Neurite or list of neurites
Elements for which the state will be returned.
observable : str, optional (default: all observables)
Name of the property that should be queried.
level : str, optional (default: "neuron")
Level at which the status should be obtained (either "neuron",
"axon", or a specific dendrite name).
This entry is valid only if `obj` is a neuron or a list of
neurons.
return_iterable : bool, optional (default: False)
If true, returns a dict or an array, even if only one gid is
passed.
Returns
-------
state : float or list of floats
'''
pass
[docs]def get_object_type(gid):
'''
Return the type of the object associated to `gid`.
An error is thrown if the GID does not exist.
Parameters
----------
gid : int
The object GID in the simulator
Returns
-------
A string describing the object, e.g. "neuron" or "recorder".
'''
pass
[docs]def get_neurons(as_ints=False):
'''
Return the existing neurons
Parameters
----------
as_ints : bool, optional (default: False)
Whether only the ids of the neurons should be returned instead of
:class:`~dense.elements.Neuron` objects. Useful for large simulations
to reduce the memory footprint.
Returns
-------
A :class:~dense.elements.Population` object if several neurons are created,
a :class:`~dense.elements.Neuron` if a single neuron is created, or a tuple
of ints if `as_ints` is True.
'''
pass
[docs]def get_default_properties(obj, property_name=None, settables_only=True,
detailed=False):
'''
Returns the default status of an object.
Parameters
----------
obj : :obj:`str` or :class:`Model`.
Name of the object, among "recorder", "neuron", "neurite",
"axon", or "growth_cone", or a model, either as a string
(e.g. "cst_rw_wrc") or as a :class:`Model` object returned by
:func:`generate_model`.
property_name : str, optional (default: None)
Name of the property that should be queried. By default, the full
dictionary is returned.
settables_only : bool, optional (default: True)
Return only settable values; read-only values are hidden.
detailed : bool, optional (default: False)
If True, returns some of the options available for the substructures
(e.g. for a neuron, also returns the options of the neurite and growth
cone).
Returns
-------
status : dict
Default status of the object.
'''
pass
[docs]def get_models(abbrev=True):
'''
Get available models for an object type.
Parameters
----------
abbrev : bool, optional (default: True)
Whether to return only the abbreviated names of the models.
Returns
-------
models : dict
A dictionary containing the names of the models associated to their
respective :class:`Model` object.
See also
--------
:func:`~dense.generate_model`.
'''
pass
[docs]def get_recording(recorder, record_format="detailed"):
'''
Return the recorded data.
Parameters
----------
recorder : gid or list of gids
Id(s) of the recorder(s).
record_format : str, optional (default: "detailed")
Formatting of the record. This is only useful if the recording occurs at
neurite or growth cone level. If "detailed", is used, the record dict
first contains all neurons ids; each entry is then a new dict with the
neurite ids as entries; if level is "growth_cone", then there is a final
dict with the growth cone ids as entries. If "compact" is used,
only one id per recorded item is used; for growth cones.
Examples
--------
At neurite level:
>>> get_recording(rec)
>>> {
>>> observable: {
>>> neuron0: {"axon": [...], "dendrite1": [...], ...},
>>> neuron1: {"axon": [...], "dendrite1": [...], ...}, ...
>>> },
>>> "times": [...]
>>> }
>>> get_recording(rec, "compact")
>>> {
>>> observable: {
>>> "data": {
>>> (neuron0, "axon"): [...],
>>> (neuron0, "dendrite1"): [...], ...
>>> (neuron1, "axon"): [...], ...
>>> },
>>> "times": [...]}
>>> }
>>> }
'''
pass
[docs]def reset_kernel():
''' Reset the whole simulator. '''
pass
[docs]def set_kernel_status(status, value=None, simulation_id=None):
'''
Set the simulator's configuration.
Parameters
----------
status : dict or string
Dictionary containing the configuration options.
value : object, optional (default: None)
Used to set a single value.
simulation_id: str
Unique identifier of the simulation, generally
simulation_id = Hash(kernel_status, params)
Note
----
Available options are:
* ``"adaptive_timestep"`` (float) - Value by which the step should be
divided when growth cones are interacting. Set to -1 to disable adaptive
timestep.
* ``"environment_required"`` (bool) - Whether a spatial environment should
be provided or not.
* ``"interactions"`` (bool) - Whether neurites interact with one another.
* ``"max_allowed_resolution"`` (time) - Maximum timestep allowed.
* ``"num_local_threads"`` (int) - the number of OpenMP thread per MPI
process.
* ``"print_time"`` (bool) - whether time should be printed
during the simulation.
* ``"resolution"`` (time) - the simulation timestep.
* ``"seeds"`` (array) - array of seeds for the random number
generators (one per processus, total number needs to be the
same as `num_virtual_processes`)
'''
pass
[docs]def set_object_properties(objects, params=None, neurite_params=None):
'''
Update the status of the `objects` using the parameters contained in
`params`.
Parameters
----------
objects : object or int
Objects to update (either neurons or recorders).
params : dict, optional (default: None)
New parameters of the objects.
neurite_params : dict, optional (default: None)
New neurite parameters if `objects` are neurons.
'''
pass
[docs]def set_neurite_properties(neuron, neurite, params):
'''
Set the status of a specific neurite on a specific neuron.
Parameters
----------
neuron : :class:`~dense.elements.Neuron` or int
Neuron containing the neurite to update.
neurite : :class:`~dense.elements.Neuron` or str
Neurite to update.
params : dict
Parameters of the neurite.
'''
pass
[docs]def simulate(time, force_resol=False):
'''
Simulate the growth of the neurons.
Parameters
----------
time : float or int (dimensionned quantity)
Duration of the simulation.
'''
pass
__all__ = [
'create_neurons',
'create_neurites',
'create_recorders',
'delete_neurons',
'delete_neurites',
'generate_model',
'generate_simulation_id',
'get_environment',
'get_kernel_status',
'get_simulation_id',
'get_object_properties',
'get_object_state',
'get_object_type',
'get_neurons',
'get_default_properties',
'get_models',
'get_recording',
'reset_kernel',
'set_kernel_status',
'set_object_properties',
'set_neurite_properties',
'simulate',
]
def init(argv):
pass
def finalize():
pass