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

Programs, scripts and GUIs shared by EasySpin users
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 ThomasMCasey,

Thanks. You are right. It's not a bug in the app. Directly in EasySpin I have exactly the same behaviour. I first thought it was different, but I forgot to change the exp. number of points, which is on the low side for this spectrum (916 points) and which is apparently causing the issue. Thanks for pointing me in the right direction and sorry for causing confusion.
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 »

No problem!
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,
It seems version 3.0 of cwEPR is not fully compatible with EasySpin 6.00-dev26. Simulations work, but fitting (esfit) gives an error message:

Error using esfit
The simulation function (1st input) must be a
function handle (with @).
Use esfit(@custom_fittwomethods,...) instead of
esfit('custom_fittwomethods',...).

Error in cwEPR/esfit (line 4100)
esfit('custom_fittwomethods',spc(:,app.currslice),Sys,Vary,Exp,Opt,FitOpt)
Error using matlab.ui.control.internal.controller.ComponentController/executeUserCallback (line 335)
Error while evaluating Button PrivateButtonPushedFcn.

Would be great if this could be fixed. Could you have a look at this?

Thanks in advance!

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 »

Hi Bruin, I noticed this and a few other issues yesterday and started updating to make sure it is compatible. I will post here when everything is worked out and v3.1 is published. However, if there are any changes that would make it incompatible with the most recent stable version and I can't find a way to make it work with both at the same time I will prioritize the latest stable version.

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 »

Great! Thanks.
That makes sense.
What I understood is that the calling of function handles with '' has been depracted in esfit in version 6.00, but the accepted calling of function handles (with @) already worked in version 5.2.28. So I hope both version can work.

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 »

Yea that was one issue but this was easy to fix. This is a welcome changes as it will remove the need for the external "helper_functions" as they can now be put into the app itself. The next problem I actually posted in Bugs. In order to simulate a spectrum that is a convolution of multiple individual spectra that use different functions you need Opt.Method for garlic or pepper and Opt. LiouvMethod for chili. v5 ignored Method as long as LiouvMethod was there, v6 errors on calling chili if both are there.

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 »

Not sure I understand what you mean. I noticed that for testing purposes I could change the code myself in matlab. So I changed all esfit calls to @ type helper functions where appropriate. The app seems to work fine with EasySpin 6.00 now. I tried a simulation (and rough esfit) with Sys1: function=peper, method= matrix and Sys2: function = chili, method= general. That did not seem to lead to problems.
How can I reproduce the problem you mentioned in your (slightly modified) cwEPR 3.0 app?

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 »

I can reproduce the behavior by altering the example slow_fast.m to have Opt.Method and Opt.LiouvMethod before the simulation functions are called. Make sure to also add ...,Opt) to both function args. v6 errors for me, v5 does not. For the GUI, 1) it only happens if using chili for Sys2 and garlic or pepper are in Sys1, not the other way around 2) make sure the switches are on for both Sys1 and Sys2 so it is using both.

So I guess a workaround for v6 is to have the chili call in the last of the Sys# you define, if using multiple Sys.

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! I hope it will be fixed in a new update of EasySpin v6. For now that is a good work around.
I've been using cwEP quite a lot lately. Your GUI is truly very useful and user friendly!

One minor request:
Sometimes for very broad spectra of high spin systems close to (or overlapping with) the edges of the magnetic field at 0 or 600 mT I get sharp and high spikes in the simulation window, which are not present in esfit. It seems to be a ploting issue of the simulated spectrum in the GUI. Could you have a look at that please? Not a huge issue, but it can make manual simulations a bit complicated for some spectra. If it can be fixed in one of the next updates, that would be great!

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 »

Thanks bruin! I'm glad you find it useful. I made a few minor changes that should take care of the v6 related problems, and also added some new parameters/options that are part of v6. I will make a general post here when I update it on mathworks file exchange.

Can you 'Save Parameters' under the Tools tab and attach the .mat for the simulation that gives the spikes?

Post Reply