Skip to content

Commit

Permalink
add a prototype test script
Browse files Browse the repository at this point in the history
  • Loading branch information
granrothge committed Sep 6, 2023
1 parent a586024 commit 32cb8b7
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions +sw_tests/+unit_tests/unittest_spinw_spec2MDHisto.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
classdef unittest_spinw_spec2MDHisto < sw_tests.unit_tests.unittest_super
properties
end
methods (Test)
function test_1_0_0(testCase)
q0 = [0 0 0];
qdir = [1 0 0];
spec = sw_egrid(spinwave(sw_model('triAF', 1), {q0 q0+qdir nsteps}));
proj = [qdir(:) [1 -1 0]' [0 0 1]'];
dproj = [norm((qdir-q0))/nsteps, 1e-6, 1e-6];
sw_spec2MDHisto(spec, proj, dproj, 'test100mdh.nxs');
end

function test_1_1_0(testCase)
q0 = [0 0 0];
qdir = [1 1 0];
spec = sw_egrid(spinwave(sw_model('triAF', 1), {q0 q0+qdir nsteps}));
proj = [qdir(:) [1 -1 0]' [0 0 1]'];
dproj = [norm((qdir-q0))/nsteps, 1e-6, 1e-6];
sw_spec2MDHisto(spec, proj, dproj, 'test110mdh.nxs');
end

function test_1_1_1(testCase)
q0 = [0 0 0];
qdir = [1 1 1];
spec = sw_egrid(spinwave(sw_model('triAF', 1), {q0 q0+qdir nsteps}));
proj = [qdir(:) [1 -1 0]' [1 1 -2]'];
dproj = [norm((qdir-q0))/nsteps, 1e-6, 1e-6];
sw_spec2MDHisto(spec, proj, dproj, 'test111mdh.nxs');
end
function test_1_1_2(testCase)
q0 = [0 0 2];
qdir = [1 1 0];
spec = sw_egrid(spinwave(sw_model('triAF', 1), {q0 q0+qdir nsteps}));
proj = [qdir(:) [1 -1 0]' [0 0 1]'];
dproj = [norm((qdir-q0))/nsteps, 1e-6, 1e-6];
sw_spec2MDHisto(spec, proj, dproj, 'tmp/test112mdh.nxs');
end
end

0 comments on commit 32cb8b7

Please sign in to comment.