Hello,
I have a dataset consisting of a couple of major resonances and several much weaker ones which, however, have an important diagnostic value.
The problem is that, I believe, ES focuses in minimising the error function arising from the major peak, and cannot fit the smaller resonances. They simply do not contribute enough to the error function.
I thought of fitting the log-scale spectrum, so that weaker resonances are accentuated and better taken into account.
I am pretty sure ES doesn't have a built-in function to do this, so I though of doing it with a custom function. However, logs of negative numbers are not defined.
To get around this, I thought of integrating the derivative spectrum, taking the log and differentiating, however the differentiation truncates a point and then it gets ugly trying to reassign intermediate field values to the derivative spectrum.
Could anyone suggest a strategy toward this end?
Thanks!
Fit log scale spectrum
Re: Fit log scale spectrum
I think follow code will be better.
I'm afraid however that this will make poor SNR anyway.
Code: Select all
Y=sign(y)*log(abs(y));
Re: Fit log scale spectrum
Thanks, that's a step in the right direction.
Actually, I needed to calculate
Now, I invoke
where
Within that, I invoke
However, I seem to have problems with Easyspin's calculation of the baseline and/or the calculated spectrum (see image), or there is something I am doing wrong.
Actually, I needed to calculate
logspc=sign(spc).*log(abs(spc))
(with .*). The S/N is not problem, the spectrum was very good to begin with, so even the log has no visible noise.Now, I invoke
logspsc
in my esfit call:
Code: Select all
esfit('fit_log',logspc,Sys1,Vary1,Exp,[],FitOpt);
fit_log
is my fitting function.Within that, I invoke
pepper
and then do the same treatment to the output:
Code: Select all
function [x,y] = fit_log(Sys1,Exp,Opt);
fullSys = Sys1;
[x,y] = pepper(fullSys,Exp,Opt);
y=sign(y).*log(abs(y));
Re: Fit log scale spectrum
Yes, it's the second problem. I suggest both exp and sim spectra should not contain values between 0 and 1 (i.e. 0<y<=1). If not, the rescalling before logarithmation is required. I suggest that
UPD. I suggest that root function of odd order (like cubic root) should be more appropriate.
UPD2. The right solution for log scaling should be as follow
sign(y)*log(abs(y))
returns zero for y=0, although it should be checked too.UPD. I suggest that root function of odd order (like cubic root) should be more appropriate.
UPD2. The right solution for log scaling should be as follow
Y=sign(y).*log(1+abs(y))
. This exclude negative log(y) values and log(0) calculations as well.Re: Fit log scale spectrum
Thanks for the updates. I already tried the
However, for the moment, I still get the regular EPR calculated spectrum.
It seems that the
declaration in the custom function does not return the modified result to the main script (see screenshot).
Y=sign(y).*log(1+abs(y))
approach and will also try an odd order polynomial.However, for the moment, I still get the regular EPR calculated spectrum.
It seems that the
Code: Select all
[x,y] = pepper(fullSys,Exp,Opt);
y=sign(y).*log(1+abs(y));
Re: Fit log scale spectrum
I found that I get a nice amplification of the weaker features by a square-root spectrum (i.e.
spc = sign(spc).*power(abs(spc),1/2);
), like below:
Re: Fit log scale spectrum
I suggest to use
Y=nthroot(y,n)
where n is odd number (i.e. n=3,5,7,etc) instead. It works correctly with negative values, it isn't necesssary to use tricks like sign()
and abs()
functions more. Also, required "gain" of weak resonances may be easily adjusted by varying of n.Re: Fit log scale spectrum
Indeed, that came in very handy. The 7th root gives a nice balance between weak ans strong features.
Now the issue is to correct the way the scaling is done. I think that the default algorithm doesn't know of the changes to the fitted curve and cannot properly treat it:
Now the issue is to correct the way the scaling is done. I think that the default algorithm doesn't know of the changes to the fitted curve and cannot properly treat it: