Skip to content
This repository was archived by the owner on Mar 23, 2019. It is now read-only.

Figure Handlers

Mark Cafaro edited this page Apr 15, 2014 · 1 revision

Symphony provides a number of pre-built classes for displaying different types of figures. A protocol can open one of the figure windows using the openFigure() method from the SymphonyProtocol base class.

Response figure

This figure plots the response from the most recent epoch. No arguments are required. If there is more than one device with a response, however, the device name containing the response to plot should be specified.

Examples:

obj.openFigure('Response');
obj.openFigure('Response', 'Amplifier_Ch1');

Mean response figure

This figure displays the mean response of all epochs run so far. The epochs are grouped by a set of parameters and the mean of each group is plotted. The grouping parameters can be specified using the 'GroupByParams' argument or they will be determined automatically. The device name containing the response can also be specified as the second argument.

Examples:

obj.openFigure('Mean Response');
obj.openFigure('Mean Response', 'GroupByParams', {'param1', 'param2'});
obj.openFigure('Mean Response', 'Amplifier_Ch1');

Response statistics figure

This figure plots statistics for each epoch that has been run. A callback function must be provided that returns a structure containing the statistics for the current epoch. The response() method can be called to get the response of the most recent epoch.

Example:

function s = stats(obj)
    % Provide statistics for the current epoch.
    r = obj.response();
    
    s.mean = mean(r);
    s.var = var(r);
end

function prepareRun(obj)
    % ... call base method, other setup, etc. ...
    
    obj.openFigure('Response Statistics', 'StatsCallback', @stats);
end

Custom figure

This figure simply opens an empty axes and calls back to the protocol after each epoch is run to allow updates.

Example:

function updateFigure(obj, axesHandle)
    % Update the title with the current epoch number.
    title(axesHandle, ['Epoch ' str2num(obj.epochNum)]);
end

function prepareRun(obj)
    % ... call base method, other setup, etc. ...
    
    obj.openFigure('Custom', 'Name', 'Custom Plot', ...
                             'UpdateCallback', @updateFigure);
end
Clone this wiki locally