Home > functions > leadfield > head > vb_util_check_head_shell_info.m

vb_util_check_head_shell_info

PURPOSE ^

check head parameters of basis_parm and set default value

SYNOPSIS ^

function basis_parm = vb_util_check_head_shell_info(proj_root, basis_parm)

DESCRIPTION ^

 check head parameters of basis_parm and set default value
 [usage]
   basis_parm = vb_util_check_head_shell_info(proj_root, basis_parm)
 [input]
    proj_root : <required> project root directory
   basis_parm : <required> target basis_parm
 [output]
   basis_parm : checked basis_parm
 [note]
   checked parameters are as follows:
     1. basis_parm.sigma
     2. basis_parm.radius
     3. basis_parm.radius_method
     4. basis_parm.head_file (if necessary)
 [history]
   2006-12-19 (Sako) initial version
   2007-01-29 (Sako) added proj_root argument
   2007-06-15 (Sako) reformed radius_method ('MEAN','MAX','MIN','USER')

 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:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function basis_parm = vb_util_check_head_shell_info(proj_root, basis_parm)
0002 % check head parameters of basis_parm and set default value
0003 % [usage]
0004 %   basis_parm = vb_util_check_head_shell_info(proj_root, basis_parm)
0005 % [input]
0006 %    proj_root : <required> project root directory
0007 %   basis_parm : <required> target basis_parm
0008 % [output]
0009 %   basis_parm : checked basis_parm
0010 % [note]
0011 %   checked parameters are as follows:
0012 %     1. basis_parm.sigma
0013 %     2. basis_parm.radius
0014 %     3. basis_parm.radius_method
0015 %     4. basis_parm.head_file (if necessary)
0016 % [history]
0017 %   2006-12-19 (Sako) initial version
0018 %   2007-01-29 (Sako) added proj_root argument
0019 %   2007-06-15 (Sako) reformed radius_method ('MEAN','MAX','MIN','USER')
0020 %
0021 % Copyright (C) 2011, ATR All Rights Reserved.
0022 % License : New BSD License(see VBMEG_LICENSE.txt)
0023 
0024 % --- CHECK ARGUMENTS --- %
0025 if ~exist('proj_root', 'var'), proj_root = []; end;
0026 if ~exist('basis_parm', 'var'), basis_parm = []; end;
0027 [proj_root, basis_parm] = inner_check_arguments(proj_root, basis_parm);
0028 
0029 % --- MAIN PROCEDURE --------------------------------------------------------- %
0030 %
0031 func_ = 'vb_util_check_head_shell_info';
0032 
0033 if ~isfield(basis_parm, 'sigma')
0034   % Conductivity  from innermost to outermost
0035   basis_parm.sigma = [ 1.0  0.0125  1.0 ];
0036 end
0037 
0038 if ~isfield(basis_parm, 'radius')
0039   % set basis_parm.radius - Relative radius of sphere - by radius_method
0040   basis_parm.radius = [ 0.87  0.92   1.0 ];
0041 end
0042 
0043 if ~isfield(basis_parm, 'radius_method')
0044   % default
0045   basis_parm.radius_method = 'MEAN';
0046 else
0047   if ~strcmp(basis_parm.radius_method, 'USER') ...
0048       && ~strcmp(basis_parm.radius_method, 'MEAN') ...
0049       && ~strcmp(basis_parm.radius_method, 'MAX') ...
0050       && ~strcmp(basis_parm.radius_method, 'MIN')
0051     warning('(%s)undefined basis_parm.radius_method : %s', ...
0052       func_, basis_parm.radius_method);  
0053   end
0054 end
0055 
0056 if strcmp(basis_parm.radius_method, 'USER')
0057   % 'USER' means that user set radius_method on basis_parm.radius
0058   % So basically, 'radius' should be set.
0059   if ~isfield(basis_parm, 'radius'),
0060   
0061     if isfield(basis_parm, 'head_file')
0062       calc_mode = 1;  % mean
0063       rr = vb_util_calc_head_radius(proj_root, basis_parm.head_file, calc_mode);
0064       basis_parm.radius = rr;
0065     else  % ~isfield(basis_parm, 'head_file')
0066       warning('basis_parm does not have head_file.');
0067     end
0068   else
0069     % if basis_parm.radius has been already set, there is nothing to do
0070   end
0071   
0072 elseif strcmp(basis_parm.radius_method, 'MEAN')
0073   rr = vb_util_calc_head_radius(proj_root, basis_parm.head_file,1);
0074   basis_parm.radius = rr;
0075   
0076 elseif strcmp(basis_parm.radius_method, 'MIN')
0077   rr = vb_util_calc_head_radius(proj_root, basis_parm.head_file,2);
0078   basis_parm.radius = rr;
0079   
0080 elseif strcmp(basis_parm.radius_method, 'MAX')
0081   rr = vb_util_calc_head_radius(proj_root, basis_parm.head_file,3);
0082   basis_parm.radius = rr;
0083 else
0084   error('invalid basis_parm.radius_method : %s', basis_parm.radius_method);
0085 end
0086 
0087 %
0088 % --- recalc
0089 %
0090 if ~isfield(basis_parm, 'Recalc') || isempty(basis_parm.Recalc)
0091   % default
0092   basis_parm.Recalc = false;
0093 end
0094 %
0095 % --- END OF MAIN PROCEDURE -------------------------------------------------- %
0096 
0097 
0098 % --- INNER FUNCTIONS -------------------------------------------------------- %
0099 %
0100 function [proj_root, basis_parm] = inner_check_arguments(proj_root, basis_parm)
0101 if isempty(proj_root), error('proj_root is a required parameter'); end;
0102 if isempty(basis_parm), error('basis_parm is a required parameter'); end;
0103 %
0104 % --- END OF INNER FUNCTIONS ------------------------------------------------- %
0105 
0106 %%% END OF FILE %%%

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