view m-toolbox/classes/@miir/fromStandard.m @ 51:9d5c88356247 database-connection-manager

Make unit tests database connection parameters configurable
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 07 Dec 2011 17:24:37 +0100
parents f0afece42f48
children
line wrap: on
line source

% Construct an miir from a standard types
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% FUNCTION:    fromStandard
%
% DESCRIPTION: Construct an miir from a standard types
%
% CALL:        f = fromStandard(f, pli)
%
% PARAMETER:   type:     String with filter type description
%              pli:       Parameter list object
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function f = fromStandard(f, pli)
  
  VERSION = '$Id: fromStandard.m,v 1.16 2011/08/15 11:22:27 hewitson Exp $';
  
  ii = miir.getInfo('miir', 'From Standard Type');
  % Set the method version string in the minfo object
  ii.setMversion([VERSION '-->' ii.mversion]);
  
  % Add default values
  pl = applyDefaults(ii.plists, pli);
  
  % Get parameters
  type = find(pl, 'type');
  
  % check and fill parameter list
  plo = miir.parseFilterParams(pl);
  switch lower(type)
    case {'lowpass', 'low-pass', 'low pass'}
      f = mklowpass(f, plo);
    case {'highpass' 'high-pass', 'high pass'}
      f = mkhighpass(f, plo);
    case {'bandpass', 'band-pass', 'band pass'}
      f = mkbandpass(f, plo);
    case {'bandreject', 'band-reject', 'band reject'}
      f = mkbandreject(f, plo);
    otherwise
      error('### unknown standard filter type in miir constructor.');
  end
  
  if isempty(pl.find('name'))
    pl.pset('name', type);
  end
  
  % Add history
  f.addHistory(ii, pl, [], []);
  
  % Set object properties
  f.setObjectProperties(pl);
  
end % function f = miirFromStandardType(type, pli, version, algoname)