StollLab / EasySpin

MATLAB toolbox for Electron Paramagnetic Resonance (EPR) spectroscopy
http://easyspin.org
MIT License
48 stars 26 forks source link

Discrepency between saffron and pepper spectra #203

Closed spribitzer closed 3 years ago

spribitzer commented 3 years ago

I was notified by Claudia that the FT transform echo simulated with pepper does not match the pepper spectrum for a system with an orthorombic g tensor, and instead appears to have the shape of an axially symmetric g tensor. It appears that this is an issue with the rotatesystem subfunction of saffron.

Here is a MWE:

% Two-pulse echo simulation (saffron) 
%========================================================================== % simulates an echo of a nitroxide using saffron 
% (adapted from EasySpin (version 6) example custom_2p_echo.m) 
clear; clc; 

% Spin system 
Sys.g = [2.009 2.006 2.002]; 
Sys.A = [11 11 95]; % MHz 
Sys.Nucs = '14N'; 
Sys.HStrain = 0.1; % MHz 

Exp.Field = 324.9; % mT 

[v0,spec0] = pepper(Sys,Exp); % use pepper to obtain frequency-sweep spectrum to set pulses 

% Pulse definitions 
P90.tp = 0.002; % mus 
P90.Flip = pi/2; % rad 

P180.tp = 2*P90.tp; % mus 
P180.Flip = pi; % rad 

tau = 0.6; % mus 

Exp.Sequence = {P90 tau P180 tau}; 
Exp.PhaseCycle{1} = [0, 1; pi, -1]; 
Exp.mwFreq = 9.1; % GHz 
Exp.Field = 324.9; % mT 
Exp.DetWindow = [-1 1]*tau; % us 
Exp.DetPhase = pi; % rad, for proper phasing of the signal 

Opt.nKnots = 81; 
[t,y] = saffron(Sys,Exp,Opt); 

% Fourier transform to get spectrum 
win = apowin('ham',numel(y)).'; 
y_apo = y.*win; 
nzf = numel(y); 
y_zf = [zeros(1,nzf) y_apo zeros(1,nzf)]; 
yft = abs(fftshift(fft(y_zf))); 
f = fdaxis(t(2)-t(1),numel(yft)); 

% Plot results 
figure; 
sgtitle(sprintf('Nitroxide spin echo and FT (nKnots = %i): saffron',Opt.nKnots),'FontSize',10) 
subplot(2,1,1) 
plot(t,real(y),t,imag(y)) 
xlabel(['t (',char(181),'s)']) 

subplot(2,1,2) 
hold on; box on; 
plot((v0-Exp.mwFreq)*1e3,spec0/max(spec0),'k') 
plot(f,yft/max(yft)) 
legend('pepper','echo FT') 
xlim([-200 200]) 
xlabel('\nu - \nu_{mw} (MHz)')

image

stestoll commented 3 years ago

Correct, this is a bug in saffron/rotatesystem (a missing transpose on one of the rotation matrices).