forked from tsdev/spinw
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
32cb8b7
commit 99adabc
Showing
2 changed files
with
70 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,66 @@ | ||
classdef unittest_spinw_spec2MDHisto < sw_tests.unit_tests.unittest_super | ||
properties | ||
|
||
properties(TestParameter) | ||
nsteps={100}; | ||
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'); | ||
spec = sw_egrid(spinwave(sw_model('triAF', 1), {q0 q0+qdir testCase.nsteps{1}})); | ||
proj = [qdir(:) [0 1 0]' [0 0 1]']; | ||
dproj = [norm((qdir-q0))/testCase.nsteps{1}, 1e-6, 1e-6]; | ||
sw_spec2MDHisto(spec, proj, dproj, 'tmp/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})); | ||
spec = sw_egrid(spinwave(sw_model('triAF', 1), {q0 q0+qdir testCase.nsteps{1}})); | ||
proj = [qdir(:) [1 -1 0]' [0 0 1]']; | ||
dproj = [norm((qdir-q0))/nsteps, 1e-6, 1e-6]; | ||
sw_spec2MDHisto(spec, proj, dproj, 'test110mdh.nxs'); | ||
dproj = [norm((qdir-q0))/testCase.nsteps{1}, 1e-6, 1e-6]; | ||
sw_spec2MDHisto(spec, proj, dproj, 'tmp/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})); | ||
spec = sw_egrid(spinwave(sw_model('triAF', 1), {q0 q0+qdir testCase.nsteps{1}})); | ||
proj = [qdir(:) [1 -1 0]' [1 1 -2]']; | ||
dproj = [norm((qdir-q0))/nsteps, 1e-6, 1e-6]; | ||
sw_spec2MDHisto(spec, proj, dproj, 'test111mdh.nxs'); | ||
dproj = [norm((qdir-q0))/testCase.nsteps{1}, 1e-6, 1e-6]; | ||
sw_spec2MDHisto(spec, proj, dproj, 'tmp/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})); | ||
spec = sw_egrid(spinwave(sw_model('triAF', 1), {q0 q0+qdir testCase.nsteps{1}})); | ||
proj = [qdir(:) [1 -1 0]' [0 0 1]']; | ||
dproj = [norm((qdir-q0))/nsteps, 1e-6, 1e-6]; | ||
dproj = [norm((qdir-q0))/testCase.nsteps{1}, 1e-6, 1e-6]; | ||
sw_spec2MDHisto(spec, proj, dproj, 'tmp/test112mdh.nxs'); | ||
end | ||
end | ||
function test_1_1_2_2(testCase) | ||
q0 = [0 0 2]; | ||
qdir = [1 1 0]; | ||
spec = sw_egrid(spinwave(sw_model('triAF', 1), {q0 q0+qdir testCase.nsteps{1}})); | ||
proj = [[1 -1 0]' qdir(:) [0 0 1]']; | ||
dproj = [1e-6, norm((qdir-q0))/testCase.nsteps{1}, 1e-6]; | ||
sw_spec2MDHisto(spec, proj, dproj, 'tmp/test112_2mdh.nxs'); | ||
end | ||
function test_2_2_2(testCase) | ||
q0 = [2 2 2]; | ||
qdir = [1 1 0]; | ||
spec = sw_egrid(spinwave(sw_model('triAF', 1), {q0 q0+qdir testCase.nsteps{1}})); | ||
proj = [qdir(:) [1 -1 0]' [0 0 1]']; | ||
dproj = [norm((qdir-q0))/testCase.nsteps{1}, 1e-6, 1e-6]; | ||
sw_spec2MDHisto(spec, proj, dproj, 'tmp/test222mdh.nxs'); | ||
end | ||
function test_non_ortho(testCase) | ||
q0 = [0 0 2]; | ||
qdir = [1 1 0]; | ||
spec = sw_egrid(spinwave(sw_model('triAF', 1), {q0 q0+qdir testCase.nsteps{1}})); | ||
proj = [qdir(:) [1 0 0]' [0 0 1]']; | ||
dproj = [1e-6, norm((qdir-q0))/testCase.nsteps{1}, 1e-6]; | ||
verifyError(testCase,@() sw_spec2MDHisto(spec, proj, dproj, 'tmp/test_blank.nxs'), "read_struct:nonorthogonal") | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters