Instrumentation Utilities¶
Utility functions for setting up recorders, noise, global variables and range variables in the network.
File loc: network_configs.instrumentations.instr_utils.py
- network_configs.instrumentations.instr_utils.generate_pulse_train(duration_ms, pulse_width_ms, ipi_ms, start_delay_ms, amplitude, dt=0.025, random_variation=0)¶
Generate a pulse train signal with optional random variations.
- Parameters:
- duration_ms (float) – Total duration of the signal (in milliseconds).
- pulse_width_ms (float) – Base width of each pulse (in milliseconds).
- ipi_ms (float) – Base inter-pulse interval (in milliseconds, measured from the start of one pulse to the start of the next).
- start_delay_ms (float, optional) – Initial delay before the first pulse (in milliseconds). Default is 0.
- amplitude (float, optional) – Amplitude of the pulses. Default is 1.
- sampling_rate (int, optional) – Number of samples per second. Default is 1000 Hz.
- random_variation (float, optional) – Maximum random variation in pulse width and IPI (in milliseconds). Default is 0.
Returns: - t (numpy array): Time vector. - signal (numpy array): Generated pulse train signal.
- network_configs.instrumentations.instr_utils.recursive_getattr(obj, attr_string)¶
Recursively retrieves an attribute or calls a method on an object based on a colon-separated string.
Used to add recorders to the cell object.
- Parameters:
obj – The object from which to retrieve the attribute or method.
attr_string (str) – A colon-separated string representing the attribute or method to retrieve or call. If the string ends with ‘)’, it indicates a method call.
- Returns:
The final attribute or the result of the method call.
- network_configs.instrumentations.instr_utils.set_global_variables(params)¶
Set NEURON global variables.
- Parameters:
params (dict) – A dictionary containing the the global variables to set.
- network_configs.instrumentations.instr_utils.set_intial_noise(cell, noise_params, noise_seed=40)¶
Sets the initial gaussian noise for a given cell.
- Parameters:
cell – The cell object to which the noise will be applied.
noise_params (list) – A list containing noise parameters where noise_params[0] is the duration of the noise. noise_params[1] is the mean of the noise distribution. noise_params[2] is the standard deviation of the noise distribution.
noise_seed (int, optional) – The seed for the random number generator. Defaults to 40.
- network_configs.instrumentations.instr_utils.set_intrnrn_range_variables(interneuron, params)¶
Set the range variables for a interneuron cell.
- Parameters:
interneuron – The interneuron cell object.
params (dict) – A dictionary containing the range variables to set.
- network_configs.instrumentations.instr_utils.set_noise(cell, noise_params, noise_seed=80)¶
Sets the simulation noise (gaussian) for a given cell.
- Parameters:
cell – The cell object to which noise will be added.
noise_params (list) – A list containing noise parameters where: - noise_params[0] is the duration of the noise. - noise_params[1] is the mean of the noise distribution. - noise_params[2] is the standard deviation of the noise distribution.
noise_seed (int, optional) – The seed for the random number generator. Default is 80.
- network_configs.instrumentations.instr_utils.set_stell_range_variables(stell, params)¶
Set the range variables for a stellate cell.
- Parameters:
stell – The stellate cell object.
params (dict) – A dictionary containing the range variables to set.
- network_configs.instrumentations.instr_utils.setup_recorders(cell, recorder_handle, recorder_dt)¶
Sets up recorders for a given cell based on the provided recorder handle.
For each parameter, create a vector to record from the given location in the cell obj. For spikes, create a spike detector and record the spikes.
- Parameters:
cell – The cell object for which the recorders are being set up.
recorder_handle (dict) – A dictionary containing recorder configurations.
recorder_dt (float) – The time interval for recording data.
- Returns:
The cell object with the recorders set up.
- Return type:
cell_object