view m-toolbox/classes/@pest/fromValues.m @ 24:056f8e1e995e database-connection-manager

Properly record history in fromRepository constructors
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

% FROMVALUES construct a pest object from different values.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% FUNCTION:    fromValues
%
% DESCRIPTION: Construct a pest object from different values.
%
% CALL:        pe = fromValues(pe, pli)
%
% PARAMETER:   pe  - empty pest object
%              pli - input plist
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function obj = fromValues(obj, pli)
  
  VERSION = '$Id: fromValues.m,v 1.6 2011/08/16 05:16:32 hewitson Exp $';
  
  % get pzmodel info
  ii = pest.getInfo('pest', 'From Values');
  
  % Set the method version string in the minfo object
  ii.setMversion([VERSION '-->' ii.mversion]);
  
  % Combine input plist with default values
  pl = applyDefaults(ii.plists, pli);
  
  % get values
  obj.y      = pl.find('y');
  obj.names  = pl.mfind('paramNames', 'names', 'params');
  obj.dy     = pl.find('dy');
  obj.cov    = pl.find('cov');
  obj.corr   = pl.find('corr');
  obj.chi2   = pl.find('chi2');
  obj.dof    = pl.find('dof');
  obj.models = pl.find('models');
  obj.pdf    = pl.find('pdf');
  
  % Add history
  obj.addHistory(ii, pl, [], []);
  
  % Set object properties
  obj.setObjectProperties(pl);
  
end