Home > . > DIVA_Sensory.m

DIVA_Sensory

PURPOSE ^

DIVA_Sensory: DIVA Sensory model

SYNOPSIS ^

function out=DIVA_Sensory(action,varargin);

DESCRIPTION ^

 DIVA_Sensory: DIVA Sensory model

 DIVA_Sensory('init' [,SessionName]);          Initializes the module
 DIVA_Sensory('save' [,SessionName] );         Saves state 
 DIVA_Sensory('exit');                         Exits the module (without saving)
 DIVA_Sensory(PropertyName [,PropertyValue] )  Reads and writes internal model properties

 DIVA_Sensory('configuration',s,delay);  
 Sends the vocal tract configuration in vector s (see output of VocalTract module) 
 to the sensory model with a given delay. The module computes the proprioceptive
 and somatosensory consequences associated with the configuration s, and
 sends them to the SomatosensoryCortex module.

 Current DIVA_Sensory properties are: (* requires re-initialization)
   *  delayToSomatosensoryCortex  : delay (in seconds) for signals to SomatosensoryCortex

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function out=DIVA_Sensory(action,varargin);
0002 % DIVA_Sensory: DIVA Sensory model
0003 %
0004 % DIVA_Sensory('init' [,SessionName]);          Initializes the module
0005 % DIVA_Sensory('save' [,SessionName] );         Saves state
0006 % DIVA_Sensory('exit');                         Exits the module (without saving)
0007 % DIVA_Sensory(PropertyName [,PropertyValue] )  Reads and writes internal model properties
0008 %
0009 % DIVA_Sensory('configuration',s,delay);
0010 % Sends the vocal tract configuration in vector s (see output of VocalTract module)
0011 % to the sensory model with a given delay. The module computes the proprioceptive
0012 % and somatosensory consequences associated with the configuration s, and
0013 % sends them to the SomatosensoryCortex module.
0014 %
0015 % Current DIVA_Sensory properties are: (* requires re-initialization)
0016 %   *  delayToSomatosensoryCortex  : delay (in seconds) for signals to SomatosensoryCortex
0017 %
0018 
0019 % Dependencies:
0020 %
0021 
0022 out=[];
0023 global DIVA_Sensory_data
0024 if nargin<1, 
0025   action='init'; 
0026 end
0027 
0028 switch(lower(action)),     
0029   %%%%%%%%%%%%%%%% INITIALIZATION %%%%%%%%%
0030   %%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%
0031  case 'init',
0032   SessionFolder=strcat(DIVA('SessionFolder'),filesep);
0033   if nargin<2 | isempty(varargin{1}), 
0034     initfile=''; 
0035   else, 
0036     initfile=[SessionFolder,'Session_',varargin{1},filesep,mfilename,'.mat']; 
0037   end
0038   if isempty(initfile) | isempty(dir(initfile)),
0039     disp([mfilename, ' : Defining new session...']);
0040     DIVA_Sensory_data.params=struct(...
0041         'MaedaSpread',DIVA('VocalTract','MaedaSpread'),... % VocalTract boundary values
0042         'nMotor',DIVA('VocalTract','nArtic'),... % Dimension of Motor representation
0043         'delayToSomatosensoryCortex',.005);
0044     % Transformations for proprioceptive sensory representation
0045     DIVA_Sensory_data.params.Motor2Proprioceptive=...
0046         cat(2,.5*ones(2*DIVA_Sensory_data.params.nMotor,1), ...
0047             kron(eye(DIVA_Sensory_data.params.nMotor),...
0048                  [.5;-.5]/DIVA_Sensory_data.params.MaedaSpread));
0049     % Transformation for tactile sensory representation
0050     DIVA_Sensory_data.params.Maeda2Palate = ...
0051         diag(1./[9,8,7,5,4,9])*...
0052         [4.975 0.391 -1.528  0.372 1.710  0; ...
0053          3.802 0.394 -1.577  0.616 1.449  0; ...
0054          2.138 0.194 -1.444  0.638 0.793  0; ...
0055          0.378 0.283 -1.229  0.626 0.322  0; ...
0056          -0.484 0.388 -0.891  0.703 0.391  0; ...
0057          4.919 0.271  0.028 -0.004 -0.001 -1.8114];
0058     
0059     % # of neurons for sensory representation
0060     DIVA_Sensory_data.params.nSensory = ...
0061         size(DIVA_Sensory_data.params.Motor2Proprioceptive,1)+...
0062         size(DIVA_Sensory_data.params.Maeda2Palate,1); 
0063     
0064   else,
0065     data=load(initfile,'-mat');
0066     DIVA_Sensory_data.params=data.params;
0067   end
0068   out={};
0069   
0070  case 'save',
0071   SessionFolder=strcat(DIVA('SessionFolder'),filesep);
0072   if nargin<2, 
0073     initfile=[SessionFolder,'Session_','default',filesep,mfilename,'.mat']; 
0074   else, 
0075     initfile=[SessionFolder,'Session_',varargin{1},filesep,mfilename,'.mat']; 
0076   end
0077   params=DIVA_Sensory_data.params;
0078   save(initfile,'params'); 
0079   
0080  case 'exit',
0081   clear DIVA_Sensory_data;
0082   
0083  case 'disp',
0084   disp(DIVA_Sensory_data.params);
0085   out=fieldnames(DIVA_Sensory_data.params);
0086   
0087   %%%%%%%%%%%%%%%% ACTION %%%%%%%%%%%%%%%%%
0088   %%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%
0089 
0090  case 'configuration',
0091   Ar = varargin{1}(1:DIVA_Sensory_data.params.nMotor,:); 
0092   Maeda = varargin{1}(DIVA_Sensory_data.params.nMotor+1:end,:); 
0093   if nargin<3 | isempty(varargin{2}), 
0094     delay=0; 
0095   else, 
0096     delay=varargin{2}; 
0097   end
0098   % Calculate Sensory representation of current motor
0099   % configuration, with a hard-limit [0,1]
0100   out = cat(1,DIVA_Sensory_data.params.Motor2Proprioceptive*[ones(1,size(Ar,2));Ar],... 
0101             max(0, min(1, DIVA_Sensory_data.params.Maeda2Palate*[ones(1,size(Maeda,2));...
0102                       Maeda(1:5,:)])));
0103   
0104   % projects output to SomatosensoryCortex
0105   if ~nargout,
0106     DIVA('SomatosensoryCortex','somatosensory',out,...
0107          delay+DIVA_Sensory_data.params.delayToSomatosensoryCortex);
0108   end
0109   
0110  otherwise,
0111   if isfield(DIVA_Sensory_data.params,action),
0112     if nargin<2, 
0113       out=DIVA_Sensory_data.params.(action); 
0114     else, 
0115       DIVA_Sensory_data.params.(action)=varargin{1}; 
0116     end
0117   else, 
0118     warning('DIVA_Sensory: wrong argument'); 
0119   end
0120 end

Generated on Tue 27-Mar-2007 12:06:24 by m2html © 2003