visualize
❭ cell_morphology_visualizer
❭ CMVDataParser
CMVDataParser¶
-
class visualize.cell_morphology_visualizer.CMVDataParser(cell, align_trunk=
True
, t_start=None
, t_stop=None
, t_step=None
)¶ Parse data from a
Cell
object to a format that is easier to work with for visualization purposes.- Parameters:¶
cell (
Cell
) – Cell objectalign_trunk (bool) – Whether or not to align the cell trunk with the z-axis.
t_start (float) – Time point where we want to start visualizing. By default, this gets initialized to the start of the simulation.
t_stop (float) – Time point where the visualization of the simulation stops. By default, this gets initialized to the end of the simulation.
t_step (float) – Time interval for visualization. By default, the simulation is chopped to the specified t_begin and t_stop, and evenly divided in 10 timesteps.
- Attributes:¶
- soma_center¶
Center of the soma of the original cell object, unaligned with z-axis.
- Type:¶
np.ndarray
- parents¶
Maps sections to their parents. self.parents[10] returns the parent of section 10.
- Type:¶
dict
- morphology¶
A pd.DataFrame containing point information, diameter and section ID without duplicated points for branchpoints for connections between sections.
- Type:¶
pd.DataFrame
- rotation_with_zaxis¶
Rotation object that defines the transformation between the cell trunk and the z-axis.
- Type:¶
scipy.spatial.transform.Rotation
- time_offset¶
Time offset w.r.t. simulation start. Useful if ‘0 ms’ is supposed to refer to stimulus time.
- Type:¶
float
- t_start¶
Time point where we want to start visualizing. By default, this gets initialized to the start of the simulation.
- Type:¶
float
- t_stop¶
Time point where the visualization of the simulation stops. By default, this gets initialized to the end of the simulation.
- Type:¶
float
- dt¶
Time interval of the simulation. Note that this is note the same as t_step, as not every time point is visualized by default.
- Type:¶
float
- t_step¶
Time interval for visualization. Does not have to equal the simulation time interval. By default, the simulation is chopped to the specified t_begin and t_stop, and evenly divided in 10 timesteps.
- Type:¶
float
- times_to_show¶
An array of time points to visualize. Gets calculated from
self.t_start
,self.t_stop
andself.t_step
.- Type:¶
np.ndarray
- voltage_timeseries¶
List containing the voltage of the cell during a timeseries. Each element corresponds to a time point. Each element of the list contains n elements, being n the number of points of the cell morphology. Hence, the value of each element is the voltage at each point of the cell morphology. None means it has no simulation data. Empty list means it has simulation data that has not been initialized yet.
- Type:¶
list
- synapses_timeseries¶
List containing the synapse activations during a timeseries (Similarly to
voltage_timeseries
). Each element corresponds to a time point. Each element is a dictionary where each key is the type of input population and the value is the list of active synapses for that type of population at that time point. The list contains the 3d coordinates where each active synapse is located. None means it has no simulation data. Empty list means it has simulation data that has not been initialized yet.- Type:¶
list
- ion_dynamics_timeseries¶
Dictionary containing the ion dynamics during a timeseries (Similarly to
voltage_timeseries
). Each value is a list corresponding where each element corresponds 1 timepoint, containing per-point info on the ion channel state or ion concentration. None means it has no simulation data. Empty means it has simulation data that has not been initialized yet.- Type:¶
dict
- time_show_syn_activ¶
Time in the simulation during which a synapse activation is shown during the visualization.
- Type:¶
float
- Methods:¶
Test if the cell object has been simulated by checking if it has voltage data at the soma.
Initializes the variables associated with simulation data. Does not fill these variables until they actually need to be calculated.
_align_trunk_with_z_axis
(cell)Calculates the polar angle between the trunk and z-axis (zenith).
_calc_morphology
(cell)Retrieve cell morphology from cell object.
_get_voltages_at_timepoint
(time_point)Retrieves the coltage along the whole cell morphology from cell object at a particular time point.
_data_per_section_to_data_per_point
(data_per_section)Unravel a list of lists of data per section to a flat list of data per point.
_get_ion_dynamics_at_timepoint
(time_point, ion_keyword)Retrieves the ion dynamics along the whole cell morphology from cell object at a particular time point.
Retrieves voltage data along the whole cell body during a set of time points (specified in
self.times_to_show
)._calc_ion_dynamics_timeseries
(ion_keyword)Retrieves ion dynamics info along the whole cell body during a set of time points (specified in self.times_to_show).
_get_synapses_at_timepoint
(time_point)Retrieves the active synapses at a particular time point.
Retrieves the active synapses during a set of time points (specified in
times_to_show
)._get_timeseries_minmax
(timeseries)Get the min and max values of a timeseries that is nested per section and timepoint.
_update_times_to_show
(t_start, t_stop, t_step)Checks if the specified time range equals the previously defined one. If not, updates the time range.
_calc_scalar_data_from_keyword
(keyword, time_point, return_as_color, color_dict)Returns a scalar data array based on some keyword (ion dynamics or membrane voltage).
_keyword_is_scalar_data
(keyword)Check if a keyword is a scalar data type.
_get_color_per_section
(array, nan_color)Given an array of scalar values of length n_points, bin them per section and assign a color according to
scalar_mappable
.scale_diameter
(scale_func)Scale the diameter of the visualization with a scaling function.
set_cmap
(cmap, vmin, vmax)Update the colormap, vmin, and vmax of the visualization.