This package contains the definition of the visualization API, together with implementation of numerous plotting methods that take advantage of the mozaik data structures to automatize a lot of the visualization functionality.
The philoshophy of the visualization package is similar to the analysis package mozaik.analysis.analysis. The input of each plotting is a datastore, it is the role of the plotting to extract as much as possible data from the provided datastore and display as much as possible information (of course with respect to the role of the given plotting class). It is then up to the user to manipulate the datastore before passing it to the plotting function to restrict the information that is being plotted. Together with the querying system this provides a very flexible and unified framework for defining what users want to plot.
The implementation is based on matplotlib and its GridSpec objects. The plotting framwork is divided into two main concepts, represented by the two high-level classes Plotting mozaik.visualization.plotting.Plotting and mozaik.visualization.simple_plot.SimplePlot.
The SimplePlot represent low-level plotting. It is assumed that this plot has only a single axis that is drawn into the region defined by the GridSpec instance that is passed into it. The role of the set of classes derived from SimplePlot is to standardize the low level looks of all figures (mainly related to axis, lables, titles etc.), and should assume data given to them in a format that is easy to use by the given plot. In order to unify the look of figures it defines four functions pre_axis_plot, pre_plot, plot, and post_plot. The actual plotting that user defines is typically defined in the plot function while the pre_axis_plot, pre_plot and post_plot functions handle the pre and post plotting adjustments to the plot (i.e. typical post_plot function for example adjusts the ticks of the axis to a common format other such axis related properties). When defining a new SimplePlot function user is encoureged to push as much of it’s ‘decorating’ funcitonality into the post and pre plot function and define only the absolute minimum in the plot function. At the same time, there is already a set of classes implementing a general common look provided, and so users are encouraged to use these as much as possible. If their formatting features are not sufficient or incompatible with a given plot, users are encoureged to define new virtual class that defines the formatting in the pre and post plot functions (and thus sepparating it from the plot itself), and incorporating these as low as possible within the hierarchy of the SimplePlot classes to re-use as much of the previous work as possible.
The Plotting class (and its children) define the high level plotting mechanisms. They are mainly responsible for hierarchical organization of figures with multiple plots, any mechanisms that require consideration of several plots at the same time, and the translation of the data form the general format provided by Datastore, to specific format that the SimplePlot plots require. In general the Plotting instances should not do any plotting of axes themselves (but instead calling the SimplePlot instances to do the actual plotting), with the exception of multi-axis figures whith complicated inter-axis dependencies, for which it is not practical to break them down into single SimplePlot instances.
This module defines the mozaik.visualization.plotting.Plotting API and offers a library of plotting commands derived from it.
The high-level plotting API is defined by the mozaik.visualization.plotting.Plotting class. Each class derived from Plotting should implement two plotting functions: plot and subplot. The subplot function accepts a SubplotSpec object (see matplotlib doc) as input which will tell it where to plot. The subplot function returns a dictionary, where each key is a name of a subplot it generates (and will correspond to a creation of another Plotting or SimplePlot plot), and the associated value is a tuple that contains the:
- Plotting or SimplePlot object
- the SubplotSpec subregion into which the plot is supposed to be drawn
- dictionary of parameters that to be passed to the plot.
This way one can nest Plotting instances and eventualy simple_plot instances as the leafs of the tree.
The third element of the tuple discussed above is a dictionary of parameters that will be passed onto the eventual call to SimplePlot class. At each level of hierarchy the Plotting instances can add some parameters via the third element of the tuple. But note that the parameters at higher levels of hierarchy will overide the parameters given at lower level of hierarchy.
The names of the subplots that are returned by the subplot function as the keys of the dictionary should be documented as they will be used to identify the subplots by user should he wish to pass specific parameters to them. The user can do this by passing a dictionary to the plot function. The keys of the dictionary are comma sepparated strings containing the path to the plot in the plotting hierarchy to which the parameters will be passed, e.g: top_plot_name.first_level_subplot_name.second_level_subplot_name.parameter_name = value One can also use ‘*’ instead of a plot name to indicated that the parameter should be passed to all the subplots at that level. Also if the path ends before it reaches a simple_plot level it is automatically assumed the parameter will be passed into the rest of the subtree. Finaly the subplots function can return plots which are names which use the ‘.’ character. This will be processed in the same way as above and it allows for Plotting classes that create multiple groups of plots to let user sepparately target the different groups with parameters.
The plot function can either not be defined in which case it defaults to the Plotting.plot, which simply creates a figure and calls subplot with SuplotSpec spanning the whole figure. Alternatively, one can define the plot function if one wants to add some additional figure level decorations, in case the figure is plotted on its own (i.e. becomes the highest-level), and that would otherwise prevent flexible use in nesting via the subplot.
Bases: mozaik.core.ParametrizedObject
The high level Plotting API. See the module information on more detailed description.
Parameters : | datastore : Datastore
parameters : ParameterSet
plot_file_name : str
fig_params : dict
|
---|
This is the function that each Plotting instance has to implement. See the module documentation for more details.
The top level plot function. It is this function that the user will call on the plot instance to execute the plotting.
Parameters : | params : dict
|
---|
Bases: mozaik.visualization.plotting.Plotting
Plots tuning curves, one plot in line per each neuron. This plotting function assumes a set of PerNeuronValue ADSs in the datastore associated with certain stimulus type. It will plot the values stored in these PerNeuronValue instances (corresponding to neurons in neurons) across the varying parameter parameter_name of thier associated stimuli. If other parameters of the stimuli are varying withing the datastore it will automatically plot one tuning curve per each combination of values of the other parameters and label the curve accordingly.
Other Parameters: | |
---|---|
neurons : list
sheet_name : str
parameter_name : str
Defines ‘TuningCurve_’ + value_name + ‘.Plot0’ ... ‘TuningCurve_’ + value_name + ‘.Plotn’ : where n goes through number of neurons, and value_name creates one row for each value_name found in the different PerNeuron found : |
Bases: mozaik.visualization.plotting.Plotting
It plots raster plots of spikes stored in the recordings. It assumes a datastore with a set of recordings. It will plot a line of raster plots, one per each recording, showing the raster plot corresponding to the given recording.
Defines ‘RasterPlot.Plot0’ ... ‘RasterPlot.PlotN’
Other Parameters: | |
---|---|
sheet_name : str
neurons : list
trial_averaged_histogram : bool
|
Bases: mozaik.visualization.plotting.Plotting
It plots the membrane potentials stored in the recordings. It assumes a datastore with a set of recordings. It will plot a line of vm plots, one per each recording, showing the vm corresponding to the given recording.
It defines one plot named: ‘VmPlot.Plot0’ ... ‘VmPlot.PlotN’.
Other Parameters: | |
---|---|
sheet_name : str
neuron : int
|
Bases: mozaik.visualization.plotting.Plotting
It plots the conductances stored in the recordings. It assumes a datastore with a set of recordings. It will plot a line of conductance plots, one per each recording, showing the excitatory and inhibitory conductances corresponding to the given recording.
It defines one plot named: ‘ConductancesPlot.Plot0’ ... ‘ConductancesPlot.PlotN’.
Other Parameters: | |
---|---|
sheet_name : str
neuron : int
|
Bases: mozaik.visualization.plotting.Plotting
It defines 4 (or 3 depending on the sheet_activity option) plots named: ‘Activity_plot’, ‘Spike_plot’, ‘Vm_plot’, ‘Conductance_plot’ corresponding to the ActivityMovie RasterPlot, VmPlot, GSynPlot plots respectively. And than a line of the with the extensions .Plot1 ... .PlotN
Other Parameters: | |
---|---|
sheet_name : str
neuron : int
sheet_activity: bool :
|
Bases: mozaik.visualization.plotting.Plotting
This plot shows a line of plots each showing analog signals, one plot per each AnalogSignalList instance present in the datastore.
It defines line of plots named: ‘AnalogSignalPlot.Plot0’ ... ‘AnalogSignalPlot.PlotN’.
Other Parameters: | |
---|---|
sheet_name : str
neurons : list
|
Bases: mozaik.visualization.plotting.Plotting
This plot shows a line of plots each showing excitatory and inhibitory conductances, one plot per each ConductanceSignalList instance present in the datastore.
It defines line of plots named: ‘ConductancePlot.Plot0’ ... ‘ConductancePlot.PlotN’.
Other Parameters: | |
---|---|
sheet_name : str
normalize_individually : bool
|
Bases: mozaik.visualization.plotting.Plotting
This plots one plot showing the retinal input per each recording in the datastore.
It defines line of plots named: ‘PixelMovie.Plot0’ ... ‘PixelMovie.PlotN’.
Other Parameters: | |
---|---|
frame_rate : int
|
Bases: mozaik.visualization.plotting.Plotting
This plots one plot per each recording, each showing the activity during that recording based on the spikes stored in the recording. The activity is showed localized in the sheet cooridantes.
It defines line of plots named: ‘ScatterPlot.Plot0’ ... ‘ScatterPlot.PlotN’ or ‘PixelMovie.Plot0’ ... ‘PixelMovie.PlotN’ depending on the parameter scatter.
Other Parameters: | |
---|---|
frame_rate : int
bin_width : float
scatter : bool
resolution : int
sheet_name: str :
|
Bases: mozaik.visualization.plotting.Plotting
Plots the values for all PerNeuronValue ADSs in teh datastore, one for each sheet.
It defines line of plots named: ‘ScatterPlot.Plot0’ ... ‘ScatterPlot.PlotN
#JAHACK, so far doesn’t support the situation where several types of PerNeuronValue analysys data structures are present in the supplied datastore.
Bases: mozaik.visualization.plotting.Plotting
Takes each pair of PerNeuronValue ADSs in the datastore that have the same units and plots a scatter plot of each such pair.
It defines line of plots named: ‘ScatterPlot.Plot0’ ... ‘ScatterPlot.PlotN
Bases: mozaik.visualization.plotting.Plotting
Plots Connectivity, one for each projection originating or targeting (depending on parameter reversed) sheet sheet_name for a single neuron in the sheet.
This plot can accept second DSV that contains the PerNeuronValues corresponding to the target sheets (or source sheet if reversed is True) to be displayed that will be plotted as well.
It defines line of plots named: ‘ConnectionsPlot.Plot0’ ... ‘DelaysPlot.PlotN` and ‘DelaysPlot.Plot0’ ... ‘DelaysPlot.PlotN where N is number of projections.
Parameters : | pnv_dsv : Datastore
|
---|---|
Other Parameters: | |
neuron : int
reversed : bool
sheet_name : str
|
Notes
One PerNeuronValue can be present per target sheet!
See mozaik.visualization for more general documentation.
Bases: object
The low level plotting API based around matplotlib.
Each simple plot is assumed to create a single axis - this happens in this class. Each user defined low-level plotting function is supposed to derive from this class and implement the four abstract methods: pre_axis_plot, pre_plot, plot, post_plot, to direct the styling and decoration of the plot, and call the actual matplotlib plotting functions in the plot function.
The main policy that this API declares is that any overwriting of the standard style default values by the Plotting mechanisms should take precedence over those done by specific instances of SimplePlot. In order to enforce this precedence, the modifiable parameters of the classes should be stored in the common dictionary parameters. Each class derived from SimplePlot should add its modifiable parameters into the parameters dictionary in its constructor. We will document the modifiable parameters the given class declares in the ‘Other parameters’ section.
The kwargs passed to the instances of SimplePlot from the Plotting mechanisms will be stored. At the beginning of the __call__ the dictionary will be updated with these stored kwargs, and the updated parameters (note not all have to be present) will be marked. These marked parameters will not be then modifiable any further. In order to do so, the parameters dictionary is accessible via the __getattr__ and __setattr__ functions.
Note, for this reason all `SimplePlot` classes need to take care that none of the modifiable attributes is also defined as a class attribute.
The function that is executed before the axis is created.
The function that is executed before the plotting but after the axis is created.
The function that has to perform the low level plotting. This is where the main matplotlib plot calls will happen.
The function that is executed after the plotting.
Updates the modifiable parameters and sets them to be further un-modifiable
Bases: mozaik.visualization.simple_plot.StandardStyle
This function plots the raster plot of spikes in the spike_lists argument.
Parameters : | spike_lists : list
|
---|---|
Other Parameters: | |
group_trials : bool
colors : list
|
Notes
Each trial will be plotted as a sepparate line of spikes, and these will be grouped by the neurons. Only neurons in the neurons parameter will be plotted. If neurons are None, (up to) first 10 neurons will be plotted.
Bases: mozaik.visualization.simple_plot.SpikeRasterPlot
This function plots the raster plot of spikes in the spike_list argument.
Parameters : | spike_list : list
|
---|---|
Other Parameters: | |
bin_width : bool
colors : list
|
Notes
Each trial will be plotted as a sepparate line of spikes, and these will be grouped by the neurons. Only neurons in the neurons parameter will be plotted. If neurons are None, the first neuron will be plotted.
Bases: mozaik.visualization.simple_plot.StandardStyle
This is an abstract class helping construction of animated graphs.
Each class subclassing from this class should implement the SimplePlot plot() function in which it should draw the first frame of the animation with all the corresponding decorations.
Next it needs to implement the plot_next_frame function which should replot the data in the plot corresponding to the next frame. This function needs to keep track of the frame number itself if it needs it. Note that advanced usage of matplotlib is recomanded here so that not the whole graph is always replotted but only new data are set to the graph.
The StandardStyleAnimatedPlot will take care of the updating of the figure, so now draw() or show() or event commands should be issued.
Parameters : | frame_duration : double
|
---|
The function that each instance of StandardStyleAnimatedPlot has to implement, in which it updated the data in the plot to the next frame.
Bases: mozaik.visualization.simple_plot.StandardStyleAnimatedPlot
An instatiation of StandardStyleAnimatedPlot that works with regularly sampled data - i.e. 3D matricies where axis are interpreted as x,y,t.
Parameters : | movie : ndarray
|
---|
Bases: mozaik.visualization.simple_plot.StandardStyleAnimatedPlot
An instatiation of StandardStyleAnimatedPlot that works with irregularly sampled data. That data are assumed to have constant positions throught the time.
Parameters : | x : ndarray
y : ndarray
z : ndarray
|
---|
Bases: mozaik.visualization.simple_plot.StandardStyle
Simple scatter plot
Parameters : | z : ndarray
x : ndarray
y : ndarray
periodic : bool
period : double
|
---|---|
Other Parameters: | |
identity_line : bool
colorbar : bool
colormap : colormap
dot_size : double
marker : str
equal_aspect_ratio : bool
mark_means : bool
colorbar_label : label
|
Bases: mozaik.visualization.simple_plot.StandardStyle
This function plots vector data in simple line plots.
Parameters : | x, y : list
labels : list, optional
|
---|---|
Other Parameters: | |
colors : int or list
mean : bool
|
Bases: mozaik.visualization.simple_plot.StandardStyle
Plots conductances.
Parameters : | exc : list
inh : list
|
---|---|
Other Parameters: | |
legend : bool
|
Bases: mozaik.visualization.simple_plot.StandardStyle
A plot that will display connections.
Parameters : | pos_x : ndarray
pos_y : ndarray
source_x : double
source_y : double
weights : list
colors : list, optional
period : float, optional
|
---|---|
Other Parameters: | |
line : bool
colorbar : bool
colormap : colormap
colorbar_label : label
|
This module contains classes that assist with construction of complicated arrangements of plots. A typical example is a class that helps with creating a line of plots with a common y axis.
Bases: param.parameterized.Parameterized
Plot multiple plots with common x or y axis in a row or column. The user has to specify the function. This one has to return a list of tuples, each containing:
- a name of a plot
- a Plotting or SimplePlot instance
- the simple_plot parameters that should be passed on
Assuming each function returns a list of plots with names PlotA,...PlotX The LinePlot will create a list of plots named:
PlotA.plot0 ... PlotA.plotN PlotX.plot0 ... PlotX.plotN
where N is defined by the length parameter. User can this way target the plots with parameters as desribed in the Plotting class.
Mozaik parameters: | |
---|---|
|
Call to execute the line plot.
Parameters : | funtion : func
subplotspec : subplotspec
|
---|
Bases: mozaik.visualization.plot_constructors.LinePlot
This is a LinePlot that automatically partitions the datastore view based on some rules, and than executes the individual plots on the line over the individual DSVs.
Unlike LinePlot the function parameter should accept as the first arguemnt DSV not the index of the plot on the line.
The partition dsvs function should perform the partitioning.
Mozaik parameters: | |
---|---|
|
Bases: mozaik.visualization.plot_constructors.PerDSVPlot
Line plot where each plot corresponds to stimulus with the same parameter except trials.
The self.dsvs will contain the datastores you want to plot in each of the subplots - i.e. all recordings in the given datastore come from the same stimulus of the same parameters except for the trial parameter.
PerStimulusPlot provides several automatic titling of plots based on the stimulus name and parameters. The currently supported styles are:
“None” - No title
Mozaik parameters: | |
---|---|
|
Bases: mozaik.visualization.plot_constructors.PerStimulusPlot
As PerStimulusPlot, but partitions the ADS not recordings.
Bases: param.parameterized.Parameterized
Set of plots that are placed on a grid, that vary in two parameters and can have shared x or y axis (only at the level of labels for now).
Mozaik parameters: | |
---|---|
|