Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate edge effects in resolution convolution in sw_instrument #170

Open
RichardWaiteSTFC opened this issue Mar 18, 2024 · 1 comment

Comments

@RichardWaiteSTFC
Copy link
Collaborator

RichardWaiteSTFC commented Mar 18, 2024

Convolution in sw_instrument seems to produce edge effects (specifically a lower intensity at the edge and a greater than average intensity in the next column/row)

To reproduce:
(1) Run this script

% setup model
FMchain = spinw;
FMchain.genlattice('lat_const',[3 8 8],'angled',[90 90 90],'spgr',0);
FMchain.addatom('r',[0 0 0],'S',1,'label','MCu1','color','blue');
FMchain.gencoupling('maxDistance',7)
FMchain.addmatrix('value', eye(3),'label','Ja','color','green')
FMchain.addcoupling('mat','Ja','bond',1);
FMchain.genmagstr('mode','direct', 'k',[0 0 0],'n',[1 0 0],'S',[0; 1; 0]);
FMspec = FMchain.spinwave({[0 0 0] [1 0 0], 11},'hermit',false); % , 'sortMode', true);

% powder average
modQ = 0:0.1:0.5
FMpowspec = FMchain.powspec(modQ,'Evect',0:0.5:6,'nRand',1e3,'hermit',false);
% set intensities to 1
FMpowspec.swConv(:,:) = 1;

% convolute with dQ
FMpowspec = sw_instrument(FMpowspec,'dQ',0.1, 'Ei', 20, 'thetaMin', 3.5);
modQ
FMpowspec.swConv

prints

modQ =

         0    0.1000    0.2000    0.3000    0.4000    0.5000

FMpowspec.swConv =

       NaN       NaN    1.0000    1.0000    1.0033    0.9967
       NaN       NaN    1.0000    1.0000    1.0033    0.9967
       NaN       NaN       NaN    1.0000    1.0033    0.9967
       NaN       NaN       NaN    1.0000    1.0033    0.9967
       NaN       NaN       NaN    1.0000    1.0033    0.9967
       NaN       NaN       NaN    1.0000    1.0033    0.9967
       NaN       NaN       NaN       NaN    1.0033    0.9967
       NaN       NaN       NaN       NaN    1.0033    0.9967
       NaN       NaN       NaN       NaN    1.0033    0.9967
       NaN       NaN       NaN       NaN       NaN    0.9967
       NaN       NaN       NaN       NaN       NaN    0.9967
       NaN       NaN       NaN       NaN       NaN       NaN
@RichardWaiteSTFC
Copy link
Collaborator Author

One can do this Q-convolution for multiple 1D cuts

modQ = [0:0.1:0.5, 4:0.1:4.5];
FMpowspec = FMchain.powspec(modQ,'Evect',ebin_edge,'nRand',1e3,'hermit',false);
FMpowspec.swConv(:,:) = 1;
FMpowspec = sw_instrument(FMpowspec,'dQ',0.1, 'Ei', 20, 'thetaMin', 3.5);
modQ
FMpowspec.swConv

prints

modQ =

         0    0.1000    0.2000    0.3000    0.4000    0.5000    4.0000    4.1000    4.2000    4.3000    4.4000    4.5000

spec.swConv = 

       NaN       NaN    1.0000    1.0000    1.0033    0.9967    0.9967    1.0033    1.0000    1.0000    1.0033    0.9967
       NaN       NaN    1.0000    1.0000    1.0033    0.9967    0.9967    1.0033    1.0000    1.0000    1.0033    0.9967
       NaN       NaN       NaN    1.0000    1.0033    0.9967    0.9967    1.0033    1.0000    1.0000    1.0033    0.9967
       NaN       NaN       NaN    1.0000    1.0033    0.9967    0.9967    1.0033    1.0000    1.0000    1.0033    0.9967
       NaN       NaN       NaN    1.0000    1.0033    0.9967    0.9967    1.0033    1.0000    1.0000    1.0033    0.9967
       NaN       NaN       NaN    1.0000    1.0033    0.9967    0.9967    1.0033    1.0000    1.0000    1.0033    0.9967
       NaN       NaN       NaN       NaN    1.0033    0.9967    0.9967    1.0033    1.0000    1.0000    1.0033    0.9967
       NaN       NaN       NaN       NaN    1.0033    0.9967    0.9967    1.0033    1.0000    1.0000    1.0033    0.9967
       NaN       NaN       NaN       NaN    1.0033    0.9967    0.9967    1.0033    1.0000    1.0000    1.0033    0.9967
       NaN       NaN       NaN       NaN       NaN    0.9967    0.9967    1.0033    1.0000    1.0000    1.0033    0.9967
       NaN       NaN       NaN       NaN       NaN    0.9967    0.9967    1.0033    1.0000    1.0000    1.0033    0.9967
       NaN       NaN       NaN       NaN       NaN       NaN    0.9967    1.0033    1.0000    1.0000    1.0033    0.9967

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant