Home > vbmeg > 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 if nargin == 1
0057     proj_root = [];
0058 end
0059 
0060 %% --- Global window
0061 if ~isfield(bayes_parm,'basisfile_global') ...
0062       | isempty(bayes_parm.basisfile_global)
0063   bayes_parm.basisfile_global = bayes_parm.basisfile;
0064 end
0065 
0066 switch    bayes_parm.forward_model 
0067  case    'focal+global'
0068   if ~isfield(bayes_parm,'area_key_global') ...
0069         | isempty(bayes_parm.area_key_global)
0070     bayes_parm.area_key_global = ['Cortex'];
0071   end
0072   if ~isfield(bayes_parm,'Rfilt_global') ...
0073         | isempty(bayes_parm.Rfilt_global)
0074     bayes_parm.Rfilt_global    = 0;
0075   end
0076  case    'focal'
0077   bayes_parm.area_key_global = bayes_parm.area_key;
0078   bayes_parm.Rfilt_global    = bayes_parm.Rfilt;
0079 end
0080 
0081 %% --- Soft normal constraint
0082 if bayes_parm.soft_mode == 1,
0083   bayes_parm.variance_orientation = ON;  
0084 else
0085   bayes_parm.variance_orientation = OFF;  
0086 end
0087 
0088 %% --- Noise_estimation_model
0089 switch bayes_parm.noise_estimation_model
0090 case {1,2},
0091  % 'COVARIANCE NOISE'
0092  % Mainly used in focal model
0093     
0094  %bayes_parm.megnoisefile = [bayes_parm.megfile];
0095  %bayes_parm.megfile_baseline = [bayes_parm.megfile];
0096  MEGinfo = vb_load_meg_info(fullfile(proj_root, bayes_parm.megfile{1}));
0097     
0098  % Noise estimation time window
0099  if ~isfield(bayes_parm, 'twin_noise')|isempty(bayes_parm.twin_noise)
0100    bayes_parm.twin_noise  = [1, MEGinfo.Pretrigger];
0101  end
0102  % Baseline activity estimation time window
0103  %if ~isfield(bayes_parm, 'twin_global')|isempty(bayes_parm.twin_global)
0104  %    bayes_parm.twin_global = [1, MEGinfo.Pretrigger];
0105  %end
0106  if ~isfield(bayes_parm, 'twin_baseline')|isempty(bayes_parm.twin_baseline)
0107    bayes_parm.twin_baseline = [1, MEGinfo.Pretrigger];
0108  end
0109 
0110  % Covariance noise matrix
0111  bayes_parm.noise_model = 3;
0112  % current baseline estimation together with sensor noise estimation
0113  bayes_parm.flag_baseline  = 0;
0114  % sx0 = pretriger noise
0115  bayes_parm.flag_noise_set = 0;
0116 
0117  % update flag
0118  switch bayes_parm.noise_estimation_model
0119   case    1
0120    bayes_parm.update_sx = ON;
0121    bayes_parm.update_v  = OFF;
0122   case    2
0123    % (NO UPDATE)
0124    bayes_parm.update_sx = OFF; 
0125    bayes_parm.update_v  = OFF;
0126  end
0127  case {3,4,5},
0128   % 'ISOTROPIC NOISE'
0129   % Mainly used in focal+global model
0130     
0131   %bayes_parm.megnoisefile = [bayes_parm.megfile];
0132   %bayes_parm.megfile_baseline = [bayes_parm.megfile];
0133   MEGinfo = vb_load_meg_info(fullfile(proj_root, bayes_parm.megfile{1}));
0134   % Noise estimation time window
0135   if ~isfield(bayes_parm, 'twin_noise')|isempty(bayes_parm.twin_noise)
0136     bayes_parm.twin_noise  = [1, MEGinfo.Pretrigger];
0137   end
0138   % Baseline activity estimation time window
0139   %if ~isfield(bayes_parm, 'twin_global')|isempty(bayes_parm.twin_global)
0140   %    bayes_parm.twin_global = [1, MEGinfo.Pretrigger];
0141   %end
0142   if ~isfield(bayes_parm, 'twin_baseline')|isempty(bayes_parm.twin_baseline)
0143     bayes_parm.twin_baseline = [1, MEGinfo.Pretrigger];
0144   end
0145 
0146   % Identity noise matrix
0147   bayes_parm.noise_model = 1;
0148   % current baseline estimation together with sensor noise estimation
0149   bayes_parm.flag_baseline  = 0;
0150   % sx0 = estimated noise with current baseline
0151   bayes_parm.flag_noise_set = 1; 
0152     
0153   % update flag
0154   switch bayes_parm.noise_estimation_model
0155    case    3
0156     bayes_parm.update_sx = ON;
0157     bayes_parm.update_v  = ON;
0158    case    4
0159     % (NO GLOBAL UPDATE)
0160     bayes_parm.update_sx = ON;
0161     bayes_parm.update_v  = OFF;
0162    case    5
0163     % (NO UPDATE)
0164     bayes_parm.update_sx = OFF; 
0165     bayes_parm.update_v  = OFF;
0166   end
0167  case {6,7},    
0168   % 'FIXED NOISE'
0169   % Only for focal+global model
0170     
0171   %if ~isfield(bayes_parm,'megnoisefile') ...
0172   %   | isempty(bayes_parm.megnoisefile),
0173   %  error('Please specify the file for observation noise specification');
0174   %end
0175   if ~isfield(bayes_parm,'megfile_baseline') ...
0176         | isempty(bayes_parm.megfile_baseline),
0177     error('Please specify the file for observation noise specification');
0178   end
0179   if bayes_parm.forward_model ~= 'focal+global',
0180     error('forward_model should be focal+global in SUPPLY NOISE FILE');
0181   end
0182 
0183   % Noise estimation time window
0184   %MEGinfo = vb_load_meg_info([proj_root filesep bayes_parm.megnoisefile{1}]);
0185   MEGinfo = vb_load_meg_info(fullfile(proj_root, bayes_parm.megfile_baseline{1}));
0186   if ~isfield(bayes_parm, 'twin_noise')|isempty(bayes_parm.twin_noise)
0187     bayes_parm.twin_noise = [1, MEGinfo.Nsample];
0188   end
0189   % Baseline activity estimation time window
0190   MEGinfo = vb_load_meg_info(fullfile(proj_root, bayes_parm.megfile{1}));
0191   %if ~isfield(bayes_parm, 'twin_global')|isempty(bayes_parm.twin_global)
0192   %    bayes_parm.twin_global = [1, MEGinfo.Pretrigger];
0193   %end
0194   if ~isfield(bayes_parm, 'twin_baseline')|isempty(bayes_parm.twin_baseline)
0195     bayes_parm.twin_baseline = [1, MEGinfo.Pretrigger];
0196   end
0197     
0198   % Covariance noise matrix
0199   bayes_parm.noise_model = 3;
0200   % current baseline estimation  with fixed sensor noise
0201   bayes_parm.flag_baseline  = 1;
0202   % sx0 = pretriger noise
0203   bayes_parm.flag_noise_set = 0; % ?? current setting = 1 ??
0204 
0205   % update flag
0206   switch bayes_parm.noise_estimation_model
0207    case    6,
0208     bayes_parm.update_sx = OFF;
0209     bayes_parm.update_v  = ON;
0210    case    7,    
0211     % (NO UPDATE)
0212     bayes_parm.update_sx = OFF; 
0213     bayes_parm.update_v  = OFF;
0214   end
0215  otherwise
0216   error('No such options');
0217 end
0218 
0219 return;

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005