cwEPR App for processing, simulating, and fitting CW EPR data

Programs, scripts and GUIs shared by EasySpin users
ThomasMCasey
User
Posts: 34
Joined: Tue May 26, 2015 1:50 pm

Re: cwEPR App for processing, simulating, and fitting CW EPR data

Post by ThomasMCasey »

@Bruin: Sorry for the delay, I will hold off on officially posting an updated version that is compatible with dev versions on file exchange if it will break the stable version. However, I can post a "dev" version here if I can get it to work. I'm having an issue that may be my error, may be a matlab version issue, or may actually be a bug in the dev esfit UI. I'll see if I can figure it out.

ThomasMCasey
User
Posts: 34
Joined: Tue May 26, 2015 1:50 pm

Re: cwEPR App for processing, simulating, and fitting CW EPR data

Post by ThomasMCasey »

@bruin and anyone else interested, to download a version of cwEPR that works with easyspin-6.0.0-dev.47 go to https://www.mathworks.com/matlabcentral ... 3292-cwepr, click version history above the download button, and download v3.3.6.47

bruin
User
Posts: 23
Joined: Fri May 29, 2020 11:07 am

Re: cwEPR App for processing, simulating, and fitting CW EPR data

Post by bruin »

Dear Thomas,
Thanks for the new version!
And sorry for my late reply.
I meanwhile tested v3.3.6.47. Fitting works now! Thanks!
There is however one remaining problem:
Tools --> get esfit 'fit1'
This doesn't seem to work and gives an error (Unrecognized field name "Sys")
If you have some time, could you please look into this?

bruin
User
Posts: 23
Joined: Fri May 29, 2020 11:07 am

Re: cwEPR App for processing, simulating, and fitting CW EPR data

Post by bruin »

Dear Thomas,

If I'm not mistaken, the solution is easy.

Replacing line 4295
sysstrct=evalin('base','fit1.Sys');
by
sysstrct=evalin('base','fit1.argsfit{1, 1}');
seems to solve the problem:

Could you please check? Thanks a lot!

With best regards,
Bas

ThomasMCasey
User
Posts: 34
Joined: Tue May 26, 2015 1:50 pm

Re: cwEPR App for processing, simulating, and fitting CW EPR data

Post by ThomasMCasey »

bruin, you are correct. Click "View Version History" and select v3.4.6.47: https://www.mathworks.com/matlabcentral ... 3292-cwepr

bruin
User
Posts: 23
Joined: Fri May 29, 2020 11:07 am

Re: cwEPR App for processing, simulating, and fitting CW EPR data

Post by bruin »

Thanks Thomas!

bruin
User
Posts: 23
Joined: Fri May 29, 2020 11:07 am

Re: cwEPR App for processing, simulating, and fitting CW EPR data

Post by bruin »

Dear Thomas,

Unfortunately your cwEPR app no longer works properly with the new stable version 6.0.0 of Easyspin.
Some errors I encountered (so far) are:

  • Rescale minmax does not seem to be supported any more
  • esfit gives the error "Unknown setting for Opt.AutoScale - possible values are 'lsq', 'maxabs', and 'none'."

Could you perhaps have a look? I assume it's a few different keyword settings?
Would be great if you can fix it.
Thanks a lot!

With best regards,
Bas

bruin
User
Posts: 23
Joined: Fri May 29, 2020 11:07 am

Re: cwEPR App for processing, simulating, and fitting CW EPR data

Post by bruin »

Dear Thomas,

I looked closer at the EasySpin changes and the code, and the most important functionality of cwEPR can be relatively easily restored.
It seems that the rescaling problem is caused by the fact that "rescaledata" does not support "minmax, lsq0, lsq1"
The baseline corrections originally included in recaledata are now apparently replaced by "basecorr", but I could not figure out how this can be easily solved in cwEPR. If you can have a look at that, this would be great.


It seems that there is also some problem with passing (some of the) FitOpt options to esfit. This is however not a big problem, as most fitting options can be directly entered in the esfit popup window nowadays. So perhaps FitOpt can (for now at least) be simply deactivated in esfit?

The following changes do seem to solve most problems, but I would prefer if you check things:

replace lines 5788-5793 by:
% Create FitScalingDropDown
app.FitScalingDropDown = uidropdown(app.FitOptTab);
app.FitScalingDropDown.Items = {'none', 'lsq', 'maxabs'};
app.FitScalingDropDown.Position = [82 103 76 22];
app.FitScalingDropDown.Value = ['none' ...
''];
replace lines 5903-5908 by:
% Create RescaleDropDown
app.RescaleDropDown = uidropdown(app.cwEPRapp);
app.RescaleDropDown.Items = {'maxabs', 'lsq', 'none'};
app.RescaleDropDown.ValueChangedFcn = createCallbackFcn(app, @showDatas, true);
app.RescaleDropDown.Position = [1112 14 79 22];
app.RescaleDropDown.Value = 'maxabs';

remove "FitOpt" from all esfit lines
e.g. line 4202 becomes:
esfit(spc(:,app.currslice), @app.custom_fittwomethods, {Sys, Exp, Opt}, {Vary});

similar for the esfit lines 4207, 4239, 4267 and 4272

Thanks for your help!

With best regards,
Bas

bruin
User
Posts: 23
Joined: Fri May 29, 2020 11:07 am

Re: cwEPR App for processing, simulating, and fitting CW EPR data

Post by bruin »

Dear Thomas,

I can't find how to load FitOpt values. I don't understand to code well-enough to fix this.

I noticed another error: The "get esfit 'fit1' button works, but if there are more than 3 HFI's in the "fit1.argsfit{1, 1}.A matrix, the app decides not to load any HFI's anymore and loads another parameter in the A-tensor field instead (e.g. lwpp). I can't figure out what is causing this.

It would be great if you could have a look to see if you can fix these two issue.
Thanks!

With best regards,
Bas

ErnestodeJesus
Newbie
Posts: 1
Joined: Thu May 09, 2024 3:39 am

Re: cwEPR App for processing, simulating, and fitting CW EPR data

Post by ErnestodeJesus »

Dear Thomas,

Regarding the problems that Bas (@bruin) pointed out with the passing of some FitOpt options to esfit, I think they can be solved by changing the following lines of code:

Line 4141:
Replace AutoScale=str2num(get(app.FitScalingDropDown,'Value'))
with FitOpt.AutoScale= get(app.FitScalingDropDown,'Value')

In addition, all occurrences of the FitOpt.PrintLevel variable probably need to be replaced by FitOpt.Verbosity (lines 4206, 4224, and 4271). In this case, also replace 'PrintLevel' by 'Verbosity' in line 247.

These changes make esfit work seamlessly with cwEPR in EasySpin 6.0.0. However, I am not sure that all FitOpt options are effectively passed to esfit.
The options Algorithm, Target (FlipOpt.Method) and Autoscale (FlipOpt.Autoscale) are displayed correctly in the esfit window.
On the other hand, the values of options such as maxTime, Verbosity or delta entered in cwEPR are not correctly reflected in the esfit - Algorithm Settings window. I have checked everything to the best of my knowledge and cwEPR seems to pass the FitOpt structure correctly to esfit. Could this be a bug in esfit?

Best regards,

Post Reply