Difference between revisions of "Plugins-water"

From Bcontrol
m
 
Line 3: Line 3:
 
From the Matlab help file, "help @water/WaterValvesSection"
 
From the Matlab help file, "help @water/WaterValvesSection"
  
<pre>% [x, y] = WaterValvesSection(obj, action, x, y)
+
<pre>
 +
% [x, y] = WaterValvesSection(obj, action, x, y)
 
%
 
%
 
% This plugin uses the water calibration table (constructed using
 
% This plugin uses the water calibration table (constructed using
Line 44: Line 45:
 
%            current figure.
 
%            current figure.
 
%      Optional Params:
 
%      Optional Params:
%      streak_gui [0]
+
%      'streak_gui' 0  
%            If streak_gui is passed and set to 1 during init, then two
+
%            If 'streak_gui' is passed and set to 1 during init, then two
%            parameters are made visible that involve increasing rewards
+
%            parameters are made visible that involve gemoetrically
%            for consecutive correct answers, ie. 'streaks': Streak_base
+
%            increasing rewards for consecutive correct answers, ie.
%            and Streak_max.  See 'get_water_times' for further details.
+
%            'streaks': Streak_base and Streak_max.  See 'get_water_times'
 +
%            for further details.
 
%            e.g. [x,y]=WaterValvesSection(obj,'init',x,y,'streak_gui',1);
 
%            e.g. [x,y]=WaterValvesSection(obj,'init',x,y,'streak_gui',1);
 
%
 
%
Line 60: Line 62:
 
%            by hand, directly in the GUI.
 
%            by hand, directly in the GUI.
 
%
 
%
%  'get_water_times'  
+
%  'get_water_times' [streak_length=0]
 
%            Returns two values, LeftTime, and RightTime, which are the
 
%            Returns two values, LeftTime, and RightTime, which are the
 
%            water valve opening times that were calculated to correspond
 
%            water valve opening times that were calculated to correspond
%            to the GUI dispense amounts.
+
%            to the GUI dispense amounts. Example call:
 +
%              WaterValvesSection(obj,'get_water_times', 3);
 
%        Optional Params:
 
%        Optional Params:
%       streak_length
+
%           If an extra argument is passed in, this argument will be taken
%            If streak_length is passed in:
+
%            to represent the "streak_length", i.e., the number of
%           WaterValvesSection(obj,'get_water_times',streak_length);
+
%            immediately previous consecutive correct responses by the
%            Then the returned Water time values are  
+
%            subject. For example, if the previous four trials were miss,
%            water_time*Streak_base^min(streak_length,Streak_max);
+
%            correct, correct, correct, the streak would be three and you
%      
+
%            could make the call as in:
 +
%               WaterValvesSection(obj,'get_water_times', 3);
 +
%            If this param is passed in, the returned Water time values are
 +
%            augmented by the formula:
 +
%              water_time*Streak_base^min(streak_length,Streak_max);
 +
%           Generally you want Streak_base > 1, so that there is more
 +
%            water for longer streaks.
 
%  
 
%  
 
%  'calculate'
 
%  'calculate'

Latest revision as of 23:28, 1 September 2007

Click here for some simple example code using the @water plugin.

From the Matlab help file, "help @water/WaterValvesSection"

% [x, y] = WaterValvesSection(obj, action, x, y)
%
% This plugin uses the water calibration table (constructed using
% @WaterCalibrationTable) to automatically translate from a desired water
% delivery amount into a time for which the water valve should be left
% open.
%
% GUI DISPLAY: Puts up two numerical editable fields, Left microliters and
% Right microliters, where the user can insert the desired dispense amount.
% To the right of these will be two display fields showing the
% corresponding times for which the valves should be left open. A title
% will be above all these GUI fields. If the GUIs for the desired amounts
% are edited by a user, (or changed by loading Solo settings), the dispense
% times will be automatically recalculated.
%
% Note that @WaterCalibrationTable figures out dispense times for amounts
% that are within 15% of the calibrated data points that it has; and that
% calibrations have finite lifetimes. If asking for a value that is beyond
% the known range of the calibration table, or the calibration table is out
% of date, a warning window will go up, dispense times will acquire a red
% background, and dispense times will go to a default value of 0.01 (i.e.,
% essentially nothing.) If your dispense times have a red background, that
% means "recalibrate your table before using them" !!
%
%
% PARAMETERS AND RETURNS:
% -----------------------
%
% obj      Default object argument.
%
% action   One of:
%
%   'init' x y 
%            Initializes the plugin and sets up the GUI for it. Requires
%            two extra arguments, which will be the (x, y) coords, in
%            pixels, of the lower left hand corner of where this plugin's
%            GUI elements will start to be displayed in the current figure.
%            Returns [x, y], the position of the top left hand corner of
%            the plugin's GUI elements after they have been added to the
%            current figure.
%       Optional Params:
%       'streak_gui' 0 
%            If 'streak_gui' is passed and set to 1 during init, then two
%            parameters are made visible that involve gemoetrically
%            increasing rewards for consecutive correct answers, ie.
%            'streaks': Streak_base and Streak_max.  See 'get_water_times'
%            for further details.
%            e.g. [x,y]=WaterValvesSection(obj,'init',x,y,'streak_gui',1);
%
%   'set_water_amounts'  l_uL r_uL
%            Requires two extra arguments; sets the GUI parameter for left
%            volume to the first of these, l_uL, and sets the GUI
%            parameter for right volume to the second, r_uL; then
%            recalculates the appropriate water dispense times. This action
%            is provided here to allow a command-line way of changing the
%            GUIs for left and right volume; the user can also change them
%            by hand, directly in the GUI.
%
%   'get_water_times'  [streak_length=0]
%            Returns two values, LeftTime, and RightTime, which are the
%            water valve opening times that were calculated to correspond
%            to the GUI dispense amounts. Example call:
%              WaterValvesSection(obj,'get_water_times', 3);
%        Optional Params:
%            If an extra argument is passed in, this argument will be taken
%            to represent the "streak_length", i.e., the number of
%            immediately previous consecutive correct responses by the
%            subject. For example, if the previous four trials were miss,
%            correct, correct, correct, the streak would be three and you
%            could make the call as in:
%               WaterValvesSection(obj,'get_water_times', 3);
%            If this param is passed in, the returned Water time values are
%            augmented by the formula:
%               water_time*Streak_base^min(streak_length,Streak_max);
%            Generally you want Streak_base > 1, so that there is more
%            water for longer streaks.
% 
%   'calculate'
%            Force a recalculation of water dispanse times. This call
%            should normally never be needed by the user, since both
%            command line and GUI modes of changing desired dispense times
%            automaticaly force the recalculation.
%
%   'reinit' Delete all of this section's GUIs and data, and reinit, at the
%            same position on the same figure as the original section GUI
%            was placed.
%