-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented unit test of CreateLeBailFitInput. Refs #6862.
1. Added the unit test files 2. Added 2 files for unit test to AutoTestData
- Loading branch information
Showing
4 changed files
with
234 additions
and
0 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
52 changes: 52 additions & 0 deletions
52
...ntid/Framework/PythonInterface/test/python/plugins/algorithms/CreateLeBailFitInputTest.py
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import unittest | ||
import numpy | ||
from mantid.kernel import * | ||
from mantid.api import * | ||
from testhelpers import run_algorithm | ||
from mantid.api import AnalysisDataService | ||
|
||
import os | ||
|
||
class CreateLeBailFitInputTest(unittest.TestCase): | ||
|
||
def test_LoadHKLFile(self): | ||
""" Test to load a .hkl file | ||
""" | ||
# Set up | ||
alg_test = run_algorithm("CreateLeBailFitInput", | ||
Instrument = "POWGEN", | ||
ReflectionsFile = "LB4853b2.hkl", | ||
FullprofParameterFile = "2011B_HR60b2.irf", | ||
Bank = 2, | ||
LatticeConstant = 4.66, | ||
InstrumentParameterWorkspace = "PG3_Bank2_Foo", | ||
BraggPeakParameterWorkspace = "LaB6_Peaks" | ||
) | ||
|
||
# Execute | ||
self.assertTrue(alg_test.isExecuted()) | ||
|
||
# Verify some values | ||
# Profile parameter workspace | ||
paramws = AnalysisDataService.retrieve("PG3_Bank2_Foo") | ||
self.assertEqual(27, paramws.rowCount()) | ||
|
||
paramnames = [] | ||
for i in xrange(27): | ||
paramname = paramws.cell(i, 0) | ||
paramnames.append(paramname) | ||
self.assertEqual(paramnames.count("LatticeConstant"), 1) | ||
|
||
|
||
# Bragg peak list | ||
braggws = AnalysisDataService.retrieve("LaB6_Peaks") | ||
self.assertEqual(145, braggws.rowCount()) | ||
|
||
# 4. Delete the test hkl file | ||
AnalysisDataService.remove("PG3_Bank2_Foo") | ||
AnalysisDataService.remove("LaB6_Peaks") | ||
|
||
return | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
! ---------------------------------------------- Bank 2 CWL = 1.0660A | ||
! Type of profile function: back-to-back exponentials * pseudo-Voigt | ||
NPROF 10 | ||
! Tof-min(us) step Tof-max(us) | ||
TOFRG 6286.6573 5.0000 70140.0000 | ||
! Zero Dtt1 | ||
ZD2TOF 0.00 22777.7440 | ||
! Zerot Dtt1t Dtt2t x-cross Width | ||
ZD2TOT 61.40 22764.803 0.30 0.3560 1.6368 | ||
! TOF-TWOTH of the bank | ||
TWOTH 90.807 | ||
! Sig-2 Sig-1 Sig-0 | ||
SIGMA 185.900 10.000 0.000 | ||
! Gam-2 Gam-1 Gam-0 | ||
GAMMA 0.000 0.000 0.000 | ||
! alph0 beta0 alph1 beta1 | ||
ALFBE 1.677 6.276 4.633 4.094 | ||
! alph0t beta0t alph1t beta1t | ||
ALFBT 40.480 84.073 0.000 2.737 | ||
END |
Oops, something went wrong.