I've found that automatic definition of the number of the spectral points isn't works properly in latest EasySpin 6.0.0dev51 version. The Exp.nPoints parameter should be defined else the error of matrices index mismatch occur. Is it a bug either custom simulation function should worry about it?
UPD. A fragment of esfit() source code should parse the Exp.nPoints, really not
% Check or set Exp.nPoints
if isfield(p0{2},'nPoints')
if p0{2}.nPoints~=numel(data)
error('Exp.nPoints is %d, but the data vector has %d elements.',...
p0{2}.nPoints,numel(data));
end
else
p0{2}.nPoints = numel(data);
end
Automatic definition of Exp.nPoints for esfit() function
Automatic definition of Exp.nPoints for esfit() function
-
- EasySpin Creator
- Posts: 1108
- Joined: Mon Jul 21, 2014 10:11 pm
- Location: University of Washington
Re: Automatic definition of Exp.nPoints for esfit() function
Can you please provide an example where this error occurs?
Re: Automatic definition of Exp.nPoints for esfit() function
The problem is kept in dev53 version. It looks like esfit() send Exp structure 'as is' regardless checking of its parameters. Correspondingly, the mismatch on the number of datapoints occur because simulation function sets it to default value.
-
- EasySpin Creator
- Posts: 1108
- Joined: Mon Jul 21, 2014 10:11 pm
- Location: University of Washington
Re: Automatic definition of Exp.nPoints for esfit() function
Can you please provide an example where you experience this problem? As is, esfit
sets Exp.nPoints
to match the number of datapoints, but only if Exp.nPoints
is not already set. If the set value of Exp.nPoints
provided to esfit
doesn't match the number of datapoints, an error is issued.
Re: Automatic definition of Exp.nPoints for esfit() function
My simulation function have a follow code:
if ~isfield(Exp,'nPoints'), Exp.nPoints = 1024; end
If Exp.nPoints is not defined, the follow error is throwed:
Running optimization algorithm with 21 active parameters...
esfit
error:
Experimental data and model have unequal total number of points:
experimental: 12102
model: 1024
It seems that esfit
does not parse Exp.nPoints
parameter however.
-
- EasySpin Creator
- Posts: 1108
- Joined: Mon Jul 21, 2014 10:11 pm
- Location: University of Washington
Re: Automatic definition of Exp.nPoints for esfit() function
esfit
checks and sets Exp.nPoints
only if the simulation function is pepper
, garlic
, chili
or salt
.
Re: Automatic definition of Exp.nPoints for esfit() function
Thanks. Is it able to make it for custom simulation functions? It should be usefull feature.
-
- EasySpin Creator
- Posts: 1108
- Joined: Mon Jul 21, 2014 10:11 pm
- Location: University of Washington
Re: Automatic definition of Exp.nPoints for esfit() function
We are not planning to implement this. EasySpin has no control over custom simulation functions, and Exp.nPoints
might mean something else in a custom function. Also, we don't want to impose any restrictions on fields for custom functions.
Re: Automatic definition of Exp.nPoints for esfit() function
Thanks. You should be right, the custom simulation functions is a topic for advanced EasySpin users. Howewer, I suggest that this functional may be included via additional field for FitOpt
in future releases.
-
- EasySpin Creator
- Posts: 1108
- Joined: Mon Jul 21, 2014 10:11 pm
- Location: University of Washington
Re: Automatic definition of Exp.nPoints for esfit() function
Please post a specific example that has the behavior you are suggesting, so we can consider it.