bmtk.utils.reports.compartment package¶
Submodules¶
bmtk.utils.reports.compartment.compartment_reader module¶
-
class
bmtk.utils.reports.compartment.compartment_reader.
CompartmentReaderVer01
(filename, mode='r', **params)[source]¶ Bases:
bmtk.utils.reports.compartment.core.CompartmentReaderABC
-
property
default_population
¶
-
property
populations
¶
-
property
bmtk.utils.reports.compartment.compartment_report module¶
bmtk.utils.reports.compartment.compartment_writer module¶
-
class
bmtk.utils.reports.compartment.compartment_writer.
CompartmentWriterv01
(file_path, mode='w', default_population=None, cache_dir=None, variable=None, units=None, buffer_size=0, tstart=0.0, tstop=0.0, dt=0.0, n_steps=None, **kwargs)[source]¶ Bases:
bmtk.utils.reports.compartment.core.CompartmentWriterABC
-
property
report_group
¶
-
property
temp_files
¶
-
property
-
class
bmtk.utils.reports.compartment.compartment_writer.
PopulationWriterv01
(parent, population, variable=None, units=None, tstart=0.0, tstop=1.0, dt=0.01, n_steps=None, buffer_size=0, **kwargs)[source]¶ Bases:
bmtk.utils.reports.compartment.core.CompartmentWriterABC
,bmtk.utils.reports.compartment.compartment_reader.CompartmentReaderVer01
Used to save cell membrane variables (V, Ca2+, etc) to the described hdf5 format.
For parallel simulations this class will write to a seperate tmp file on each rank, then use the merge method to combine the results. This is less efficent, but doesn’t require the user to install mpi4py and build h5py in parallel mode. For better performance use the CellVarRecorderParrallel class instead.
-
class
DataTable
(var_name)[source]¶ Bases:
object
A small struct to keep track of different data (and buffer) tables
-
property
h5_base
¶
-
record_cell
(node_id, vals, tstep, population=None)[source]¶ Record cell parameters.
- Parameters
gid – gid of cell.
var_name – name of variable being recorded.
seg_vals – list of all segment values
tstep – time step
-
class
-
bmtk.utils.reports.compartment.compartment_writer.
barrier
(self)¶ Barrier synchronization
bmtk.utils.reports.compartment.core module¶
-
class
bmtk.utils.reports.compartment.core.
CompartmentReaderABC
[source]¶ Bases:
object
-
property
populations
¶
-
property
bmtk.utils.reports.compartment.plotting module¶
-
bmtk.utils.reports.compartment.plotting.
plot_traces
(report, population=None, node_ids=None, sections='origin', average=False, node_groups=None, times=None, title=None, show_legend=None, show=True)[source]¶ Displays the time trace of one or more nodes from a SONATA CompartmentReport file.
To plot a group of individual variable traces (based on their soma):
plot_traces('/path/to/report.h5', node_ids=[0, 10, 20, ...])
If node_ids=None (default) then all nodes in the report will be displayed. For large networks then can become difficult to visualize so it’s recommended you use average=True:
plot_traces('/path/to/report.h5', average=True)
Users also have the option of taking the averages of multiple subsets of nodes using the “node_groups” options. “node_groups” should be a list of dictionary, each dict with a ‘node_ids’: [list of ids], and optionally a ‘label’ and ‘c’ (color). For example support nodes [0, 70) are excitatory cells, nodes [70, 100) are inhibitory, and we want display excitatory and inhibitory averages and blue and red, respectivly:
plot_traces('/path/to/report.h5', node_groups=[{'node_ids': range(0, 70), 'label': 'exc', 'c': 'b'}, {'node_ids': range(70, 100), 'label': 'inh', 'c': 'r'}])
- Parameters
report – Path to SONATA report file or CompartmentReport object
population – string. If the report more than one population of nodes, use this to determine which nodes to plot. If only one population exists and population=None then the function will find it by default.
node_ids – int or list of ints. Individual node to display the variable
sections – ‘origin’, ‘all’, or list of ids, Compartments/elements to display, By default will only show values at the soma.
average – If True will take the averages of all/selected nodes. Default False
node_groups – None or list of dicts. Used to group sets of nodes by labels and color. Each grouping should be a dictionary with a ‘node_ids’ key with a list of the ids. You can also add ‘label’ and ‘c’ keys for label and color. If None all nodes will be labeled and colored the same.
times – (float, float), start and stop times of simulation
title – str, adds a title to the plot
show_legend – Set True or False to determine if legend should be displayed on the plot. The default (None) function itself will guess if legend should be shown.
show – bool to display or not display plot. default True.
- Returns
matplotlib figure.Figure object
-
bmtk.utils.reports.compartment.plotting.
plot_traces_averaged
(report, population=None, sections='origin', node_groups=None, times=None, title=None, show_background=True, show_legend=None, show=True)[source]¶ Used to plot averages across multiple nodes in a SONATA Compartment Report file.
Recommended that you use “plot_traces” function.
To plot multiple averages use the “node_groups” options. “node_groups” should be a list of dictionary, each dict with a ‘node_ids’: [list of ids], and optionally a ‘label’ and ‘c’ (color). For example support nodes [0, 70) are excitatory cells, nodes [70, 100) are inhibitory, and we want display excitatory and inhibitory averages and blue and red, respectively:
plot_traces('/path/to/report.h5', node_groups=[{'node_ids': range(0, 70), 'label': 'exc', 'c': 'b'}, {'node_ids': range(70, 100), 'label': 'inh', 'c': 'r'}])
- Parameters
report – Path to SONATA report file or CompartmentReport object.
population – string. If the report more than one population of nodes, use this to determine which nodes to plot. If only one population exists and population=None then the function will find it by default.
sections – ‘origin’, ‘all’, or list of ids, Compartments/elements to display, By default will only show values at the soma.
node_groups – None or list of dicts. Used to group sets of nodes by labels and color. Each grouping should be a dictionary with a ‘node_ids’ key with a list of the ids. You can also add ‘label’ and ‘c’ keys for label and color. If None all nodes will be labeled and colored the same.
times – (float, float), start and stop times of simulation.
title – str, adds a title to the plot.
show_background – shows all the individual traces greyed in the background.
show_legend – Set True or False to determine if legend should be displayed on the plot. The default (None) function itself will guess if legend should be shown.
show – bool to display or not display plot. default True.
- Returns
matplotlib figure.Figure object
-
bmtk.utils.reports.compartment.plotting.
plot_traces_individual
(report, population=None, node_ids=None, sections='origin', times=None, title=None, show_legend=None, show=True)[source]¶ Used the plot time traces of individual nodes from a SONATA compartment report file.
Recommended use plot_traces instead, which will call this function if necessarcy.
- Parameters
report – Path to SONATA report file or CompartmentReport object.
population – string. If the report more than one population of nodes, use this to determine which nodes to plot. If only one population exists and population=None then the function will find it by default.
node_ids – int or list of ints. Individual node to display the variable.
sections – ‘origin’, ‘all’, or list of ids, Compartments/elements to display, By default will only show values at the soma.
times – (float, float), start and stop times of simulation.
title – str, adds a title to the plot.
show_legend – Set True or False to determine if legend should be displayed on the plot. The default (None) function itself will guess if legend should be shown.
show – bool to display or not display plot. default True.
- Returns
matplotlib figure.Figure object