Package topo :: Package plotting :: Module plotgroup :: Class TemplatePlotGroup
[hide private]
[frames] | no frames]

Class TemplatePlotGroup

source code

                       object --+            
                                |            
param.parameterized.Parameterized --+        
                                    |        
                            PlotGroup --+    
                                        |    
                           SheetPlotGroup --+
                                            |
                                           TemplatePlotGroup
Known Subclasses:

Container that allows creation of different types of plots in a way that is independent of particular models or Sheets.

A TemplatePlotGroup is constructed from a plot_templates list, an optional command to run to generate the data, and other optional parameters.

The plot_templates list should contain tuples (plot_name, plot_template). Each plot_template is a list of (name, value) pairs, where each name specifies a plotting channel (such as Hue or Confidence), and the value is the name of a SheetView (such as Activity or OrientationPreference).

Various types of plots support different channels. An SHC plot supports Strength, Hue, and Confidence channels (with Strength usually being visualized as luminance, Hue as a color value, and Confidence as the saturation of the color). An RGB plot supports Red, Green, and Blue channels. Other plot types will be added eventually.

For instance, one could define an Orientation-colored Activity plot as:

plotgroups['Activity'] =
    TemplatePlotGroup(name='Activity', category='Basic',
        update_command='measure_activity()',
        plot_templates=[('Activity',
            {'Strength': 'Activity', 'Hue': 'OrientationPreference', 'Confidence': None})])

This specifies that the final TemplatePlotGroup will contain up to one Plot named Activity per Sheet, although there could be no plots at all if no Sheet has a SheetView named Activity once 'measure_activity()' has been run. The Plot will be colored by OrientationPreference if such a SheetView exists for that Sheet, and the value (luminance) channel will be determined by the SheetView Activity. This plot will be listed in the category 'Basic' anywhere such categories are relevant (e.g. in the GUI).

Here's a more complicated example specifying two different plots in the same PlotGroup:

TemplatePlotGroup(name='Orientation Preference', category='Basic'
    update_command='measure_or_pref()',
    plot_templates=
        [('Orientation Preference',
            {'Strength': None, 'Hue': 'OrientationPreference'}),
         ('Orientation Selectivity',
            {'Strength': 'OrientationSelectivity'})])

Here the TemplatePlotGroup will contain up to two Plots per Sheet, depending on which Sheets have OrientationPreference and OrientationSelectivity SheetViews.

The function create_plotgroup provides a convenient way to define plots using TemplatePlotGroups; search for create_plotgroup elsewhere in the code to see examples.

Nested Classes [hide private]

Inherited from param.parameterized.Parameterized: __metaclass__

Instance Methods [hide private]
 
add_plot(self, name, specification_tuple_list) source code
 
add_static_image(self, name, file_path)
Construct a static image Plot (e.g.
source code
 
__init__(self, plot_templates=[], static_images=[], **params)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
_plot_list(self)
Return the list of plots.
source code
 
_create_plots(self, pt_name, pt, sheet) source code

Inherited from SheetPlotGroup: make_plots, scale_images, update_maximum_plot_height

Inherited from SheetPlotGroup (private): _sheets

Inherited from PlotGroup: generate_labels

Inherited from param.parameterized.Parameterized: __getstate__, __repr__, __setstate__, __str__, debug, defaults, force_new_dynamic_value, get_param_values, get_value_generator, inspect_value, message, print_param_values, script_repr, set_dynamic_time_fn, state_pop, state_push, verbose, warning

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__

Class Methods [hide private]

Inherited from param.parameterized.Parameterized: params, print_param_defaults

Class Variables [hide private]
  doc = param.String(default= "", doc= ...
Documentation string describing this type of plot.
  plot_immediately = param.Boolean(False, doc= ...
Whether to call the plot command at once or only when the user asks for a refresh.
  prerequisites = param.List([], doc= ...
List of preference maps that must exist before this plot can be calculated.
  category = param.String(default= "User", doc= ...
Category to which this plot belongs, which will be created if necessary.

Inherited from SheetPlotGroup: auto_refresh, desired_maximum_plot_height, enforce_minimum_plot_height, integer_scaling, normalize, sheet_coords

Inherited from PlotGroup: plot_command, update_command

Inherited from param.parameterized.Parameterized: name, print_level

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

add_static_image(self, name, file_path)

source code 
Construct a static image Plot (e.g. a color key for an Orientation Preference map).

__init__(self, plot_templates=[], static_images=[], **params)
(Constructor)

source code 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Overrides: object.__init__
(inherited documentation)

_plot_list(self)

source code 

Return the list of plots.

Re-implemented by TemplatePlotGroup to construct a list of plots as specified by the template.

Overrides: PlotGroup._plot_list
(inherited documentation)

Class Variable Details [hide private]

doc

Documentation string describing this type of plot.
Value:
param.String(default= "", doc= """
        Documentation string describing this type of plot.""")

plot_immediately

Whether to call the plot command at once or only when the user asks for a refresh.

Should be set to true for quick plots, but false for those that take a long time to calculate, so that the user can change the update command if necessary.

Value:
param.Boolean(False, doc= """
        Whether to call the plot command at once or only when the user asks for a \
refresh.
 
        Should be set to true for quick plots, but false for those that take a lon\
g time
        to calculate, so that the user can change the update command if necessary.\
""")

prerequisites

List of preference maps that must exist before this plot can be calculated.
Value:
param.List([], doc= """
        List of preference maps that must exist before this plot can be calculated\
.""")

category

Category to which this plot belongs, which will be created if necessary.
Value:
param.String(default= "User", doc= """
        Category to which this plot belongs, which will be created if necessary.""\
")