Home > functions > estimation > bayes > vb_set_noise_estimation_model.m

vb_set_noise_estimation_model

PURPOSE ^

Set noise estimation model

SYNOPSIS ^

function bayes_parm = vb_set_noise_estimation_model(bayes_parm, proj_root)

DESCRIPTION ^

 Set noise estimation model
  bayes_parm = vb_set_noise_estimation_model(bayes_parm, proj_root)
 --- Input field
 Noise estimation model is determined according to the following fields
    bayes_parm.forward_model
    bayes_parm.noise_estimation_model
    bayes_parm.soft_mode
    
 --- Output field

 --- Noise estimation model
 bayes_parm.megnoisefile   % MEG sensor noise file
 bayes_parm.twin_noise     % Noise estimation time window
 bayes_parm.twin_global    % Baseline activity estimation time window
 bayes_parm.noise_model    % Covariance noise matrix
 bayes_parm.update_sx      % sensor noise update flag
 bayes_parm.update_v       % current baseline update flag
 bayes_parm.flag_baseline  % sensor noise estimation flag
 bayes_parm.flag_noise_set % current baseline estimation flag
 --- Global window
 bayes_parm.basisfile_global 
 bayes_parm.area_key_global 
 bayes_parm.Rfilt_global    
 --- Soft normal constraint
 bayes_parm.variance_orientation 
 
 --- Possible noise_estimation_model
 'COVARIANCE NOISE' : forward_model = 'focal' or 'focal+global'
        sx0 = pretriger noise
        current baseline estimation together with sensor noise estimation
 = 1 :  update_sx = ON,  update_v = OFF  - Default for 'focal'
 = 2 :  update_sx = OFF, update_v = OFF  (NO UPDATE)

 'ISOTROPIC NOISE'  : forward_model = 'focal+global'
        sx0 = estimated noise with current baseline
        current baseline estimation together with sensor noise estimation
 = 3 :  update_sx = ON,  update_v = ON   - Default for 'focal+global'
 = 4 :  update_sx = ON,  update_v = OFF  (NO GLOBAL UPDATE)
 = 5 :  update_sx = OFF, update_v = OFF  (NO UPDATE)

 'FIXED NOISE'      : forward_model = 'focal+global'
        sx0 = pretriger noise
        current baseline estimation  with fixed sensor noise
 = 6 :  update_sx = OFF, update_v = ON
 = 7 :  update_sx = OFF, update_v = OFF  (NO UPDATE)

 [history]
 vbmeg-0.45 M. Sato , 2005-8-31
 2011-06-20 taku-y
  [debug]: megfile -> megfile_baseline in 

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function bayes_parm = vb_set_noise_estimation_model(bayes_parm, proj_root)
0002 % Set noise estimation model
0003 %  bayes_parm = vb_set_noise_estimation_model(bayes_parm, proj_root)
0004 % --- Input field
0005 % Noise estimation model is determined according to the following fields
0006 %    bayes_parm.forward_model
0007 %    bayes_parm.noise_estimation_model
0008 %    bayes_parm.soft_mode
0009 %
0010 % --- Output field
0011 %
0012 % --- Noise estimation model
0013 % bayes_parm.megnoisefile   % MEG sensor noise file
0014 % bayes_parm.twin_noise     % Noise estimation time window
0015 % bayes_parm.twin_global    % Baseline activity estimation time window
0016 % bayes_parm.noise_model    % Covariance noise matrix
0017 % bayes_parm.update_sx      % sensor noise update flag
0018 % bayes_parm.update_v       % current baseline update flag
0019 % bayes_parm.flag_baseline  % sensor noise estimation flag
0020 % bayes_parm.flag_noise_set % current baseline estimation flag
0021 % --- Global window
0022 % bayes_parm.basisfile_global
0023 % bayes_parm.area_key_global
0024 % bayes_parm.Rfilt_global
0025 % --- Soft normal constraint
0026 % bayes_parm.variance_orientation
0027 %
0028 % --- Possible noise_estimation_model
0029 % 'COVARIANCE NOISE' : forward_model = 'focal' or 'focal+global'
0030 %        sx0 = pretriger noise
0031 %        current baseline estimation together with sensor noise estimation
0032 % = 1 :  update_sx = ON,  update_v = OFF  - Default for 'focal'
0033 % = 2 :  update_sx = OFF, update_v = OFF  (NO UPDATE)
0034 %
0035 % 'ISOTROPIC NOISE'  : forward_model = 'focal+global'
0036 %        sx0 = estimated noise with current baseline
0037 %        current baseline estimation together with sensor noise estimation
0038 % = 3 :  update_sx = ON,  update_v = ON   - Default for 'focal+global'
0039 % = 4 :  update_sx = ON,  update_v = OFF  (NO GLOBAL UPDATE)
0040 % = 5 :  update_sx = OFF, update_v = OFF  (NO UPDATE)
0041 %
0042 % 'FIXED NOISE'      : forward_model = 'focal+global'
0043 %        sx0 = pretriger noise
0044 %        current baseline estimation  with fixed sensor noise
0045 % = 6 :  update_sx = OFF, update_v = ON
0046 % = 7 :  update_sx = OFF, update_v = OFF  (NO UPDATE)
0047 %
0048 % [history]
0049 % vbmeg-0.45 M. Sato , 2005-8-31
0050 % 2011-06-20 taku-y
0051 %  [debug]: megfile -> megfile_baseline in
0052 %
0053 % Copyright (C) 2011, ATR All Rights Reserved.
0054 % License : New BSD License(see VBMEG_LICENSE.txt)
0055 
0056 %% --- Global window
0057 if ~isfield(bayes_parm,'basisfile_global') ...
0058       | isempty(bayes_parm.basisfile_global)
0059   bayes_parm.basisfile_global = bayes_parm.basisfile;
0060 end
0061 
0062 switch    bayes_parm.forward_model 
0063  case    'focal+global'
0064   if ~isfield(bayes_parm,'area_key_global') ...
0065         | isempty(bayes_parm.area_key_global)
0066     bayes_parm.area_key_global = ['Cortex'];
0067   end
0068   if ~isfield(bayes_parm,'Rfilt_global') ...
0069         | isempty(bayes_parm.Rfilt_global)
0070     bayes_parm.Rfilt_global    = 0;
0071   end
0072  case    'focal'
0073   bayes_parm.area_key_global = bayes_parm.area_key;
0074   bayes_parm.Rfilt_global    = bayes_parm.Rfilt;
0075 end
0076 
0077 %% --- Soft normal constraint
0078 if bayes_parm.soft_mode == 1,
0079   bayes_parm.variance_orientation = ON;  
0080 else
0081   bayes_parm.variance_orientation = OFF;  
0082 end
0083 
0084 %% --- Noise_estimation_model
0085 switch bayes_parm.noise_estimation_model
0086 case {1,2},
0087  % 'COVARIANCE NOISE'
0088  % Mainly used in focal model
0089     
0090  %bayes_parm.megnoisefile = [bayes_parm.megfile];
0091  %bayes_parm.megfile_baseline = [bayes_parm.megfile];
0092  MEGinfo = vb_load_meg_info([proj_root filesep bayes_parm.megfile{1}]);
0093     
0094  % Noise estimation time window
0095  if ~isfield(bayes_parm, 'twin_noise')|isempty(bayes_parm.twin_noise)
0096    bayes_parm.twin_noise  = [1, MEGinfo.Pretrigger];
0097  end
0098  % Baseline activity estimation time window
0099  %if ~isfield(bayes_parm, 'twin_global')|isempty(bayes_parm.twin_global)
0100  %    bayes_parm.twin_global = [1, MEGinfo.Pretrigger];
0101  %end
0102  if ~isfield(bayes_parm, 'twin_baseline')|isempty(bayes_parm.twin_baseline)
0103    bayes_parm.twin_baseline = [1, MEGinfo.Pretrigger];
0104  end
0105 
0106  % Covariance noise matrix
0107  bayes_parm.noise_model = 3;
0108  % current baseline estimation together with sensor noise estimation
0109  bayes_parm.flag_baseline  = 0;
0110  % sx0 = pretriger noise
0111  bayes_parm.flag_noise_set = 0;
0112 
0113  % update flag
0114  switch bayes_parm.noise_estimation_model
0115   case    1
0116    bayes_parm.update_sx = ON;
0117    bayes_parm.update_v  = OFF;
0118   case    2
0119    % (NO UPDATE)
0120    bayes_parm.update_sx = OFF; 
0121    bayes_parm.update_v  = OFF;
0122  end
0123  case {3,4,5},
0124   % 'ISOTROPIC NOISE'
0125   % Mainly used in focal+global model
0126     
0127   %bayes_parm.megnoisefile = [bayes_parm.megfile];
0128   %bayes_parm.megfile_baseline = [bayes_parm.megfile];
0129   MEGinfo = vb_load_meg_info([proj_root filesep bayes_parm.megfile{1}]);
0130   % Noise estimation time window
0131   if ~isfield(bayes_parm, 'twin_noise')|isempty(bayes_parm.twin_noise)
0132     bayes_parm.twin_noise  = [1, MEGinfo.Pretrigger];
0133   end
0134   % Baseline activity estimation time window
0135   %if ~isfield(bayes_parm, 'twin_global')|isempty(bayes_parm.twin_global)
0136   %    bayes_parm.twin_global = [1, MEGinfo.Pretrigger];
0137   %end
0138   if ~isfield(bayes_parm, 'twin_baseline')|isempty(bayes_parm.twin_baseline)
0139     bayes_parm.twin_baseline = [1, MEGinfo.Pretrigger];
0140   end
0141 
0142   % Identity noise matrix
0143   bayes_parm.noise_model = 1;
0144   % current baseline estimation together with sensor noise estimation
0145   bayes_parm.flag_baseline  = 0;
0146   % sx0 = estimated noise with current baseline
0147   bayes_parm.flag_noise_set = 1; 
0148     
0149   % update flag
0150   switch bayes_parm.noise_estimation_model
0151    case    3
0152     bayes_parm.update_sx = ON;
0153     bayes_parm.update_v  = ON;
0154    case    4
0155     % (NO GLOBAL UPDATE)
0156     bayes_parm.update_sx = ON;
0157     bayes_parm.update_v  = OFF;
0158    case    5
0159     % (NO UPDATE)
0160     bayes_parm.update_sx = OFF; 
0161     bayes_parm.update_v  = OFF;
0162   end
0163  case {6,7},    
0164   % 'FIXED NOISE'
0165   % Only for focal+global model
0166     
0167   %if ~isfield(bayes_parm,'megnoisefile') ...
0168   %   | isempty(bayes_parm.megnoisefile),
0169   %  error('Please specify the file for observation noise specification');
0170   %end
0171   if ~isfield(bayes_parm,'megfile_baseline') ...
0172         | isempty(bayes_parm.megfile_baseline),
0173     error('Please specify the file for observation noise specification');
0174   end
0175   if bayes_parm.forward_model ~= 'focal+global',
0176     error('forward_model should be focal+global in SUPPLY NOISE FILE');
0177   end
0178 
0179   % Noise estimation time window
0180   %MEGinfo = vb_load_meg_info([proj_root filesep bayes_parm.megnoisefile{1}]);
0181   MEGinfo = vb_load_meg_info([proj_root filesep bayes_parm.megfile_baseline{1}]);
0182   if ~isfield(bayes_parm, 'twin_noise')|isempty(bayes_parm.twin_noise)
0183     bayes_parm.twin_noise = [1, MEGinfo.Nsample];
0184   end
0185   % Baseline activity estimation time window
0186   MEGinfo = vb_load_meg_info([proj_root filesep bayes_parm.megfile{1}]);
0187   %if ~isfield(bayes_parm, 'twin_global')|isempty(bayes_parm.twin_global)
0188   %    bayes_parm.twin_global = [1, MEGinfo.Pretrigger];
0189   %end
0190   if ~isfield(bayes_parm, 'twin_baseline')|isempty(bayes_parm.twin_baseline)
0191     bayes_parm.twin_baseline = [1, MEGinfo.Pretrigger];
0192   end
0193     
0194   % Covariance noise matrix
0195   bayes_parm.noise_model = 3;
0196   % current baseline estimation  with fixed sensor noise
0197   bayes_parm.flag_baseline  = 1;
0198   % sx0 = pretriger noise
0199   bayes_parm.flag_noise_set = 0; % ?? current setting = 1 ??
0200 
0201   % update flag
0202   switch bayes_parm.noise_estimation_model
0203    case    6,
0204     bayes_parm.update_sx = OFF;
0205     bayes_parm.update_v  = ON;
0206    case    7,    
0207     % (NO UPDATE)
0208     bayes_parm.update_sx = OFF; 
0209     bayes_parm.update_v  = OFF;
0210   end
0211  otherwise
0212   error('No such options');
0213 end
0214 
0215 return;

Generated on Tue 27-Aug-2013 11:46:04 by m2html © 2005