fwd_model_device

PURPOSE ^

FMDL_MODEL_DEVICE: set vendor/device specific parameters

SYNOPSIS ^

function fmdl = fmdl_model_device(fmdl,device, opt);

DESCRIPTION ^

 FMDL_MODEL_DEVICE: set vendor/device specific parameters
 fmdl_model_device is a utility function to set vendor and device specific parameters.
 It sets the 'stimulation' and 'normalize_measurements' fields to the vendor-typical values

 Usage:
 fmdl = fmdl_model_device(fmdl,device, opt);
 
 Devices and Options:
  Draeger/Pulmovista:
    - sets adjacent, rotate_meas, and mdl_normalize=true
  Sentec/Swisstom
    - Default: opt.skip = 4; opt.next = 1;
    - sets skip pattern, meas_current_next, and mdl_normalize=false

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function fmdl = fmdl_model_device(fmdl,device, opt);
0002 % FMDL_MODEL_DEVICE: set vendor/device specific parameters
0003 % fmdl_model_device is a utility function to set vendor and device specific parameters.
0004 % It sets the 'stimulation' and 'normalize_measurements' fields to the vendor-typical values
0005 %
0006 % Usage:
0007 % fmdl = fmdl_model_device(fmdl,device, opt);
0008 %
0009 % Devices and Options:
0010 %  Draeger/Pulmovista:
0011 %    - sets adjacent, rotate_meas, and mdl_normalize=true
0012 %  Sentec/Swisstom
0013 %    - Default: opt.skip = 4; opt.next = 1;
0014 %    - sets skip pattern, meas_current_next, and mdl_normalize=false
0015 
0016 % (C) 2024 Andy Adler License: GPL ver 2 or 3
0017 % $Id: fwd_model_device.m 7002 2024-11-24 13:11:35Z aadler $
0018 
0019 if ischar(fmdl) && strcmp(fmdl,'UNIT_TEST'); do_unit_test(); return; end
0020 
0021 if nargin<3; opt=struct(); end
0022 
0023 switch lower(device)
0024   case {'draeger','dräger','pulmovista500'}
0025     fmdl=mdl_normalize(fmdl,true);
0026     mA = 0.01; % Estimate from docs
0027     fmdl.stimulation = mk_stim_patterns(16,1, ...
0028        [0,1],[0,1],{'no_meas_current','rotate_meas'},mA);
0029 
0030   case {'sentec','swisstom'}
0031 
0032     if ~isfield(opt,'skip'); opt.skip = 4; end
0033     if ~isfield(opt,'next'); opt.next = 1; end
0034     fmdl=mdl_normalize(fmdl,false);
0035     mA = 0.01; % Estimate from docs
0036     SS = [0,opt.skip+1];
0037     fmdl.stimulation = mk_stim_patterns(32,1, ...
0038        SS,SS,{sprintf('no_meas_current_next%d',opt.next)},mA);
0039 
0040   otherwise error('No information about device');
0041 end
0042 
0043 function do_unit_test
0044    fmdl = getfield(mk_common_model('a2c2',16), ...
0045                    'fwd_model');
0046    ssmm = stim_meas_list(fmdl.stimulation);
0047    unit_test_cmp('Init',ssmm([8,35],:), [
0048        1  2 11 10; 3  4 13 12]);
0049 
0050    fmdl = fwd_model_device(fmdl,'Draeger');
0051    ssmm = stim_meas_list(fmdl.stimulation);
0052    unit_test_cmp('Draeger',size(ssmm,1),208);
0053    unit_test_cmp('Draeger',ssmm([8,35],:), [
0054        1  2 11 10; 3  4 14 13]);
0055    unit_test_cmp('Draeger',fmdl.normalize_measurements, true);
0056 
0057  
0058    fmdl = getfield(mk_common_model('b2c2',32), ...
0059                    'fwd_model');
0060    fmdl = fwd_model_device(fmdl,'Sentec');
0061    ssmm = stim_meas_list(fmdl.stimulation);
0062    unit_test_cmp('Sentec',size(ssmm,1),736);
0063    unit_test_cmp('Sentec',ssmm([8,35],:), [
0064        1  6 18 13; 2  7 23 18]);
0065    unit_test_cmp('Sentec',fmdl.normalize_measurements, false);
0066 
0067    opt.skip=2;
0068    fmdl = fwd_model_device(fmdl,'Sentec',opt);
0069    ssmm = stim_meas_list(fmdl.stimulation);
0070    unit_test_cmp('Sentec',size(ssmm,1),736);
0071    unit_test_cmp('Sentec',ssmm([8,35],:), [
0072        1  4 16 13; 2  5 21 18]);
0073 
0074    opt.next=2;
0075    fmdl = fwd_model_device(fmdl,'Sentec',opt);
0076    ssmm = stim_meas_list(fmdl.stimulation);
0077    unit_test_cmp('Sentec',size(ssmm,1),672);
0078    unit_test_cmp('Sentec',ssmm([8,35],:), [
0079        1  4 17 14; 2  5 24 21]);

Generated on Sun 29-Dec-2024 11:41:59 by m2html © 2005