Issues with Levenberg/Marquart, garlic in Version 6.0.0

General forum for EasySpin: questions, how to's, etc.
Post Reply
J_Barz
Newbie
Posts: 1
Joined: Wed Aug 03, 2022 6:20 am

Issues with Levenberg/Marquart, garlic in Version 6.0.0

Post 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.

Stefan Stoll
EasySpin Creator
Posts: 1108
Joined: Mon Jul 21, 2014 10:11 pm
Location: University of Washington

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

Post 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.

MMSIM
Newbie
Posts: 1
Joined: Tue Jul 09, 2024 2:12 am

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

Post 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

DanielKlose
User
Posts: 23
Joined: Thu Jun 09, 2022 5:22 am

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

Post 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!

Post Reply