Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mantidproject
mantid
Commits
4e6d609b
Commit
4e6d609b
authored
Jan 05, 2021
by
Mathieu Tillet
Browse files
Add tests for D11B and D22B loader
parent
391d3fab
Changes
3
Hide whitespace changes
Inline
Side-by-side
Framework/DataHandling/test/LoadILLSANSTest.h
View file @
4e6d609b
...
...
@@ -99,6 +99,59 @@ public:
checkTimeFormat
(
outputWS
);
}
void
test_D11B
()
{
LoadILLSANS
alg
;
alg
.
setChild
(
true
);
alg
.
initialize
();
TS_ASSERT_THROWS_NOTHING
(
alg
.
setPropertyValue
(
"Filename"
,
"027194.nxs"
))
TS_ASSERT_THROWS_NOTHING
(
alg
.
setPropertyValue
(
"OutputWorkspace"
,
"__unused_for_child"
))
TS_ASSERT_THROWS_NOTHING
(
alg
.
execute
())
TS_ASSERT
(
alg
.
isExecuted
())
MatrixWorkspace_const_sptr
outputWS
=
alg
.
getProperty
(
"OutputWorkspace"
);
TS_ASSERT
(
outputWS
)
TS_ASSERT_EQUALS
(
outputWS
->
getNumberHistograms
(),
192
*
256
+
2
*
32
*
256
+
2
)
TS_ASSERT_EQUALS
(
outputWS
->
blocksize
(),
1
)
TS_ASSERT
(
outputWS
->
detectorInfo
().
isMonitor
(
192
*
256
+
2
*
32
*
256
))
TS_ASSERT
(
outputWS
->
detectorInfo
().
isMonitor
(
192
*
256
+
2
*
32
*
256
+
1
))
TS_ASSERT
(
outputWS
->
isHistogramData
())
TS_ASSERT
(
!
outputWS
->
isDistribution
())
const
auto
&
instrument
=
outputWS
->
getInstrument
();
// TODO SET CORRECT COORDINATES
IComponent_const_sptr
component
=
instrument
->
getComponentByName
(
"detector"
);
V3D
pos
=
component
->
getPos
();
TS_ASSERT_DELTA
(
pos
.
X
(),
0
,
1E-5
)
TS_ASSERT_DELTA
(
pos
.
Y
(),
0
,
1E-5
)
TS_ASSERT_DELTA
(
pos
.
Z
(),
20.007
,
1E-3
)
component
=
instrument
->
getComponentByName
(
"detector_left"
);
pos
=
component
->
getPos
();
TS_ASSERT_DELTA
(
pos
.
X
(),
0
,
1E-5
)
TS_ASSERT_DELTA
(
pos
.
Y
(),
0
,
1E-5
)
TS_ASSERT_DELTA
(
pos
.
Z
(),
0
,
1E-5
)
component
=
instrument
->
getComponentByName
(
"detector_right"
);
pos
=
component
->
getPos
();
TS_ASSERT_DELTA
(
pos
.
X
(),
0
,
1E-5
)
TS_ASSERT_DELTA
(
pos
.
Y
(),
0
,
1E-5
)
TS_ASSERT_DELTA
(
pos
.
Z
(),
0
,
1E-5
)
const
auto
&
xAxis
=
outputWS
->
x
(
0
).
rawData
();
const
auto
&
spec
=
outputWS
->
y
(
3630
).
rawData
();
const
auto
&
err
=
outputWS
->
e
(
3630
).
rawData
();
TS_ASSERT_EQUALS
(
xAxis
.
size
(),
2
)
TS_ASSERT_DELTA
(
xAxis
[
0
],
6.685
,
1E-5
)
TS_ASSERT_DELTA
(
xAxis
[
1
],
7.315
,
1E-5
)
TS_ASSERT_EQUALS
(
spec
[
0
],
246
)
TS_ASSERT_DELTA
(
err
[
0
],
sqrt
(
246
),
1E-5
)
const
auto
unit
=
outputWS
->
getAxis
(
0
)
->
unit
()
->
unitID
();
TS_ASSERT_EQUALS
(
unit
,
"Wavelength"
);
checkTimeFormat
(
outputWS
);
}
void
test_D22
()
{
LoadILLSANS
alg
;
alg
.
setChild
(
true
);
...
...
@@ -135,6 +188,51 @@ public:
checkTimeFormat
(
outputWS
);
}
void
test_d22B
()
{
LoadILLSANS
alg
;
alg
.
setChild
(
true
);
alg
.
initialize
();
TS_ASSERT_THROWS_NOTHING
(
alg
.
setPropertyValue
(
"Filename"
,
"375508.nxs"
))
TS_ASSERT_THROWS_NOTHING
(
alg
.
setPropertyValue
(
"OutputWorkspace"
,
"__unused_for_child"
))
TS_ASSERT_THROWS_NOTHING
(
alg
.
execute
())
TS_ASSERT
(
alg
.
isExecuted
())
MatrixWorkspace_const_sptr
outputWS
=
alg
.
getProperty
(
"OutputWorkspace"
);
TS_ASSERT
(
outputWS
)
TS_ASSERT_EQUALS
(
outputWS
->
getNumberHistograms
(),
128
*
256
+
96
*
256
+
2
)
TS_ASSERT_EQUALS
(
outputWS
->
blocksize
(),
1
)
TS_ASSERT
(
outputWS
->
detectorInfo
().
isMonitor
(
128
*
256
+
96
*
256
))
TS_ASSERT
(
outputWS
->
detectorInfo
().
isMonitor
(
128
*
256
+
96
*
256
+
1
))
TS_ASSERT
(
outputWS
->
isHistogramData
())
TS_ASSERT
(
!
outputWS
->
isDistribution
())
const
auto
&
instrument
=
outputWS
->
getInstrument
();
// TODO SET CORRECT COORDINATES
IComponent_const_sptr
comp
=
instrument
->
getComponentByName
(
"detector"
);
V3D
pos
=
comp
->
getPos
();
TS_ASSERT_DELTA
(
pos
.
X
(),
-
0.35
,
0.01
)
TS_ASSERT_DELTA
(
pos
.
Y
(),
-
0.35
,
0.01
)
TS_ASSERT_DELTA
(
pos
.
Z
(),
8
,
0.01
)
comp
=
instrument
->
getComponentByName
(
"detector_right"
);
pos
=
comp
->
getPos
();
TS_ASSERT_DELTA
(
pos
.
X
(),
0
,
0.01
)
TS_ASSERT_DELTA
(
pos
.
Y
(),
-
0.35
,
0.01
)
TS_ASSERT_DELTA
(
pos
.
Z
(),
0
,
0.01
)
const
auto
&
xAxis
=
outputWS
->
x
(
0
).
rawData
();
const
auto
&
spec
=
outputWS
->
y
(
1280
).
rawData
();
const
auto
&
err
=
outputWS
->
e
(
1280
).
rawData
();
TS_ASSERT_EQUALS
(
xAxis
.
size
(),
2
)
TS_ASSERT_DELTA
(
xAxis
[
0
],
6.65
,
1E-5
)
TS_ASSERT_DELTA
(
xAxis
[
1
],
7.35
,
1E-5
)
TS_ASSERT_EQUALS
(
spec
[
0
],
10
)
TS_ASSERT_DELTA
(
err
[
0
],
sqrt
(
10
),
1E-5
)
const
auto
unit
=
outputWS
->
getAxis
(
0
)
->
unit
()
->
unitID
();
TS_ASSERT_EQUALS
(
unit
,
"Wavelength"
);
checkTimeFormat
(
outputWS
);
}
void
test_D16
()
{
LoadILLSANS
alg
;
alg
.
setChild
(
true
);
...
...
Testing/Data/UnitTest/ILL/D11/027194.nxs.md5
0 → 100644
View file @
4e6d609b
e38f1cd76ab0db5a381434b195c55b67
Testing/Data/UnitTest/ILL/D22/375508.nxs.md5
0 → 100644
View file @
4e6d609b
8a4668039bb895376a804cd30162c8c0
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment