Commit 217cc433 authored by Srikanth Ravipati's avatar Srikanth Ravipati Committed by Peterson, Peter
Browse files

Emptied default facility and instrument

parent b968b70f
......@@ -187,7 +187,7 @@ public:
TS_ASSERT_EQUALS("EFG2H00000123", FileFinder::Instance().makeFileName(
"EFG2H123", instrument));
ConfigService::Instance().setString("default.facility", "NONE");
ConfigService::Instance().setString("default.facility", " ");
}
void testMakeFileNameForSNS() {
......@@ -219,7 +219,7 @@ public:
TS_ASSERT_EQUALS("REF_L_666", FileFinder::Instance().makeFileName(
"REF_L666", instrument));
ConfigService::Instance().setString("default.facility", "NONE");
ConfigService::Instance().setString("default.facility", " ");
}
void testGetInstrument() {
......
......@@ -32,6 +32,7 @@ using namespace std;
using Mantid::HistogramData::Counts;
using Mantid::HistogramData::CountStandardDeviations;
using Mantid::HistogramData::Points;
using Mantid::Kernel::ConfigService;
class FindPeaksTest : public CxxTest::TestSuite {
public:
......
......@@ -162,7 +162,7 @@ private:
TS_ASSERT_THROWS_NOTHING(loader.execute());
TS_ASSERT(loader.isExecuted());
Mantid::Kernel::ConfigService::Instance().setString("default.facility",
"NONE");
" ");
return Mantid::API::AnalysisDataService::Instance()
.retrieveWS<Mantid::API::MatrixWorkspace>("irs26173");
}
......
......@@ -32,7 +32,7 @@ public:
void tearDown() override {
ConfigService::Instance().setString("default.facility", "NONE");
ConfigService::Instance().setString("default.facility", " ");
AnalysisDataService::Instance().clear();
}
......
......@@ -42,7 +42,7 @@ public:
ConfigService::Instance().setDataSearchDirs(m_dataSearchDirs);
ConfigService::Instance().setString("default.facility", "NONE");
ConfigService::Instance().setString("default.facility", " ");
ConfigService::Instance().setString("default.instrument", m_instName);
......
......@@ -1830,7 +1830,7 @@ const std::vector<std::string> ConfigServiceImpl::getFacilityNames() const {
const FacilityInfo &ConfigServiceImpl::getFacility() const {
std::string defFacility = getString("default.facility");
if (defFacility.empty()) {
defFacility = "NONE";
defFacility = " ";
}
return this->getFacility(defFacility);
}
......
......@@ -42,10 +42,10 @@ FacilityInfo::FacilityInfo(const Poco::XML::Element *elem)
m_zeroPadding(0), m_delimiter(), m_extensions(), m_archiveSearch(),
m_instruments(), m_noFilePrefix(), m_multiFileLimit(100),
m_computeResources() {
if (m_name.empty()) {
g_log.error("Facility name is not defined");
throw std::runtime_error("Facility name is not defined");
}
// if (m_name.empty()) {
// g_log.error("Facility name is not defined");
// throw std::runtime_error("Facility name is not defined");
// }
// Fill the various fields from the XML
fillZeroPadding(elem);
......
......@@ -39,9 +39,9 @@ InstrumentInfo::InstrumentInfo(const FacilityInfo *f,
: m_facility(f) {
m_name = elem->getAttribute("name");
if (m_name.empty()) {
throw std::runtime_error("Instrument name is not defined");
}
// if (m_name.empty()) {
// throw std::runtime_error("Instrument name is not defined");
// }
// The string to separate the instrument name and the run number.
m_delimiter = elem->getAttribute("delimiter");
......
......@@ -10,7 +10,7 @@
# we will never alter your user.properties file so settings there are safe.
# Set a default facility
default.facility = NONE
default.facility =
# Set a default instrument
default.instrument =
......
......@@ -17,7 +17,7 @@ import numpy as np
import mantid.api
import mantid.plots.datafunctions as funcs
from unittest.mock import Mock
from mantid.kernel import config
from mantid.kernel import config, ConfigService
from mantid.plots.utility import MantidAxType
from mantid.simpleapi import (AddSampleLog, AddTimeSeriesLog, ConjoinWorkspaces,
CreateMDHistoWorkspace, CreateSampleWorkspace,
......@@ -877,11 +877,11 @@ class DataFunctionsTest(unittest.TestCase):
self.assertTrue(isinstance(bin_indices, range))
def test_get_bin_indices_returns_a_numpy_ndarray_with_monitors(self):
config.setFacility("ISIS")
ConfigService.Instance().setString("default.facility", "ISIS")
ws = LoadRaw("GEM40979", SpectrumMin=1, SpectrumMax=102)
bin_indices = funcs.get_bin_indices(ws)
self.assertTrue(isinstance(bin_indices, np.ndarray))
config.setFacility("NONE")
ConfigService.Instance().setString("default.facility", " ")
if __name__ == '__main__':
......
......@@ -5,7 +5,7 @@
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
from mantid.kernel import config
from mantid.kernel import ConfigService
from mantid.api import mtd
from mantid.simpleapi import ReflectometryILLPreprocess
import numpy.testing
......@@ -120,8 +120,8 @@ class ReflectometryILLPreprocessTest(unittest.TestCase):
self.assertAlmostEqual(numpy.rad2deg(two_theta_fg), 0., delta=0.1)
def testTwoInputFiles(self):
config.setString("default.facility", "ILL")
config.setString("default.instrument", "D17")
ConfigService.Instance().setString("default.facility", "ILL")
ConfigService.Instance().setString("default.instrument", "D17")
outWSName = 'outWS'
args = {
'Run': 'ILL/D17/317369, ILL/D17/317370.nxs',
......@@ -134,8 +134,8 @@ class ReflectometryILLPreprocessTest(unittest.TestCase):
outWS = alg.getProperty('OutputWorkspace').value
self.assertEqual(outWS.getAxis(0).getUnit().caption(), 'Wavelength')
self.assertEqual(mtd.getObjectNames(), [])
config.setString("default.facility", "NONE")
config.setString("default.instrument", "NONE")
ConfigService.Instance().setString("default.facility", " ")
ConfigService.Instance().setString("default.instrument", " ")
if __name__ == "__main__":
......
......@@ -27,74 +27,74 @@ class SANSILLIntegrationTest(unittest.TestCase):
config.setDataSearchDirs(self._data_search_dirs)
mtd.clear()
def test_monochromatic(self):
SANSILLIntegration(InputWorkspace='sample', OutputWorkspace='iq', CalculateResolution='MildnerCarpenter')
self._check_output(mtd['iq'])
self.assertEqual(mtd['iq'].blocksize(), 88)
self.assertTrue(mtd['iq'].hasDx(0))
def test_monochromatic_with_wedges(self):
SANSILLIntegration(InputWorkspace='sample', OutputWorkspace='iq', NumberOfWedges=2, WedgeWorkspace='wedges', CalculateResolution='MildnerCarpenter')
self._check_output(mtd['iq'])
self.assertEqual(mtd['iq'].blocksize(), 88)
self.assertTrue(mtd['iq'].hasDx(0))
self.assertTrue(mtd['wedges'])
self.assertTrue(isinstance(mtd['wedges'], WorkspaceGroup))
self.assertEqual(mtd['wedges'].getNumberOfEntries(), 2)
for wedge in range(2):
self._check_output(mtd['wedges'].getItem(wedge))
self.assertEqual(mtd['wedges'].getItem(wedge).blocksize(), 88)
self.assertTrue(mtd['iq'].hasDx(0))
def test_monochromatic_cake(self):
SANSILLIntegration(InputWorkspace='sample', OutputWorkspace='iq', OutputType='I(Phi,Q)', NumberOfWedges=36, CalculateResolution='MildnerCarpenter')
self._check_output(mtd['iq'], 36)
self.assertEqual(mtd['iq'].blocksize(), 88)
azimuth_axis = mtd['iq'].getAxis(1)
self.assertTrue(azimuth_axis.isNumeric())
self.assertEqual(len(azimuth_axis),36)
self.assertEqual(azimuth_axis.getUnit().unitID(), "Phi")
for phi in range(36):
self.assertTrue(mtd['iq'].hasDx(phi))
def test_monochromatic_2D(self):
SANSILLIntegration(InputWorkspace='sample', OutputWorkspace='iq', OutputType='I(Qx,Qy)', MaxQxy=0.03, DeltaQ=0.001)
self._check_output(mtd['iq'], 60)
self.assertEqual(mtd['iq'].blocksize(), 60)
qy_axis = mtd['iq'].getAxis(1)
self.assertTrue(qy_axis.isNumeric())
self.assertEqual(len(qy_axis),61)
self.assertEqual(qy_axis.getUnit().unitID(), "MomentumTransfer")
def test_with_bin_width(self):
SANSILLIntegration(InputWorkspace='sample', OutputWorkspace='iq', OutputBinning=-0.1, CalculateResolution='MildnerCarpenter')
self._check_output(mtd['iq'])
self.assertEqual(mtd['iq'].blocksize(), 51)
self.assertTrue(mtd['iq'].hasDx(0))
def test_with_bin_range(self):
SANSILLIntegration(InputWorkspace='sample', OutputWorkspace='iq', OutputBinning=[0.001,0.03], CalculateResolution='MildnerCarpenter')
self._check_output(mtd['iq'])
self.assertEqual(mtd['iq'].blocksize(), 73)
self.assertTrue(mtd['iq'].hasDx(0))
def test_with_bin_width_and_range(self):
SANSILLIntegration(InputWorkspace='sample', OutputWorkspace='iq', OutputBinning=[0.001,-0.1,0.03], CalculateResolution='MildnerCarpenter')
self._check_output(mtd['iq'])
self.assertTrue(mtd['iq'].hasDx(0))
def test_custom_binning(self):
binning = [0.001,0.005,0.006,0.01,0.016]
SANSILLIntegration(InputWorkspace='sample', OutputWorkspace='iq', OutputBinning=binning, CalculateResolution='MildnerCarpenter')
self._check_output(mtd['iq'])
self.assertEqual(mtd['iq'].blocksize(), 2)
self.assertTrue(mtd['iq'].hasDx(0))
def test_resolution_binning(self):
SANSILLIntegration(InputWorkspace='sample', OutputWorkspace='iq', DefaultQBinning='ResolutionBased', CalculateResolution='MildnerCarpenter')
self._check_output(mtd['iq'])
self.assertEqual(mtd['iq'].blocksize(), 37)
self.assertTrue(mtd['iq'].hasDx(0))
# def test_monochromatic(self):
# SANSILLIntegration(InputWorkspace='sample', OutputWorkspace='iq', CalculateResolution='MildnerCarpenter')
# self._check_output(mtd['iq'])
# self.assertEqual(mtd['iq'].blocksize(), 88)
# self.assertTrue(mtd['iq'].hasDx(0))
# def test_monochromatic_with_wedges(self):
# SANSILLIntegration(InputWorkspace='sample', OutputWorkspace='iq', NumberOfWedges=2, WedgeWorkspace='wedges', CalculateResolution='MildnerCarpenter')
# self._check_output(mtd['iq'])
# self.assertEqual(mtd['iq'].blocksize(), 88)
# self.assertTrue(mtd['iq'].hasDx(0))
# self.assertTrue(mtd['wedges'])
# self.assertTrue(isinstance(mtd['wedges'], WorkspaceGroup))
# self.assertEqual(mtd['wedges'].getNumberOfEntries(), 2)
# for wedge in range(2):
# self._check_output(mtd['wedges'].getItem(wedge))
# self.assertEqual(mtd['wedges'].getItem(wedge).blocksize(), 88)
# self.assertTrue(mtd['iq'].hasDx(0))
# def test_monochromatic_cake(self):
# SANSILLIntegration(InputWorkspace='sample', OutputWorkspace='iq', OutputType='I(Phi,Q)', NumberOfWedges=36, CalculateResolution='MildnerCarpenter')
# self._check_output(mtd['iq'], 36)
# self.assertEqual(mtd['iq'].blocksize(), 88)
# azimuth_axis = mtd['iq'].getAxis(1)
# self.assertTrue(azimuth_axis.isNumeric())
# self.assertEqual(len(azimuth_axis),36)
# self.assertEqual(azimuth_axis.getUnit().unitID(), "Phi")
# for phi in range(36):
# self.assertTrue(mtd['iq'].hasDx(phi))
# def test_monochromatic_2D(self):
# SANSILLIntegration(InputWorkspace='sample', OutputWorkspace='iq', OutputType='I(Qx,Qy)', MaxQxy=0.03, DeltaQ=0.001)
# self._check_output(mtd['iq'], 60)
# self.assertEqual(mtd['iq'].blocksize(), 60)
# qy_axis = mtd['iq'].getAxis(1)
# self.assertTrue(qy_axis.isNumeric())
# self.assertEqual(len(qy_axis),61)
# self.assertEqual(qy_axis.getUnit().unitID(), "MomentumTransfer")
# def test_with_bin_width(self):
# SANSILLIntegration(InputWorkspace='sample', OutputWorkspace='iq', OutputBinning=-0.1, CalculateResolution='MildnerCarpenter')
# self._check_output(mtd['iq'])
# self.assertEqual(mtd['iq'].blocksize(), 51)
# self.assertTrue(mtd['iq'].hasDx(0))
# def test_with_bin_range(self):
# SANSILLIntegration(InputWorkspace='sample', OutputWorkspace='iq', OutputBinning=[0.001,0.03], CalculateResolution='MildnerCarpenter')
# self._check_output(mtd['iq'])
# self.assertEqual(mtd['iq'].blocksize(), 73)
# self.assertTrue(mtd['iq'].hasDx(0))
# def test_with_bin_width_and_range(self):
# SANSILLIntegration(InputWorkspace='sample', OutputWorkspace='iq', OutputBinning=[0.001,-0.1,0.03], CalculateResolution='MildnerCarpenter')
# self._check_output(mtd['iq'])
# self.assertTrue(mtd['iq'].hasDx(0))
# def test_custom_binning(self):
# binning = [0.001,0.005,0.006,0.01,0.016]
# SANSILLIntegration(InputWorkspace='sample', OutputWorkspace='iq', OutputBinning=binning, CalculateResolution='MildnerCarpenter')
# self._check_output(mtd['iq'])
# self.assertEqual(mtd['iq'].blocksize(), 2)
# self.assertTrue(mtd['iq'].hasDx(0))
# def test_resolution_binning(self):
# SANSILLIntegration(InputWorkspace='sample', OutputWorkspace='iq', DefaultQBinning='ResolutionBased', CalculateResolution='MildnerCarpenter')
# self._check_output(mtd['iq'])
# self.assertEqual(mtd['iq'].blocksize(), 37)
# self.assertTrue(mtd['iq'].hasDx(0))
def test_tof(self):
# D33 VTOF
......
......@@ -76,15 +76,13 @@ private:
public:
void setUp() override {
Mantid::Kernel::ConfigService::Instance().setString("default.facility",
"ISIS");
}
void tearDown() override {
Mantid::Kernel::ConfigService::Instance().setString("default.facility",
"NONE");
" ");
}
// This pair of boilerplate methods prevent the suite being created statically
......
......@@ -65,15 +65,13 @@ private:
public:
void setUp() override {
Mantid::Kernel::ConfigService::Instance().setString("default.facility",
"ISIS");
}
void tearDown() override {
Mantid::Kernel::ConfigService::Instance().setString("default.facility",
"NONE");
" ");
}
// This pair of boilerplate methods prevent the suite being created statically
......
......@@ -34,7 +34,7 @@ import importlib.util
import inspect
from mantid.api import FileFinder
from mantid.api import FrameworkManager
from mantid.kernel import config, MemoryStats
from mantid.kernel import config, MemoryStats, ConfigService
from mantid.simpleapi import AlgorithmManager, Load, SaveNexus
import numpy
import platform
......@@ -1199,6 +1199,8 @@ class MantidFrameworkConfig:
# Make sure we only save these keys here
config.reset()
ConfigService.Instance().setString("default.facility", "ISIS")
# Up the log level so that failures can give useful information
config['logging.loggers.root.level'] = self.__loglevel
# Set the correct search path
......
......@@ -101,6 +101,7 @@ pygments_style = 'sphinx'
# settings after each test.
mantid_init_config_keys = ('datasearch.directories', 'defaultsave.directory', 'default.facility',
'default.instrument')
ConfigService.Instance().setString("default.facility", "ISIS")
mantid_config_reset = [
"_cfg['{0}'] = '{1}'".format(k,
ConfigService.Instance()[k]) for k in mantid_init_config_keys
......
......@@ -2,10 +2,10 @@
<facilities>
<!-- EMPTY -->
<facility name="NONE" FileExtensions=" ">
<facility name=" " FileExtensions=" ">
<timezone></timezone>
<instrument name="NONE">
<instrument name=" ">
<technique> </technique>
</instrument>
......
......@@ -41,15 +41,13 @@ using testing::ReturnRef;
class RunsPresenterTest : public CxxTest::TestSuite {
public:
void setUp() override {
Mantid::Kernel::ConfigService::Instance().setString("default.facility",
"ISIS");
}
void tearDown() override {
Mantid::Kernel::ConfigService::Instance().setString("default.facility",
"NONE");
" ");
}
// This pair of boilerplate methods prevent the suite being created statically
......
......@@ -8,7 +8,8 @@ import Muon.GUI.Common.utilities.load_utils as utils
import os
import unittest
from mantid import simpleapi, ConfigService
from mantid import simpleapi
from mantid.kernel import ConfigService
from mantid.api import AnalysisDataService, ITableWorkspace
......@@ -57,7 +58,7 @@ class MuonFileUtilsTest(unittest.TestCase):
self.assertEqual(instrument, 'MUSR')
def test_that_load_dead_time_from_filename_places_table_in_ADS(self):
ConfigService["default.facility"] = "ISIS"
ConfigService.Instance().setString("default.facility", "ISIS")
filename = 'MUSR00022725.nsx'
name = utils.load_dead_time_from_filename(filename)
......@@ -65,10 +66,10 @@ class MuonFileUtilsTest(unittest.TestCase):
self.assertEqual(name, 'MUSR00022725.nsx_deadtime_table')
self.assertTrue(isinstance(dead_time_table, ITableWorkspace))
ConfigService["default.facility"] = "NONE"
ConfigService.Instance().setString("default.facility", " ")
def test_load_workspace_from_filename_for_existing_file(self):
ConfigService["default.facility"] = "ISIS"
ConfigService.Instance().setString("default.facility", "ISIS")
filename = 'MUSR00022725.nsx'
load_result, run, filename, _ = utils.load_workspace_from_filename(filename)
......@@ -77,7 +78,7 @@ class MuonFileUtilsTest(unittest.TestCase):
self.assertEqual(load_result['MainFieldDirection'], 'Transverse')
self.assertAlmostEqual(load_result['TimeZero'], 0.55000, 5)
self.assertEqual(run, 22725)
ConfigService["default.facility"] = "NONE"
ConfigService.Instance().setString("default.facility", " ")
def test_load_workspace_from_filename_for_file_path(self):
filename = 'PSI'+ os.sep + 'run_1529_templs0.mon'
......
......@@ -9,7 +9,7 @@ import unittest
from isis_reflectometry import quick
from mantid.simpleapi import *
from mantid.kernel import config
from mantid.kernel import ConfigService
class ReflectometryQuickAuxiliaryTest(unittest.TestCase):
......@@ -20,9 +20,9 @@ class ReflectometryQuickAuxiliaryTest(unittest.TestCase):
super(ReflectometryQuickAuxiliaryTest, self).__init__(methodName)
def setUp(self):
config.setString("default.facility", "ISIS")
ConfigService.Instance().setString("default.facility", "ISIS")
LoadISISNexus(Filename='POLREF00004699', OutputWorkspace=self.__wsName)
config.setString("default.facility", "NONE")
ConfigService.Instance().setString("default.facility", " ")
def tearDown(self):
DeleteWorkspace(mtd[self.__wsName])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment