Reference Documentation¶
Core module¶
-
class
cxsystem2.core.cxsystem.
CxSystem
(anatomy_and_system_config=None, physiology_config=None, output_file_suffix='', instantiated_from_array_run=0, cluster_run_start_idx=-1, cluster_run_step=-1, array_run_in_cluster=0, array_run_stdout_file=None)¶ The main object of cortical system module for building and running a customized model of cortical module based on the configuration files.
-
__init__
(anatomy_and_system_config=None, physiology_config=None, output_file_suffix='', instantiated_from_array_run=0, cluster_run_start_idx=-1, cluster_run_step=-1, array_run_in_cluster=0, array_run_stdout_file=None)¶ Initialize the cortical system by parsing both of the configuration files.
Parameters: - anatomy_and_system_config – could be either the path to the anatomy and system configuration file, or the dataframe containing the configuration data.
- output_file_suffix – switch the GeNN mode on/off (1/0), by default GeNN is off
- instantiated_from_array_run – this flag, 0 by default, determines whether this instance of CxSystem is instantiated from another instance of CxSystem which is running an array run.
- stdout_file_path – this is only used for saving arrayrun stdout Main internal variables:
- customized_neurons_list: This list contains the NeuronReference instances. So for each neuron group target line,
- there would be an element in this list which contains all the information for that particular neuron group.
- customized_synapses_list: This list contains the SynapseReference instances. Hence, for each synapse custom line,
- there would be an element in this list, containing all the necessary information.
- neurongroups_list: This list contains name of the NeuronGroup() instances that are placed in the Globals().
- synapses_name_list: This list contains name of the Synapses() instances that are placed in the Globals().
- monitor_name_bank: The dictionary containing the name of the monitors that are defined for any NeuronGroup() or Synapses().
- default_monitors: In case –> and <– symbols are used in the configuration file, this default monitor will be applied on all
- the target lines in between those marks.
- save_data: The save_data() object for saving the final data.
-
gather_result
()¶ After the simulation and using the syntaxes that are previously prepared in the syntax_bank of save_data() object, this method saves the collected data to a file.
-
monitors
(mon_args, object_name)¶ This method creates the Monitors() in brian2 based on the parameters that are extracted from a target line in configuration file.
Parameters: - mon_args – The monitor arguments extracted from the target line.
- object_name – The generated name of the current object.
Main internal variables:
- mon_tag: The tag that is extracted from the target line every time.
- mon_name: Generated variable name for a specific monitor.
- mon_str: The syntax used for building a specific StateMonitor.
- sub_mon_tags: The tags in configuration file that are specified for a StateMonitor(), e.g. in record=True which is specified by
- [rec]True in configuration file, [rec] is saved in sub_mon_tags
- sub_mon_args: The corresponding arguments of sub_mon_tags for a StateMonitor(), e.g. in record=True which is specified by
- [rec]True in configuration file, True is saved in sub_mon_args.
-
neuron_group
()¶ The method that creates the NeuronGroups() based on the parameters that are extracted from the configuration file in the __init__ method of the class.
Main internal variables:
- mon_args: contains the monitor arguments extracted from the target line.
- net_center: center position of the neuron group in visual field coordinates, description can be found in
- configuration file tutorial.
- _dyn_neurongroup_name: Generated variable name for the NeuronGroup() object in brian2.
- _dyn_neuronnumber_name: Generated variable name for corresponding Neuron Number.
- _dyn_neuron_eq_name: Generated variable name for the NeuronGroup() equation.
- _dyn_neuron_thres_name: Generated variable name for the NeuronGroup() threshold.
- _dyn_neuron_reset_name: Generated variable name for the NeuronGroup() reset value.
- _dyn_neuron_refra_name: Generated variable name for the NeuronGroup() refractory value.
- _dyn_neuron_namespace_name: Generated variable name for the NeuronGroup() namespace.
- ng_init: NeuronGroups() should be initialized with a random vm, ge and gi values. To address this, a 6-line code
- is generated and put in this variable, the running of which will lead to initialization of current NeuronGroup().
-
relay
()¶ The method that creates the relay NeuronGroups based on the parameters that are extracted from the configuration file in the __init__ method of the class. Note that the SpikeGeneratorGroup() does not support the locations and synaptic connection based on the distance between the input, and the target neuron group. For this reason, a “relay” neuron group is created which is directly connected to the SpikeGeneratorGroup(). Unlike SpikeGeneratorGroup() this relay group supports the locations. With this workaround, the synaptic connection between the input and the Neuron group can be implemented based on the distance of the neurons then.
Note: extracting the input spikes and time sequences for using in a SpikeGeneratorGroup() is done in this method. This procedure needs using a “run()” method in brian2. However, one of the limitations of the Brian2GeNN is that the user cannot use multiple “run()” methods in the whole script. To address this issue, the GeNN device should be set after using the first run(), hence the unusual placement of “set_device(‘genn’)” command in current method.
Note2: The radius of the VPM input is determined based on the Markram et al. 2015: The radius of the system is 210 um and the number of VPM input is 60 (page 19 of supplements). As for the radius of the VPM input, it is mentioned in the paper (page 462) that “neurons were arranged in 310 mini-columns at horizontal positions”. considering the area of the circle with radius of 210um and 60/310 mini-columns, the radius will be equal to 92um.
Main internal variables:
- inp: an instance of stimuli() object from stimuli module.
- relay_group: the dictionary containing the data for relay NeuronGroup()
- _dyn_neurongroup_name: Generated variable name for the NeuronGroup() object in brian2.
- _dyn_neuronnumber_name: Generated variable name for corresponding Neuron Number.
- _dyn_neuron_eq_name: Generated variable name for the NeuronGroup() equation.
- _dyn_neuron_thres_name: Generated variable name for the NeuronGroup() threshold.
- _dyn_neuron_reset_name: Generated variable name for the NeuronGroup() reset value.
- sg_syn_name: variable name for the Synapses() object that connects SpikeGeneratorGroup() and relay neurons.
following four variables are build using the load_input_seq() method in stimuli object:
- spikes_str: The string containing the syntax for Spike indices in the input neuron group.
- times_str: The string containing the syntax for time indices in the input neuron group.
- sg_str: The string containing the syntax for creating the SpikeGeneratorGroup() based on the input .mat file.
- number_of_neurons: The number of neurons that exist in the input .mat file.
-
synapse
()¶ The method that creates the Synapses() in brian2, based on the parameters that are extracted from the configuration file in the __init__ method of the class.
Main internal variables:
- mon_args: contains the monitor arguments extracted from the target line.
- args: normally args contains a set of arguments for a single Synapses() object.
- However, this changes when the post-synaptic neuron is the first (with index of 0) compartment of a multi-compartmental neuron. In this case, one might intend to target all three sub-compartments, i.e. Basal dendrites, Soma and proximal apical dendrites. So the single set of arguments will be changed to 3 sets of arguments and a for loop will take care of every one of them.
- dyn_syn_name: Generated variable name for the Synapses() object in brian2.
- _dyn_syn_eq_name: Generated variable name for the Synapses() equation.
- _dyn_syn_pre_eq_name: Generated variable name for pre_synaptic equations, i.e. “on_pre=…”
- _dyn_syn_post_eq_name: Generated variable name for post_synaptic equations, i.e. “on_post= …”
- _dyn_syn_namespace_name: Generated variable name for the Synapses() namespace.
- syn_con_str: The string containing the syntax for connect() method of a current Synapses() object. This string
- changes depending on using the [p] and [n] tags in the configuration file.
-
-
class
cxsystem2.core.parameter_parser.
NeuronParser
(output_neuron, physio_config_df)¶ This class embeds all parameter sets associated to all neuron types and will return it as a namespace in form of dictionary
-
__init__
(output_neuron, physio_config_df)¶ Initialize self. See help(type(self)) for accurate signature.
-
-
class
cxsystem2.core.parameter_parser.
SynapseParser
(output_synapse, physio_config_df)¶ This class contains all the variables that are required for the Synapses() object namespaces. There are several reference dictionaries in this class for:
- cw: connection weights for any connection between NeuronGroup()s.
- sp: Sparseness values for any connection between NeuronGroup()s.
- STDP: values for A_pre, A_post, Tau_pre and Tau_post for any connection between NeuronGroup()s.
- dist: distribution of the neurons for connection between NeuronGroup()s.
There are also some important internal variables:
- Cp: Synaptic potentiation coefficient according to van Rossum J Neurosci 2000
- Cd: Synaptic depression coefficient according to van Rossum J Neurosci 2000
- stdp_Nsweeps: 60 in papers one does multiple trials to reach +-50% change in synapse strength. A-coefficient will be divided by this number
- stdp_max_strength_coefficient: This value is to avoid runaway plasticity.
- conn_prob_gain: This is used for compensation of small number of neurons and thus incoming synapses
-
__init__
(output_synapse, physio_config_df)¶ The initialization method for namespaces() object.
Parameters: output_synapse – This is the dictionary created in NeuronReference() in brian2_obj_namespaces module. This contains all the information about the synaptic connection. In this class, Synaptic namespace parameters are directly added to it. Following values are set after initialization: Cp, Cd, sparseness, spatial_decay. Other variables are then set based on the type of the synaptic connection (STDP,Fixed, etc).
-
CPlastic
()¶ The CPlastic method for assigning the parameters to the customized_synapses() object.
This contains all the information about the synaptic connection. In this method, STDP parameters are directly added to this variable. Following values are set in this method: Apre, Apost, Tau_pre, Tau_post, wght_max, wght0.
-
Depressing
()¶ Depressing synapse
-
Facilitating
()¶ Facilitating synapse
-
Fixed
()¶ The Fixed method for assigning the parameters for Fixed synaptic connection to the customized_synapses() object.
-
Fixed_calcium
()¶ The Fixed method for assigning the parameters for Fixed synaptic connection to the customized_synapses() object. This synapse was used in the 1st submitted version, but was later deemed non-valid in terms of calcium scaling
-
Fixed_const_wght
()¶ The Fixed method with constant weight for assigning the parameters for Fixed synaptic connection to the customized_synapses() object.
-
Fixed_multiply
()¶ The Fixed multiply method using constant weight but assigning multiplier further on to synaptic weight. This enables array search for loaded connection strengths.
-
STDP
()¶ The STDP method for assigning the STDP parameters to the customized_synapses() object.
This contains all the information about the synaptic connection. In this method, STDP parameters are directly added to this variable. Following STDP values are set in this method: Apre, Apost, Tau_pre, Tau_post, wght_max, wght0.
-
STDP_with_scaling
()¶ The STDP method for assigning the STDP parameters to the customized_synapses() object.
-
scale_by_calcium
(ca, cw=None)¶ Scales synaptic weight depending on calcium level
Parameters: - ca – float, calcium concentration in mM
- cw – float, connection weight with calcium level 2.0mM (optional)
Returns: float, scaled synaptic weight
-
class
cxsystem2.core.physiology_reference.
NeuronReference
(idx, number_of_neurons, cell_type, layers_idx, general_grid_radius, min_distance, physio_config_df, network_center=0j, cell_subtype='--')¶ Using this class, a dictionary object is created which contains all parameters and variables that are needed to create a group of that customized cell. This dictionary will eventually be used in process of building the cortical module. New types of neurons should be implemented in this class.
-
__init__
(idx, number_of_neurons, cell_type, layers_idx, general_grid_radius, min_distance, physio_config_df, network_center=0j, cell_subtype='--')¶ initialize the NeuronReference based on the arguments.
Parameters: - number_of_neurons – number of neurons in the NeuronGroup() object.
- cell_type – type of cell in the NeuronGroup: currently PC, SS, BC, MC and L1i.
- layers_idx – indicating the layer in which the cell group is located. In case of SS, BC, MC and L1i it is an integer but for PC which is a multi-compartmental neuron, it is a tuple array. This tuple numpy array defines the first and last layers in which the neuron resides. So np.array([4,1]) means that the soma resides in layer 4 and the apical dendrites which are (2 compartments) extend to layer 2/3 and 1. To avoid confusion, layer 2 is used as the indicator of layer 2/3. Hence, if the last compartment of a neuron is in layer 2/3, use number 2.
- network_center – as the name implies, this argument defines the center of teh NeuronGroup() in visual field coordinates. The default value is 0+0j.
- resolution – resolution for formation of neurons in the grid. Default value is 0.1
Main internal variables:
- output_neuron: the main dictionary containing all the data about current Customized_neuron_group including: number of neurons, threshold,
- reset, refractory, neuron type, soma position(layer), dendrites layer, total number of compartments, namespace, equation, positions (both in cortical and visual coordinates).
-
BC
()¶ This method build up the equation for BC neurons. The final equation is then saved in output_neuron[‘equation’].
The equation of the neuron is as follows:
dvm/dt = (gL*(EL-vm) + gL * DeltaT * exp((vm-VT) / DeltaT) + ge_soma * (Ee-vm) + gi_soma * (Ei-vm)) / C : volt (unless refractory) dge_soma/dt = -ge_soma/tau_e : siemens dgi_soma/dt = -gi_soma/tau_i : siemens x : meter y : meter
-
CI
()¶ This method build up the equation for CI neurons. CI stands for current injection as timed array directly to neuron model. The final equation is then saved in output_neuron[‘equation’].
The equation of the neuron is as follows:
dvm/dt = (gL*(EL-vm) + ge_soma * 1 * vm + gi_soma * 1 * vm + I_ext(t,i) / C : volt (unless refractory) dge_soma/dt = -ge_soma/tau_e : siemens dgi_soma/dt = -gi_soma/tau_i : siemens x : meter y : meter I_ext : amp
-
L1i
()¶ This method build up the equation for Layer 1 inhibitory (L1i) neurons. The final equation is then saved in output_neuron[‘equation’].
The equation of the neuron is as follows:
dvm/dt = (gL*(EL-vm) + gL * DeltaT * exp((vm-VT) / DeltaT) + ge_soma * (Ee-vm) + gi_soma * (Ei-vm)) / C : volt (unless refractory) dge_soma/dt = -ge_soma/tau_e : siemens dgi_soma/dt = -gi_soma/tau_i : siemens x : meter y : meter
-
MC
()¶ This method build up the equation for MC neurons. The final equation is then saved in output_neuron[‘equation’].
The equation of the neuron is as follows:
dvm/dt = (gL*(EL-vm) + gL * DeltaT * exp((vm-VT) / DeltaT) + ge_soma * (Ee-vm) + gi_soma * (Ei-vm)) / C : volt (unless refractory) dge_soma/dt = -ge_soma/tau_e : siemens dgi_soma/dt = -gi_soma/tau_i : siemens x : meter y : meter
-
NDNEURON
()¶ NDNEURON type, just for testing Neurodynlib
Returns:
-
PC
()¶ This method build up the equation for PC neurons based on the number of compartments. The final equation is then saved in output_neuron[‘equation’].
Main internal variables:
- eq_template_soma: Contains template somatic equation, the variables in side the equation could be
replaced later using “Equation” function in brian2. :
dvm/dt = (gL*(EL-vm) + gealpha * (Ee-vm) + gealphaX * (Ee-vm) + gialpha * (Ei-vm) + gL * DeltaT * exp((vm-VT) / DeltaT) +I_dendr) / C : volt (unless refractory) dge/dt = -ge/tau_e : siemens dgealpha/dt = (ge-gealpha)/tau_e : siemens dgeX/dt = -geX/tau_eX : siemens dgealphaX/dt = (geX-gealphaX)/tau_eX : siemens dgi/dt = -gi/tau_i : siemens dgialpha/dt = (gi-gialpha)/tau_i : siemens x : meter y : meter
eq_template_dend: Contains template dendritic equation:
dvm/dt = (gL*(EL-vm) + gealpha * (Ee-vm) + gealphaX * (Ee-vm) + gialpha * (Ei-vm) + I_dendr) / C : volt (unless refractory) dge/dt = -ge/tau_e : siemens dgealpha/dt = (ge-gealpha)/tau_e : siemens dgeX/dt = -geX/tau_eX : siemens dgealphaX/dt = (geX-gealphaX)/tau_eX : siemens dgi/dt = -gi/tau_i : siemens dgialpha/dt = (gi-gialpha)/tau_i : siemens
-
SS
()¶ This method build up the equation for SS neurons. The final equation is then saved in output_neuron[‘equation’].
The equation of the neuron is as follows:
dvm/dt = (gL*(EL-vm) + gL * DeltaT * exp((vm-VT) / DeltaT) + ge_soma * (Ee-vm) + gi_soma * (Ei-vm)) / C : volt (unless refractory) dge_soma/dt = -ge_soma/tau_e : siemens dgi_soma/dt = -gi_soma/tau_i : siemens x : meter y : meter
-
VPM
()¶ This method build up the equation for VPM neurons. No equation is needed.
-
-
class
cxsystem2.core.physiology_reference.
SynapseReference
(receptor, pre_group_idx, post_group_idx, syn_type, pre_type, post_type, physio_config_df, post_comp_name='_soma', custom_weight='--', multiply_weight=1)¶ In this class, a dictionary object is created which contains all parameters and variables that are needed to create a Synapses() object between two neuron group. This dictionary will eventually be used in process of building the cortical module. New types of synapses should be implemented in this class.
-
__init__
(receptor, pre_group_idx, post_group_idx, syn_type, pre_type, post_type, physio_config_df, post_comp_name='_soma', custom_weight='--', multiply_weight=1)¶ initializes the SynapseReference based on its arguments.
Parameters: - receptor – defines the type of the receptor in the synaptic connection. Currently ge and gi are implemented.
- pre_group_idx – The index of the pre-synaptic group.
- post_group_idx – The index of the post-synaptic group.
- syn_type – Type of the synaptic connection, currently STDP and Fixed are implemented.
- pre_type – Type of the pre-synaptic NeuronGroup.
- post_type – Type of the post-synaptic NeuronGroup.
- post_comp_name – Name of the target compartment in the cells of the post-synaptic NeuronGroup. The default value is “_soma” as usually soma is being targeted. In case other compartments are targeted in a PC cell, e.g. basal or apical dendrites, _basal or _apical will be used.
Main internal variables:
- output_synapse: the main dictionary containing all the data about current customized_synapse_group including: synaptic equations
- (model, pre, post), type of synapse, type of receptor, index and type of pre- and post-synaptic group, namespace for the Synapses() object, sparseness, spatial_decay.
- _name_space: An instance of brian2_obj_namespaces() object which contains all the constant parameters for this synaptic equation.
-
CPlastic
()¶ The method for implementing the plastic synaptic connection according to Clopath_2010_NatNeurosci.
-
Depressing
()¶ Depressing non-stochastic Tsodyks-Markram synapse
-
Facilitating
()¶ Facilitating non-stochastic Tsodyks-Markram synapse
-
Fixed
()¶ The method for implementing the Fixed synaptic connection.
-
Fixed_calcium
()¶ The method for implementing the Fixed synaptic connection.
-
Fixed_const_wght
()¶ The method for implementing the Fixed synaptic connection.
-
Fixed_multiply
()¶ The method for implementing the Fixed synaptic connection which is multiplied with factor coming from Anatomy csv.
-
STDP
()¶ The method for implementing the STDP synaptic connection.
-
STDP_with_scaling
()¶ The method for implementing the STDP synaptic connection.
-
-
class
cxsystem2.core.workspace_manager.
Workspace
(workspace_path, suffix)¶ As the name implies, this module is used for gathering the data and saving the result.
-
__init__
(workspace_path, suffix)¶ Initializes the save_data object.
Parameters: - save_path – The path for saving the data.
- suffix – the string containing date and time that is supposed to be unique for each simulation and is used as a suffix for file names.
Main internal variables:
- data: the main variable to be saved. It contains all the data about the positions of the NeuronGroup()s as well as the monitor results.
- syntax_bank: Since the monitors are explicitly defined in the Globals(), extracting the data from them requires addressing their name
- explicitely. To automatize this process, the syntaxes for extracting the data from the target monitors are generated and saved in this variable, so that they can be run at the end of the simulation.
-
create_connections_key
(key)¶ In case the user wants to save a peculiar variable, this method can be used to check and create a new key in data dictionary (if does not exist).
Parameters: key – name of the key to be created in the final data variable.
-
create_results_key
(key)¶ In case the user wants to save a peculiar variable, this method can be used to check and create a new key in data dictionary (if does not exist).
Parameters: key – name of the key to be created in the final data variable.
-
-
class
cxsystem2.core.equation_templates.
EquationHelper
(neuron_model='EIF', is_pyramidal=False, compartment='soma', exc_model='SIMPLE_E', inh_model='SIMPLE_I', custom_strings=None)¶ Helper class for switching swiftly between neuron/receptor models in CxSystem. Currently used only for the pyramidal cell (PC) cell type; point neuron models have been migrated to neurodynlib.
-
__init__
(neuron_model='EIF', is_pyramidal=False, compartment='soma', exc_model='SIMPLE_E', inh_model='SIMPLE_I', custom_strings=None)¶ Initialize self. See help(type(self)) for accurate signature.
-
-
class
cxsystem2.core.stimuli.
Stimuli
(duration, input_mat_path, output_folder, output_file_extension, output_file_suffix='')¶ [Extracted from VCXmodel] This is the stimulation object for applying the input to a particular NeuronGroup(). Currently only video input is supported.
-
__init__
(duration, input_mat_path, output_folder, output_file_extension, output_file_suffix='')¶ Initializes the input module for and instance of CxSystem.
Parameters: - duration –
- input_mat_path – .mat file location
- output_folder – location of the saved output
- output_file_suffix – suffix for the output file
- output_file_extension – extension for the output file, i.e. gz, bz2, pickle
-
calculate_input_seqs
()¶ Calculating input sequence based on the video input.
-
generate_inputs
(freq)¶ The method for generating input based on the .mat file, using the internal _initialize_inputs() and _calculate_input_seqs() methods.
Parameters: freq – frequency.
-
get_input_positions
()¶ Extract the positions from the .mat file.
-
load_input_seq
(input_spike_file_location)¶ Loads spikes from file.
Parameters: input_spike_file_location – Location of the file to load spikes.
-
-
cxsystem2.core.tools.
write_to_file
(save_path, data)¶
-
cxsystem2.core.tools.
load_from_file
(load_path)¶
-
cxsystem2.core.tools.
parameter_finder
(df, keyword)¶
-
cxsystem2.core.tools.
change_anat_file_header_value
(filepath, save_path, parameter, new_value)¶
-
cxsystem2.core.tools.
read_config_file
(conf, header=False)¶ This function reads the file and convert it to csv from json if necessary. It only works by loading the csv without headers. (header=none) If you need the first row as header, do it manually :param header: :param conf: :return:
neurodynlib module¶
-
class
cxsystem2.neurodynlib.multicompartment_models.
LeakyCompartment
¶ Not implemented! A leaky capacitor to be used as a template for pyramidal cell compartments.
-
__init__
()¶ Initializes the point neuron object
Parameters: - is_pyramidal (bool) – whether the point neuron model is part of a pyramidal/multicompartmental cell
- compartment (string) – name of the compartment (eg. soma, basal, a3)
-
-
class
cxsystem2.neurodynlib.multicompartment_models.
MulticompartmentNeuron
¶ Not implemented! A base class for multicompartmental neuron models.
-
__init__
()¶ Initialize self. See help(type(self)) for accurate signature.
-
-
class
cxsystem2.neurodynlib.multicompartment_models.
LegacyPyramidalCell
(n_apical=3)¶ Not implemented! The kind of pyramidal cell used in Heikkinen et al. 2015 J Neurosci, Andalibi et al. 2019 Neural Computation, and Hokkanen et al. 2019 Neural Computation. See cxsystem2.core.equation_templates for the current implementation.
-
__init__
(n_apical=3)¶ Initialize self. See help(type(self)) for accurate signature.
-
-
class
cxsystem2.neurodynlib.neuron_models.
PointNeuron
(is_pyramidal=False, compartment='soma')¶ Base class for point neurons
-
__init__
(is_pyramidal=False, compartment='soma')¶ Initializes the point neuron object
Parameters: - is_pyramidal (bool) – whether the point neuron model is part of a pyramidal/multicompartmental cell
- compartment (string) – name of the compartment (eg. soma, basal, a3)
-
add_external_current
(current_name='I_ext', current_eqs=None)¶ Adds an external current to the neuron
Parameters: - current_name (string) – name of the current
- current_eqs (string) – equations describing the external current
Returns:
-
add_model_definition
(key, string_to_add)¶ Append a string to a template placeholder.
Parameters: - key (string) – placeholder name
- string_to_add – string to append to the placeholder
-
add_tonic_current
(tonic_current=50. * pamp, tau_rampup=None)¶ Adds tonic current injection to the neuron
Parameters: - tonic_current – amplitude of current injection (in amps)
- tau_rampup – time constant for current ramp-up (in milliseconds)
-
add_vm_noise
(noise_sigma=2. * mvolt)¶ Adds a stochastic component to the membrane equation as explained in Brian2 documentation
Parameters: noise_sigma – Returns:
-
get_compartment_equations
(compartment_name)¶ Compiles the membrane equation and adds compartment name to all compartment-specific variables
Parameters: compartment_name (string) – name of the compartment Returns: string
-
get_initial_values
()¶ Get initial values. If the initial value of vm is None, will replace it with EL (reversal potential of leak).
Returns:
-
get_json
(include_neuron_name=True)¶ Creates a JSON string of parameter names and values (units are discarded).
Parameters: include_neuron_name (bool) – whether to include the neuron name Returns: string
-
get_membrane_equation
(substitute_ad_hoc=None, return_string=True)¶ Compiles the membrane equation from the template for use in Brian2. This should be the only function where the template equation is used.
Parameters: - substitute_ad_hoc (dict) – dictionary of temporary values to use in the equation template
- return_string (bool) – If True, returns equations as a string. Otherwise, returns a b2.Equations object.
Returns: string (or b2.Equations object)
-
get_neuron_equations
()¶ Returns the membrane equations in a form that prints out nicely in Jupyter Notebook
Returns: b2.Equations object
-
get_neuron_parameters
()¶ Shows all the current parameter names and values
Returns: dict
-
get_parameter_names
()¶ Shows all the parameter names that can/must be defined
Returns: list
-
get_refractory_period
()¶ Get the refractory period (after a spike).
Returns: duration (typically in ms)
-
get_reset_statements
()¶ Get the statements that will be executed once the neuron hits the threshold.
Returns: string
-
get_states_to_monitor
()¶ Get state variables to monitor (for method plot_states())
Returns: list
-
get_threshold_condition
()¶ Get the spike threshold condition.
Returns: string
-
getting_started
(step_amplitude=1.2 * namp, sine_amplitude=2.5 * namp, sine_freq=150. * hertz, sine_dc=2. * namp)¶ Simple example that stimulates the neuron with a step and a sinusoidal current.
Parameters: - step_amplitude – step current amplitude (in amps)
- sine_amplitude – sine current amplitude (in amps)
- sine_freq – sine current frequency (in Hz)
- sine_dc – constant current to inject during the sine stimulation (in amps)
Returns:
-
list_neurons_in_json
(filename)¶ List neuron types (sets of parameters) in a JSON file
Parameters: filename (string) – Path to file Returns: list
-
make_neuron_group
(n)¶ Makes a Brian2 NeuronGroup
Parameters: n (int) – number of neurons Returns: b2.NeuronGroup object
-
plot_fi_curve
(min_current=0. * amp, max_current=1. * namp, step_size=10. * pamp, plot=True, max_rate=None, save_name=None)¶ Plot the frequency-current (f-I) curve.
Parameters: - min_current – minimum current (in amps)
- max_current – maximum current (in amps)
- step_size – current step (in amps)
- plot (bool) – whether to plot the results or not
- max_rate – maximum frequency to show in the plot
Returns: steps, counts (if plot is False)
-
plot_states
(state_monitor, parameters=None)¶ Plots pre-defined state variables from a state monitor
Parameters: - state_monitor – b2.StateMonitor
- parameters – list of parameters
-
plot_vm
(state_monitor)¶ Plots the vm from a state monitor
Parameters: state_monitor – b2.StateMonitor with vm recording
-
read_json
(filename, neuron_name=None)¶ Read and load parameters from a JSON file.
Parameters: - filename (string) – Path to file
- neuron_name (string) – the name of the neuron to read from the file
-
save_json
(filename=None)¶ Saves the neuron parameters in a JSON file.
Parameters: filename (string) – Path to file. If None, will save as neuron_name.json
-
set_excitatory_receptors
(receptor_name)¶ Sets the excitatory receptors.
Parameters: receptor_name (string) – name of receptor model (see neurodynlib.receptor_models)
-
set_inhibitory_receptors
(receptor_name)¶ Sets the inhibitory receptors.
Parameters: receptor_name (string) – name of receptor model (see neurodynlib.receptor_models)
-
set_model_definition
(key, string_to_set)¶ Set the value of a template placeholder.
Parameters: - key (string) – placeholder name
- string_to_set (string) – placeholder value
-
set_neuron_parameters
(**kwargs)¶ Set neuron parameters. If you don’t know the correct units, use get_neuron_parameters() first to get the default parameters with correct units.
Parameters: kwargs – new parameter values are given as arguments
-
simulate_neuron
(I_stim=<brian2.input.timedarray.TimedArray object>, simulation_time=1. * second, **kwargs)¶ Simulate/stimulate the neuron
Parameters: - I_stim – input stimulus (use the input_factory to create the stimulus)
- simulation_time – duration (usually in milliseconds, eg. 3000*ms)
- kwargs – custom neuron parameters can be given as arguments
Returns: b2.StateMonitor, b2.SpikeMonitor
-
what_is_this
()¶ Method to query for the URL describing the neuron model
Returns: url
-
-
class
cxsystem2.neurodynlib.neuron_models.
LifNeuron
¶ Leaky Intergrate-and-Fire (LIF) model. See Neuronal Dynamics, Chapter 1 Section 3.
Requires setting the following parameters: EL, gL, C, V_res, VT.
-
__init__
()¶ Initializes the point neuron object
Parameters: - is_pyramidal (bool) – whether the point neuron model is part of a pyramidal/multicompartmental cell
- compartment (string) – name of the compartment (eg. soma, basal, a3)
-
-
class
cxsystem2.neurodynlib.neuron_models.
EifNeuron
¶ Exponential Integrate-and-Fire (EIF) model. See Neuronal Dynamics, Chapter 5 Section 2.
Requires setting the following parameters: EL, gL, C, V_res, VT, DeltaT, Vcut.
-
__init__
()¶ Initializes the point neuron object
Parameters: - is_pyramidal (bool) – whether the point neuron model is part of a pyramidal/multicompartmental cell
- compartment (string) – name of the compartment (eg. soma, basal, a3)
-
getting_started
(step_amplitude=0.8 * namp, sine_amplitude=1.6 * namp, sine_freq=150. * hertz, sine_dc=1.3 * namp)¶ Simple example that stimulates the neuron with a step and a sinusoidal current.
Parameters: - step_amplitude – step current amplitude (in amps)
- sine_amplitude – sine current amplitude (in amps)
- sine_freq – sine current frequency (in Hz)
- sine_dc – constant current to inject during the sine stimulation (in amps)
Returns:
-
-
class
cxsystem2.neurodynlib.neuron_models.
AdexNeuron
¶ Adaptive Exponential Integrate-and-Fire (ADEX) model. See Neuronal Dynamics, Chapter 6 Section 1.
Requires setting the following parameters: EL, gL, C, V_res, VT, DeltaT, Vcut, a, b, tau_w.
-
__init__
()¶ Initializes the point neuron object
Parameters: - is_pyramidal (bool) – whether the point neuron model is part of a pyramidal/multicompartmental cell
- compartment (string) – name of the compartment (eg. soma, basal, a3)
-
getting_started
(step_amplitude=65. * pamp, sine_amplitude=125. * pamp, sine_freq=150. * hertz, sine_dc=100. * pamp)¶ Simple example that stimulates the neuron with a step and a sinusoidal current.
Parameters: - step_amplitude – step current amplitude (in amps)
- sine_amplitude – sine current amplitude (in amps)
- sine_freq – sine current frequency (in Hz)
- sine_dc – constant current to inject during the sine stimulation (in amps)
Returns:
-
plot_states
(state_monitor, spike_monitor=None, save_name=None)¶ Visualizes the state variables: w-t, vm-t and phase-plane w-vm
Parameters: state_monitor – b2.StateMonitor
-
-
class
cxsystem2.neurodynlib.neuron_models.
HodgkinHuxleyNeuron
¶ Implementation of a Hodgkin-Huxley neuron with Na, K and leak channels (SIMPLE_HH). See Neuronal Dynamics, Chapter 2 Section 2
Requires setting the following parameters: EL, gL, C, EK, ENa, gK, gNa, V_spike.
-
__init__
()¶ Initializes the point neuron object
Parameters: - is_pyramidal (bool) – whether the point neuron model is part of a pyramidal/multicompartmental cell
- compartment (string) – name of the compartment (eg. soma, basal, a3)
-
getting_started
(step_amplitude=7.2 * uamp, sine_amplitude=3.6 * uamp, sine_freq=150. * hertz, sine_dc=2.9 * namp)¶ Simple example that stimulates the neuron with a step and a sinusoidal current.
Parameters: - step_amplitude – step current amplitude (in amps)
- sine_amplitude – sine current amplitude (in amps)
- sine_freq – sine current frequency (in Hz)
- sine_dc – constant current to inject during the sine stimulation (in amps)
Returns:
-
plot_states
(state_monitor)¶ Plots the state variables vm, m, n, h vs. time.
Parameters: state_monitor – b2.StateMonitor
-
-
class
cxsystem2.neurodynlib.neuron_models.
IzhikevichNeuron
¶ Izhikevich model (IZHIKEVICH). See Neuronal Dynamics, Chapter 6 Section 1
Here, we use the formulation and parameters presented in Izhikevich & Edelman 2008 PNAS.
Requires setting the following parameters: EL, C, V_res, VT, k, a, b, d, Vcut.
-
__init__
()¶ Initializes the point neuron object
Parameters: - is_pyramidal (bool) – whether the point neuron model is part of a pyramidal/multicompartmental cell
- compartment (string) – name of the compartment (eg. soma, basal, a3)
-
plot_states
(state_monitor)¶ Visualizes the state variables: u-t, vm-t and phase-plane u-vm
Parameters: state_monitor – b2.StateMonitor
-
-
class
cxsystem2.neurodynlib.neuron_models.
LifAscNeuron
¶ Leaky Integrate-and-Fire with After-spike Currents (LIFASC). One of the generalized LIF (GLIF_3) models used in the Allen Brain Institute.
For more information, see http://celltypes.brain-map.org/ , http://help.brain-map.org/display/celltypes/Documentation?_ga=2.31556414.1221863260.1571652272-1994599725.1571652272 , or Teeter et al. 2018 Nature Comm. https://www.nature.com/articles/s41467-017-02717-4.
Requires setting the following parameters: EL, gL, C, V_res, VT, A_asc1, A_asc2, tau_asc1, tau_asc2.
-
__init__
()¶ Initializes the point neuron object
Parameters: - is_pyramidal (bool) – whether the point neuron model is part of a pyramidal/multicompartmental cell
- compartment (string) – name of the compartment (eg. soma, basal, a3)
-
read_abi_neuron_config
(neuron_config)¶ Method for importing parameters from the Allen Brain Institute’s cell type atlas. Parameters can be obtained by downloading the json from their website.
You can also use the AllenSDK:
from allensdk.api.queries.glif_api import GlifApi neuron_config = GlifApi().get_neuron_configs([neuronal_model_id])[neuronal_model_id]
Parameters: neuron_config – Returns:
-
-
class
cxsystem2.neurodynlib.neuron_models.
neuron_factory
¶ -
__init__
()¶ Initialize self. See help(type(self)) for accurate signature.
-
-
class
cxsystem2.neurodynlib.receptor_models.
ReceptorModel
(receptor_model)¶ -
__init__
(receptor_model)¶ Initialize self. See help(type(self)) for accurate signature.
-
-
cxsystem2.neurodynlib.tools.input_factory.
get_step_current
(t_start, t_end, unit_time, amplitude, append_zero=True)¶ Creates a step current. If t_start == t_end, then a single entry in the values array is set to amplitude.
Parameters: - t_start (int) – start of the step
- t_end (int) – end of the step
- unit_time – unit of t_start and t_end. e.g. 0.1*brian2.ms
- amplitude – amplitude of the step. e.g. 3.5*brian2.uamp
- append_zero – if true, 0Amp is appended at t_end+1. Without that trailing 0, Brian reads out the last value in the array (=amplitude) for all indices > t_end.
Returns: Brian2.TimedArray
-
cxsystem2.neurodynlib.tools.input_factory.
get_ramp_current
(t_start, t_end, unit_time, amplitude_start, amplitude_end, append_zero=True)¶ Creates a ramp current. If t_start == t_end, then ALL entries are 0.
Parameters: - t_start (int) – start of the ramp
- t_end (int) – end of the ramp
- unit_time – unit of t_start and t_end. e.g. 0.1*ms
- amplitude_start – amplitude of the ramp at t_start. e.g. 3.5*uamp
- amplitude_end – amplitude of the ramp at t_end. e.g. 4.5*uamp
- append_zero (bool) – if true, 0Amp is appended at t_end+1. Without that trailing 0, Brian reads out the last value in the array (=amplitude_end) for all indices > t_end.
Returns: Brian2.TimedArray
-
cxsystem2.neurodynlib.tools.input_factory.
get_sinusoidal_current
(t_start, t_end, unit_time, amplitude, frequency, direct_current, phase_offset=0.0, append_zero=True)¶ Creates a sinusoidal current. If t_start == t_end, then ALL entries are 0.
Parameters: - t_start (int) – start of the sine wave
- t_end (int) – end of the sine wave
- unit_time – unit of t_start and t_end. e.g. 0.1*ms
- amplitude – maximum amplitude of the sinus e.g. 3.0*uamp
- frequency – Frequency of the sine. e.g. 0.5*kHz
- direct_current – DC-component (=offset) of the current, e.g. 1.5*uamp
- phase_offset (float) – phase at t_start. Default = 0
- append_zero (bool) – if true, 0Amp is appended at t_end+1. Without that trailing 0, Brian reads out the last value in the array for all indices > t_end.
Returns: Brian2.TimedArray
-
cxsystem2.neurodynlib.tools.input_factory.
get_zero_current
()¶ Returns a TimedArray with one entry: 0 Amp
- Returns:
- TimedArray
-
cxsystem2.neurodynlib.tools.input_factory.
get_spikes_current
(t_spikes, unit_time, amplitude, append_zero=True)¶ Creates a two dimensional TimedArray wich has one column for each value in t_spikes. All values in each column are 0 except one, the spike time as specified in t_spikes is set to amplitude. Note: This function is provided to easily insert pulse currents into a cable. For other use of spike input, search the Brian2 documentation for SpikeGeneration.
Parameters: - t_spikes (int) – list of spike times
- unit_time – unit of t_spikes . e.g. 1*ms
- amplitude – amplitude of the spike. All spikes have the same amplitude
- append_zero (bool) – if true, 0Amp is appended at t_end+1. Without that trailing 0, Brian reads out the last value in the array for all indices > t_end.
Returns: Brian2.TimedArray
-
cxsystem2.neurodynlib.tools.input_factory.
plot_step_current_example
()¶ Example for get_step_current.
-
cxsystem2.neurodynlib.tools.input_factory.
plot_ramp_current_example
()¶ Example for get_ramp_current
-
cxsystem2.neurodynlib.tools.input_factory.
plot_sinusoidal_current_example
()¶ Example for get_sinusoidal_current
-
cxsystem2.neurodynlib.tools.input_factory.
getting_started
()¶
-
cxsystem2.neurodynlib.tools.plot_tools.
plot_voltage_and_current_traces
(voltage_monitor, current, title=None, firing_threshold=None, legend_location=0, save_name=None)¶ Not implemented! plots voltage and current .
- Args:
- voltage_monitor (StateMonitor): recorded voltage current (TimedArray): injected current title (string, optional): title of the figure firing_threshold (Quantity, optional): if set to a value, the firing threshold is plotted. legend_location (int): legend location. default = 0 (=”best”) save_name (string, optional): if set, the figure is saved to this file name
- Returns:
- the figure
-
cxsystem2.neurodynlib.tools.plot_tools.
plot_network_activity
(rate_monitor, spike_monitor, voltage_monitor=None, spike_train_idx_list=None, t_min=None, t_max=None, N_highlighted_spiketrains=3, avg_window_width=None, sup_title=None, figure_size=(10, 4))¶ Not implemented! Visualizes the results of a network simulation: spike-train, population activity and voltage-traces.
- Args:
- rate_monitor (PopulationRateMonitor): rate of the population spike_monitor (SpikeMonitor): spike trains of individual neurons voltage_monitor (StateMonitor): optional. voltage traces of some (same as in spike_train_idx_list) neurons spike_train_idx_list (list): optional. A list of neuron indices whose spike-train is plotted. If no list is provided, all (up to 500) spike-trains in the spike_monitor are plotted. If None, the the list in voltage_monitor.record is used. t_min (Quantity): optional. lower bound of the plotted time interval. if t_min is None, it is set to the larger of [0ms, (t_max - 100ms)] t_max (Quantity): optional. upper bound of the plotted time interval. if t_max is None, it is set to the timestamp of the last spike in N_highlighted_spiketrains (int): optional. Number of spike trains visually highlighted, defaults to 3 If N_highlighted_spiketrains==0 and voltage_monitor is not None, then all voltage traces of the voltage_monitor are plotted. Otherwise N_highlighted_spiketrains voltage traces are plotted. avg_window_width (Quantity): optional. Before plotting the population rate (PopulationRateMonitor), the rate is smoothed using a window of width = avg_window_width. Defaults is 1.0ms sup_title (String): figure suptitle. Default is None. figure_size (tuple): (width,height) tuple passed to pyplot’s figsize parameter.
- Returns:
- Figure: The whole figure Axes: Top panel, Raster plot Axes: Middle panel, population activity Axes: Bottom panel, voltage traces. None if no voltage monitor is provided.
-
cxsystem2.neurodynlib.tools.plot_tools.
plot_ISI_distribution
(spike_stats, hist_nr_bins=50, xlim_max_ISI=None)¶ Not implemented! Computes the ISI distribution of the given spike_monitor and displays the distribution in a histogram
- Args:
- spike_stats (neurodynex.tools.spike_tools.PopulationSpikeStats): statistics of a population activity hist_nr_bins (int): Number of histrogram bins. Default:50 xlim_max_ISI (Quantity): Default: None. In not None, the upper xlim of the plot is set to xlim_max_ISI. The CV does not change if this bound is set.
- Returns:
- the figure
-
cxsystem2.neurodynlib.tools.plot_tools.
plot_spike_train_power_spectrum
(freq, mean_ps, all_ps, max_freq, nr_highlighted_neurons=2, mean_firing_freqs_per_neuron=None, plot_f0=False)¶ Not implemented! Visualizes the power spectrum of the spike trains.
- Args:
- freq: frequencies (= x axis) mean_ps: average power taken over all neurons (typically all of a subsample). all_ps (dict): power spectra for each single neuron max_freq (Quantity): The x-lim of the plot is [-0.05*max_freq, max_freq] mean_firing_freqs_per_neuron (float): None or the mean firing rate averaged across the neurons. Default is None in which case the value is not shown in the legend plot_f0 (bool): if true, the power at frequency 0 is plotted. Default is False and the value is not plotted.
- Returns:
- the figure and the index of the random neuron for which the PS is computed: all_ps[random_neuron_index]
-
cxsystem2.neurodynlib.tools.plot_tools.
plot_population_activity_power_spectrum
(freq, ps, max_freq, average_At=None, plot_f0=False)¶ Not implemented! Plots the power spectrum of the population activity A(t)
- Args:
- freq: frequencies (= x axis) ps: power spectrum of the population activity max_freq (Quantity): The data is plotted in the interval [-.05*max_freq, max_freq] plot_f0 (bool): if true, the power at frequency 0 is plotted. Default is False and the value is not plotted.
- Returns:
- the figure
-
class
cxsystem2.neurodynlib.tools.spike_tools.
PopulationSpikeStats
(nr_neurons, nr_spikes, all_ISI, filtered_spike_trains)¶ Not implemented! Wraps a few spike-train related properties.
-
__init__
(nr_neurons, nr_spikes, all_ISI, filtered_spike_trains)¶ - Args:
- nr_neurons: nr_spikes: mean_isi: std_isi: all_ISI: list of ISI values (can be used to plot a histrogram) filtered_spike_trains the spike trains used to compute the stats. It’s a time-window filtered copy of the original spike_monitor.all_spike_trains.
- Returns:
- An instance of PopulationSpikeStats
-
CV
¶ Coefficient of Variation
-
all_ISI
¶ all ISIs in no specific order
-
filtered_spike_trains
¶ a time-window filtered copy of the original spike_monitor.all_spike_trains
-
mean_isi
¶ Mean Inter Spike Interval
-
nr_neurons
¶ Number of neurons in the original population
-
nr_spikes
¶ Nr of spikes
-
std_isi
¶ Standard deviation of the ISI
-
-
cxsystem2.neurodynlib.tools.spike_tools.
get_spike_time
(voltage_monitor, spike_threshold)¶ Not implemented! Detects the spike times in the voltage. Here, the spike time is DEFINED as the value in voltage_monitor.t for which voltage_monitor.v[idx] is above threshold AND voltage_monitor.v[idx-1] is below threshold (crossing from below). Note: currently only the spike times of the first column in voltage_monitor are detected. Matrix-like monitors are not supported.
- Args:
- voltage_monitor (StateMonitor): A state monitor with at least the fields “v: and “t” spike_threshold (Quantity): The spike threshold voltage. e.g. -50*b2.mV
- Returns:
- A list of spike times (Quantity)
-
cxsystem2.neurodynlib.tools.spike_tools.
get_spike_stats
(voltage_monitor, spike_threshold)¶ Not implemented! Detects spike times and computes ISI, mean ISI and firing frequency. Here, the spike time is DEFINED as the value in voltage_monitor.t for which voltage_monitor.v[idx] is above threshold AND voltage_monitor.v[idx-1] is below threshold (crossing from below). Note: meanISI and firing frequency are set to numpy.nan if less than two spikes are detected Note: currently only the spike times of the first column in voltage_monitor are detected. Matrix-like monitors are not supported.
- Args:
- voltage_monitor (StateMonitor): A state monitor with at least the fields “v: and “t” spike_threshold (Quantity): The spike threshold voltage. e.g. -50*b2.mV
- Returns:
- tuple: (nr_of_spikes, spike_times, isi, mean_isi, spike_rate)
-
cxsystem2.neurodynlib.tools.spike_tools.
pretty_print_spike_train_stats
(voltage_monitor, spike_threshold)¶ Not implemented! Computes and returns the same values as get_spike_stats. Additionally prints these values to the console.
- Args:
- voltage_monitor: spike_threshold:
- Returns:
- tuple: (nr_of_spikes, spike_times, isi, mean_isi, spike_rate)
-
cxsystem2.neurodynlib.tools.spike_tools.
filter_spike_trains
(spike_trains, window_t_min=0. * second, window_t_max=None, idx_subset=None)¶ Not implemented! creates a new dictionary neuron_idx=>spike_times where all spike_times are in the
half open interval [window_t_min,window_t_max)- Args:
- spike_trains (dict): a dictionary of spike trains. Typically obtained by calling spike_monitor.spike_trains() window_t_min (Quantity): Lower bound of the time window: t>=window_t_min. Default is 0ms. window_t_max (Quantity): Upper bound of the time window: t<window_t_max. Default is None, in which case no upper bound is set. idx_subset (list, optional): a list of neuron indexes (dict keys) specifying a subset of neurons. Neurons NOT in the key list are NOT added to the resulting dictionary. Default is None, in which case all neurons are added to the resulting list.
- Returns:
- a filtered copy of spike_trains
-
cxsystem2.neurodynlib.tools.spike_tools.
get_spike_train_stats
(spike_monitor, window_t_min=0. * second, window_t_max=None)¶ Not implemented! Analyses the spike monitor and returns a PopulationSpikeStats instance.
- Args:
- spike_monitor (SpikeMonitor): Brian2 spike monitor window_t_min (Quantity): Lower bound of the time window: t>=window_t_min. The stats are computed for spikes within the time window. Default is 0ms window_t_max (Quantity): Upper bound of the time window: t<window_t_max. The stats are computed for spikes within the time window. Default is None, in which case no upper bound is set.
- Returns:
- PopulationSpikeStats
-
cxsystem2.neurodynlib.tools.spike_tools.
_spike_train_2_binary_vector
(spike_train, vector_length, discretization_dt)¶ Not implemented! Convert the time-stamps of the spike_train into a binary vector of the given length. Note: if more than one spike fall into the same time bin, only one is counted, surplus spikes are ignored.
- Args:
- spike_train: vector_length: discretization_dt:
- Returns:
- Discretized spike train: a fixed-length, binary vector.
-
cxsystem2.neurodynlib.tools.spike_tools.
_get_spike_train_power_spectrum
(spike_train, delta_t, subtract_mean=False)¶
-
cxsystem2.neurodynlib.tools.spike_tools.
get_averaged_single_neuron_power_spectrum
(spike_monitor, sampling_frequency, window_t_min, window_t_max, nr_neurons_average=100, subtract_mean=False)¶ Not implemented! averaged power-spectrum of spike trains in the time window [window_t_min, window_t_max).
The power spectrum of every single neuron’s spike train is computed. Then the average across all single-neuron powers is computed. In order to limit the compuation time, the number of neurons taken to compute the average is limited to nr_neurons_average which defaults to 100- Args:
- spike_monitor (SpikeMonitor) : Brian2 SpikeMonitor sampling_frequency (Quantity): sampling frequency used to discretize the spike trains. window_t_min (Quantity): Lower bound of the time window: t>=window_t_min. Spikes before window_t_min are not taken into account (set a lower bound if you want to exclude an initial transient in the population activity) window_t_max (Quantity): Upper bound of the time window: t<window_t_max. nr_neurons_average (int): Number of neurons over which the average is taken. subtract_mean (bool): If true, the mean value of the signal is subtracted before FFT. Default is False
- Returns:
- freq, mean_ps, all_ps_dict, mean_firing_rate, mean_firing_freqs_per_neuron
-
cxsystem2.neurodynlib.tools.spike_tools.
get_population_activity_power_spectrum
(rate_monitor, delta_f, k_repetitions, T_init=100. * msecond, subtract_mean_activity=False)¶ Not implemented! Computes the power spectrum of the population activity A(t) (=rate_monitor.rate)
- Args:
- rate_monitor (RateMonitor): Brian2 rate monitor. rate_monitor.rate is the signal being analysed here. The temporal resolution is read from rate_monitor.clock.dt delta_f (Quantity): The desired frequency resolution. k_repetitions (int): The data rate_monitor.rate is split into k_repetitions which are FFT’d independently and then averaged in frequency domain. T_init (Quantity): Rates in the time interval [0, T_init] are removed before doing the Fourier transform. Use this parameter to ignore the initial transient signals of the simulation. subtract_mean_activity (bool): If true, the mean value of the signal is subtracted. Default is False
- Returns:
- freqs, ps, average_population_rate
Configuration module¶
BUI module¶
visualization module¶
-
class
cxsystem2.visualization.spikedata_to_csvs.
SpikeData
(filename)¶ -
__init__
(filename)¶ Initialize self. See help(type(self)) for accurate signature.
-
get_positions_list
(xy_multiplier=0.03, z_multiplier=0.03, return_subsets=True)¶ Creates a N_neurons x 3 matrix of neurons, where N_neurons = number of neurons, column 0 = x position, column 1 = y position, and column 2 = z position. Neuron index implicitly encoded by row number (as expected by ViSimpl/StackViz). XY-multipliers set here for visually pleasing results in ViSimpl.
Parameters: - xy_multiplier – scalar, how much to scale x-y coordinates
- xy_multiplier – scalar, how much to scale z coordinate
- return_subsets – True/False (default x),
Returns:
-
get_spike_data
()¶ Reads data from a CxSystem results file
Returns: dict
-
get_spike_list
()¶ Creates an N_spikes x 2 matrix of spikes, where N_spikes = number of spikes, column 0 = neuron index, and column 1 = spike time. Spike times saved in seconds since this is the default unit in ViSimpl.
Returns: numpy array
-