Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mantid
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mantidproject
mantid
Commits
6153f692
Commit
6153f692
authored
6 years ago
by
Sam Jenkins
Browse files
Options
Downloads
Patches
Plain Diff
Re #24512 began updating tests to use new enginX layout
parent
36ff5836
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Testing/SystemTests/tests/analysis/EnginXScriptTest.py
+91
-98
91 additions, 98 deletions
Testing/SystemTests/tests/analysis/EnginXScriptTest.py
scripts/Engineering/EnginX.py
+3
-3
3 additions, 3 deletions
scripts/Engineering/EnginX.py
with
94 additions
and
101 deletions
Testing/SystemTests/tests/analysis/EnginXScriptTest.py
+
91
−
98
View file @
6153f692
...
...
@@ -11,7 +11,7 @@ import systemtesting
import
shutil
import
mantid.simpleapi
as
simple
from
mantid
import
config
from
Engineering.EnginX
import
Eng
in
X
from
Engineering.EnginX
import
ma
in
DIRS
=
config
[
'
datasearch.directories
'
].
split
(
'
;
'
)
...
...
@@ -24,9 +24,7 @@ class CreateVanadiumTest(systemtesting.MantidSystemTest):
def
runTest
(
self
):
os
.
makedirs
(
cal_directory
)
test
=
EnginX
(
user
=
"
test
"
,
vanadium_run
=
"
236516
"
,
directory
=
cal_directory
)
test
.
create_vanadium
()
main
(
vanadium_run
=
"
236516
"
,
user
=
"
test
"
,
focus_run
=
None
,
force_vanadium
=
True
)
def
validate
(
self
):
return
"
eng_vanadium_integration
"
,
"
engggui_vanadium_integration.nxs
"
...
...
@@ -40,10 +38,7 @@ class CreateCalibrationWholeTest(systemtesting.MantidSystemTest):
def
runTest
(
self
):
os
.
makedirs
(
cal_directory
)
test
=
EnginX
(
user
=
"
test
"
,
vanadium_run
=
"
236516
"
,
directory
=
cal_directory
)
test
.
create_vanadium
()
test
.
create_calibration
()
main
(
vanadium_run
=
"
236516
"
,
user
=
"
test
"
,
focus_run
=
None
,
do_cal
=
True
,
directory
=
cal_directory
)
def
validate
(
self
):
return
(
"
engg_calibration_bank_1
"
,
"
engggui_calibration_bank_1.nxs
"
,
...
...
@@ -59,10 +54,8 @@ class CreateCalibrationCroppedTest(systemtesting.MantidSystemTest):
def
runTest
(
self
):
os
.
makedirs
(
cal_directory
)
test
=
EnginX
(
user
=
"
test
"
,
vanadium_run
=
"
236516
"
,
directory
=
cal_directory
)
test
.
create_vanadium
()
test
.
create_calibration
(
cropped
=
"
spectra
"
,
spectra
=
"
1-20
"
)
main
(
vanadium_run
=
"
236516
"
,
user
=
"
test
"
,
focus_run
=
None
,
do_cal
=
True
,
directory
=
cal_directory
,
crop_type
=
"
spectra
"
,
crop_on
=
"
1-20
"
)
def
validate
(
self
):
return
(
"
cropped
"
,
"
engggui_calibration_bank_cropped.nxs
"
,
...
...
@@ -73,84 +66,84 @@ class CreateCalibrationCroppedTest(systemtesting.MantidSystemTest):
_try_delete
(
cal_directory
)
class
CreateCalibrationBankTest
(
systemtesting
.
MantidSystemTest
):
def
runTest
(
self
):
os
.
makedirs
(
cal_directory
)
test
=
EnginX
(
user
=
"
test
"
,
vanadium_run
=
"
236516
"
,
directory
=
cal_directory
)
test
.
create_vanadium
()
test
.
create_calibration
(
cropped
=
"
banks
"
,
bank
=
"
South
"
)
def
validate
(
self
):
return
(
"
engg_calibration_bank_2
"
,
"
engggui_calibration_bank_2.nxs
"
,
"
engg_calibration_banks_parameters
"
,
"
engggui_calibration_bank_south_parameters.nxs
"
)
def
cleanup
(
self
):
simple
.
mtd
.
clear
()
_try_delete
(
cal_directory
)
class
FocusBothBanks
(
systemtesting
.
MantidSystemTest
):
def
runTest
(
self
):
_setup_focus
()
test
=
EnginX
(
user
=
"
test
"
,
vanadium_run
=
"
236516
"
,
directory
=
focus_directory
)
test
.
focus
(
run_number
=
"
299080
"
)
def
validate
(
self
):
return
(
"
engg_focus_output_bank_1
"
,
"
enggui_focusing_output_ws_bank_1.nxs
"
,
"
engg_focus_output_bank_2
"
,
"
enggui_focusing_output_ws_bank_2.nxs
"
)
def
cleanup
(
self
):
simple
.
mtd
.
clear
()
_try_delete
(
focus_directory
)
class
FocusCropped
(
systemtesting
.
MantidSystemTest
):
def
runTest
(
self
):
_setup_focus
()
test
=
EnginX
(
user
=
"
test
"
,
vanadium_run
=
"
236516
"
,
directory
=
focus_directory
)
test
.
focus
(
run_number
=
"
299080
"
,
cropped
=
"
spectra
"
,
spectra
=
"
1-20
"
)
def
validate
(
self
):
return
"
engg_focus_output
"
,
"
enggui_focusing_output_ws_bank_cropped.nxs
"
def
cleanup
(
self
):
simple
.
mtd
.
clear
()
_try_delete
(
focus_directory
)
class
FocusTextureMode
(
systemtesting
.
MantidSystemTest
):
def
runTest
(
self
):
_setup_focus
()
csv_file
=
os
.
path
.
join
(
root_directory
,
"
EnginX.csv
"
)
location
=
os
.
path
.
join
(
focus_directory
,
"
User
"
,
"
test
"
,
"
Calibration
"
)
shutil
.
copy2
(
csv_file
,
location
)
csv_file
=
os
.
path
.
join
(
location
,
"
EnginX.csv
"
)
test
=
EnginX
(
user
=
"
test
"
,
vanadium_run
=
"
236516
"
,
directory
=
focus_directory
)
test
.
focus
(
run_number
=
"
299080
"
,
grouping_file
=
csv_file
)
output
=
"
engg_focusing_output_ws_texture_bank_{}{}
"
group
=
""
for
i
in
range
(
1
,
11
):
group
=
group
+
output
.
format
(
i
,
"
,
"
)
simple
.
GroupWorkspaces
(
InputWorkspaces
=
group
,
OutputWorkspace
=
"
test
"
)
def
validate
(
self
):
outputlist
=
[
"
engg_focusing_output_ws_texture_bank_{}
"
.
format
(
i
)
for
i
in
range
(
1
,
11
)]
filelist
=
[
"
enggui_texture_Bank_{}.nxs
"
.
format
(
i
)
for
i
in
range
(
1
,
11
)]
validation_list
=
[
x
for
t
in
zip
(
*
[
outputlist
,
filelist
])
for
x
in
t
]
return
validation_list
def
cleanup
(
self
):
simple
.
mtd
.
clear
()
_try_delete
(
focus_directory
)
#
class CreateCalibrationBankTest(systemtesting.MantidSystemTest):
#
#
def runTest(self):
#
os.makedirs(cal_directory)
#
test = EnginX(user="test", vanadium_run="236516",
#
directory=cal_directory)
#
test.create_vanadium()
#
test.create_calibration(cropped="banks", bank="South")
#
#
def validate(self):
#
return ("engg_calibration_bank_2", "engggui_calibration_bank_2.nxs",
#
"engg_calibration_banks_parameters", "engggui_calibration_bank_south_parameters.nxs")
#
#
def cleanup(self):
#
simple.mtd.clear()
#
_try_delete(cal_directory)
#
#
#
class FocusBothBanks(systemtesting.MantidSystemTest):
#
#
def runTest(self):
#
_setup_focus()
#
test = EnginX(user="test", vanadium_run="236516",
#
directory=focus_directory)
#
test.focus(run_number="299080")
#
#
def validate(self):
#
return("engg_focus_output_bank_1", "enggui_focusing_output_ws_bank_1.nxs",
#
"engg_focus_output_bank_2", "enggui_focusing_output_ws_bank_2.nxs")
#
#
def cleanup(self):
#
simple.mtd.clear()
#
_try_delete(focus_directory)
#
#
#
class FocusCropped(systemtesting.MantidSystemTest):
#
#
def runTest(self):
#
_setup_focus()
#
test = EnginX(user="test", vanadium_run="236516",
#
directory=focus_directory)
#
test.focus(run_number="299080", cropped="spectra", spectra="1-20")
#
#
def validate(self):
#
return "engg_focus_output", "enggui_focusing_output_ws_bank_cropped.nxs"
#
#
def cleanup(self):
#
simple.mtd.clear()
#
_try_delete(focus_directory)
#
#
#
class FocusTextureMode(systemtesting.MantidSystemTest):
#
#
def runTest(self):
#
_setup_focus()
#
csv_file = os.path.join(root_directory, "EnginX.csv")
#
location = os.path.join(focus_directory, "User", "test", "Calibration")
#
shutil.copy2(csv_file, location)
#
csv_file = os.path.join(location, "EnginX.csv")
#
test = EnginX(user="test", vanadium_run="236516",
#
directory=focus_directory)
#
test.focus(run_number="299080", grouping_file=csv_file)
#
output = "engg_focusing_output_ws_texture_bank_{}{}"
#
group = ""
#
#
for i in range(1, 11):
#
group = group+output.format(i, ",")
#
simple.GroupWorkspaces(InputWorkspaces=group, OutputWorkspace="test")
#
#
def validate(self):
#
outputlist=["engg_focusing_output_ws_texture_bank_{}".format(i) for i in range(1, 11)]
#
filelist=["enggui_texture_Bank_{}.nxs".format(i) for i in range(1, 11)]
#
validation_list = [x for t in zip(*[outputlist, filelist])for x in t]
#
return validation_list
#
#
def cleanup(self):
#
simple.mtd.clear()
#
_try_delete(focus_directory)
def
_try_delete
(
path
):
...
...
@@ -164,11 +157,11 @@ def _try_delete(path):
print
(
"
Could not delete output file at:
"
,
path
)
def
_setup_focus
():
os
.
makedirs
(
focus_directory
)
test
=
EnginX
(
user
=
"
test
"
,
vanadium_run
=
"
236516
"
,
directory
=
focus_directory
)
test
.
create_vanadium
()
test
.
create_calibration
()
test
.
create_calibration
(
cropped
=
"
spectra
"
,
spectra
=
"
1-20
"
)
simple
.
mtd
.
clear
()
#
def _setup_focus():
#
os.makedirs(focus_directory)
#
test = EnginX(user="test", vanadium_run="236516",
#
directory=focus_directory)
#
test.create_vanadium()
#
test.create_calibration()
#
test.create_calibration(cropped="spectra", spectra="1-20")
#
simple.mtd.clear()
This diff is collapsed.
Click to expand it.
scripts/Engineering/EnginX.py
+
3
−
3
View file @
6153f692
...
...
@@ -54,9 +54,8 @@ def run(calibration_directory, calibration_general, ceria_run, crop_name, crop_o
create_vanadium
(
van_run
,
calibration_directory
)
cal_endings
=
{
"
banks
"
:
[
"
all_banks
"
,
"
bank_{}
"
.
format
(
crop_on
)],
"
sp
r
ectra
"
:
[
"
all_banks
"
,
"
bank_{}
"
.
format
(
crop_name
)],
"
spectra
"
:
[
"
all_banks
"
,
"
bank_{}
"
.
format
(
crop_name
)],
None
:
[
"
all_banks
"
,
"
bank_North
"
,
"
bank_South
"
]}
expected_cals
=
[
"
ENGINX_{0}_{1}_{2}.prm
"
.
format
(
van_run
,
ceria_run
,
i
)
for
i
in
cal_endings
.
get
(
cropped
)]
expected_cals_present
=
[
os
.
path
.
isfile
(
os
.
path
.
join
(
calibration_directory
,
cal_file
))
for
cal_file
in
expected_cals
]
...
...
@@ -70,7 +69,8 @@ def run(calibration_directory, calibration_general, ceria_run, crop_name, crop_o
time_period
=
kwargs
.
get
(
"
time_period
"
,
None
)
pre_process
(
params
,
time_period
,
focus_run
)
focus
(
focus_run
,
grouping_file
,
crop_on
,
calibration_directory
,
focus_directory
,
focus_general
,
cropped
,
van_run
)
if
focus_run
is
not
None
:
focus
(
focus_run
,
grouping_file
,
crop_on
,
calibration_directory
,
focus_directory
,
focus_general
,
cropped
,
van_run
)
# create the vanadium run for the run number set of the object
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment