Skip to content

Commit

Permalink
Re #8623. Adding another NOMAD test.
Browse files Browse the repository at this point in the history
The previous one was for a NOMAD oddity, this time do the actual
focus position only one.
  • Loading branch information
peterfpeterson committed Jan 3, 2014
1 parent f870ac1 commit 39feaa7
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 6 deletions.
Expand Up @@ -104,10 +104,9 @@ class LoadPDCharacterizationsTest : public CxxTest::TestSuite
TS_ASSERT_EQUALS(azi[0], 0.);
}

// Test/AutoTestData/Test_characterizations_char.txt
void test_Focus()
void test_FocusAndChar2()
{
const std::string CHAR_FILE("Test_characterizations_focus.txt");
const std::string CHAR_FILE("Test_characterizations_focus_and_char2.txt");
ITableWorkspace_sptr wksp;

// initialize and run the algorithm
Expand Down Expand Up @@ -174,6 +173,63 @@ class LoadPDCharacterizationsTest : public CxxTest::TestSuite
}
}

void test_Focus()
{
const std::string CHAR_FILE("Test_characterizations_focus.txt");
ITableWorkspace_sptr wksp;

// initialize and run the algorithm
LoadPDCharacterizations alg;
runAlg(alg, wksp, CHAR_FILE);

// test the table workspace
TS_ASSERT_EQUALS(wksp->columnCount(), 10);
TS_ASSERT_EQUALS(wksp->rowCount(), 0);

// test the other output properties
TS_ASSERT_EQUALS(alg.getPropertyValue("IParmFilename"), std::string("NOMAD_11_22_11.prm"));
double l1 = alg.getProperty("PrimaryFlightPath");
TS_ASSERT_EQUALS(l1, 19.5);

const int NUM_SPEC = 6;

std::vector<int32_t> specIds = alg.getProperty("SpectrumIDs");
TS_ASSERT_EQUALS(specIds.size(), NUM_SPEC);
if (!specIds.empty())
{
for (int i = 0; i < NUM_SPEC; ++i)
TS_ASSERT_EQUALS(specIds[i], i+1);
}

std::vector<double> l2 = alg.getProperty("L2");
TS_ASSERT_EQUALS(l2.size(), NUM_SPEC);
if (!l2.empty())
{
for (int i = 0; i < NUM_SPEC; ++i)
TS_ASSERT_EQUALS(l2[i], 2.);
}

std::vector<double> polar = alg.getProperty("Polar");
TS_ASSERT_EQUALS(polar.size(), NUM_SPEC);
if (!polar.empty())
{
TS_ASSERT_EQUALS(polar[0], 15.);
TS_ASSERT_EQUALS(polar[1], 31.);
TS_ASSERT_EQUALS(polar[2], 67.);
TS_ASSERT_EQUALS(polar[3], 122.);
TS_ASSERT_EQUALS(polar[4], 154.);
TS_ASSERT_EQUALS(polar[5], 7.);
}

std::vector<double> azi = alg.getProperty("Azimuthal");
TS_ASSERT_EQUALS(azi.size(), NUM_SPEC);
if (!azi.empty())
{
for (int i = 0; i < NUM_SPEC; ++i)
TS_ASSERT_EQUALS(azi[0], 0.);
}
}

void test_Char()
{
const std::string CHAR_FILE("Test_characterizations_char.txt");
Expand Down
3 changes: 0 additions & 3 deletions Test/AutoTestData/Test_characterizations_focus.txt
Expand Up @@ -6,6 +6,3 @@ Instrument parameter file: NOMAD_11_22_11.prm
5 2 154
6 2 7
L1 19.5
#S 1 characterization runs
#L frequency(Hz) center_wavelength(angstrom) bank_num vanadium_run empty_run vanadium_back d_min(angstrom) d_max(angstrom)
60 1.4 1 0 0 0 .31,.25,.13,.13,.13,.42 13.66,5.83,3.93,2.09,1.57,31.42 300.00 16666.67
11 changes: 11 additions & 0 deletions Test/AutoTestData/Test_characterizations_focus_and_char2.txt
@@ -0,0 +1,11 @@
Instrument parameter file: NOMAD_11_22_11.prm
1 2 15
2 2 31
3 2 67
4 2 122
5 2 154
6 2 7
L1 19.5
#S 1 characterization runs
#L frequency(Hz) center_wavelength(angstrom) bank_num vanadium_run empty_run vanadium_back d_min(angstrom) d_max(angstrom)
60 1.4 1 0 0 0 .31,.25,.13,.13,.13,.42 13.66,5.83,3.93,2.09,1.57,31.42 300.00 16666.67

0 comments on commit 39feaa7

Please sign in to comment.