Page 1 of 1

Issues with Levenberg/Marquart, garlic in Version 6.0.0

Posted: Fri Apr 26, 2024 8:16 am
by J_Barz

Hi,
first a report of a small mistake in the manual: https://easyspin.org/easyspin/documenta ... tting.html states that for a hybrid fit, you call the arguments from the first stage via fit1.afit. Its fit1.argsfit{}{} where at least I find my data, afit is not created. That was easy to figure out.

But now I'm stuck, hybrid, non hybrid / single stage, when I carry out the following commands which I had been running for tons of spectra in 5.2.35:

Taken from 5.2.35:

Code: Select all

FitOpt.TolFun = 1e-3;          % termination tolerance for error change
FitOpt.TolStep = 1e-4;         % termination tolerance for parameter step, Levenberg/Marquardt
FitOpt.TolEdgeLength = 1e-3;   % termination tolerance for parameter step, simplex
FitOpt.nIter = 500;
FitOpt.maxTime = 3;     % maximum time, in minutes
FitOpt.maxGenerations = 40; % Generations
FitOpt.AutoScale = 'none';
FitOpt.Method = 'levmar int';

Updated for 6.0.0:

Code: Select all

fit2 = esfit(spcs,@garlic,{DMPO_SYS(2,:), Exp}, {DMPO_VARY}, FitOpt);

It gives me as a reply:

-- esfit ------------------------------------------------
Number of datasets: 1
Data set 1: 3999 points
Model function name: garlic
Number of fit parameters: 5
Minimization algorithm: Levenberg-Marquardt
Residuals computed from: integral
Autoscaling: none

Running optimization algorithm with 5 active parameters...
iteration 1: value 7.00478e+04 gradient 3.28912e+11 step 4.41756e-03
Terminated: Parameter step below threshold of 0.0001

Calculating parameter uncertainties...
Estimating Jacobian...
** Spectrum exceeds sweep range. Artifacts at lower limit possible.
Calculating parameter covariance matrix...
Calculating parameter correlation matrix...

Parameters:
name value standard deviation 95% confidence interval
1 arg1{1}.g 2.006100 7.963657e-05 ( 0.004 %) 2.005944 - 2.006256
2 arg1{1}.A(1,1) 41.75718 0.3530521 ( 0.845 %) 41.06521 - 42.44915
3 arg1{1}.A(1,2) 41.64452 0.5221534 ( 1.254 %) 40.62112 - 42.66792
4 arg1{1}.lw 0.5000000 0.01965603 ( 3.931 %) 0.4614749 - 0.5385251
5 arg1{1}.weight 1.000000 0.03569025 ( 3.569 %) 0.9300484 - 1.069952

Correlation matrix:
1.000000 -0.754405 -0.063909 0.000356 -0.001203
-0.754405 1.000000 0.048562 0.003965 -0.001474
-0.063909 0.048562 1.000000 0.006611 -0.000486
0.000356 0.003965 0.006611 1.000000 -0.165580
-0.001203 -0.001474 -0.000486 -0.165580 1.000000

Strongest correlations:
p(1)-p(2): -0.754405
p(4)-p(5): -0.16558
p(1)-p(3): -0.0639089
p(2)-p(3): 0.0485616
p(3)-p(4): 0.0066107

Goodness of fit:
ssr 229038
rmsd 7.56794
noise std 7.56889 (estimated from residuals; assumes excellent fit)
noise der 0.000206445 (estimated using der_snr algorithm)
red chi-square 1.34383e+09 (using noise der estimate)

Error using garlic

No broadening given. Cannot compute spectrum with Exp.Harmonic=1.


Error in compisoloop

Error in garlic

It is not working with genetic either. I call genetic as

Code: Select all

FitOpt.Method = 'genetic fcn';

Same issue. It's actually only DMPO-OH being fitted, spectrum fully contained in the spectral range, had all been working in 5.2.35. Any ideas on what I'm doing wrong? In general, garlic doesn't seem to read the current linewidth from the fit result in my case.


Re: Issues with Levenberg/Marquart, garlic in Version 6.0.0

Posted: Thu May 02, 2024 11:00 pm
by Stefan Stoll

Thanks for reporting the error in the fitting userguide!

Regarding the issue with garlic and esfit, please post your spin system variable DMPO_SYS and DMPO_VARY.


Re: Issues with Levenberg/Marquart, garlic in Version 6.0.0

Posted: Tue Jul 09, 2024 2:15 am
by MMSIM

Hello,
similar problem:
used in previous version:

SimOpt.Method = 'exact';

% Calling the fitting function
FitOpt.Method = 'simplex fcn';
esfit('garlic',spc,{Sys2},{Vary2},Exp,SimOpt,FitOpt);

is not working now: errror sign:
Error in DMPOOH_spektrum_simulacia (line 77)
esfit('garlic',spc,{Sys2},{Vary2},Exp,SimOpt,FitOpt);

any reccomendation how to fix it? thanks


Re: Issues with Levenberg/Marquart, garlic in Version 6.0.0

Posted: Mon Jul 15, 2024 10:50 pm
by DanielKlose

Hello MMSIM,

your call to esfit corresponds to EasySpin version 5.x.
In the new version EasySpin 6.x this has been updated to include more flexibility.
Please see the documentation of esfit or the post above, you'll see a different arrangement of the arguments.
Best wishes!