Skip to content

Commit

Permalink
Fix issues related to not having an instrument
Browse files Browse the repository at this point in the history
Refs #11734
  • Loading branch information
DanNixon committed May 11, 2015
1 parent f162c47 commit 3d82e85
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
13 changes: 10 additions & 3 deletions Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/ConvFit.cpp
Expand Up @@ -591,7 +591,14 @@ namespace IDA
{
Mantid::Geometry::Instrument_const_sptr inst =
AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>(workspaceName)->getInstrument();
std::string analyser = inst->getStringParameter("analyser")[0];
std::vector<std::string> analysers = inst->getStringParameter("analyser");
if(analysers.empty())
{
g_log.warning("Could not load instrument resolution from parameter file");
return 0.0;
}

std::string analyser = analysers[0];
std::string idfDirectory = Mantid::Kernel::ConfigService::Instance().getString("instrumentDefinition.directory");

// If the analyser component is not already in the data file the laod it from the parameter file
Expand All @@ -607,7 +614,7 @@ namespace IDA

if(!loadParamFile->isExecuted())
{
g_log.error("Could not load parameter file, ensure instrument directory is in data search paths.");
g_log.warning("Could not load parameter file, ensure instrument directory is in data search paths.");
return 0.0;
}

Expand All @@ -620,7 +627,7 @@ namespace IDA
{
UNUSED_ARG(e);

g_log.error("Could not load instrument resolution from parameter file");
g_log.warning("Could not load instrument resolution from parameter file");
resolution = 0.0;
}

Expand Down
8 changes: 5 additions & 3 deletions Code/Mantid/scripts/Inelastic/IndirectCommon.py
Expand Up @@ -43,9 +43,11 @@ def getInstrRun(ws_name):
raise RuntimeError("Could not find run number associated with workspace.")

instrument = workspace.getInstrument().getName()
facility = config.getFacility()
instrument = facility.instrument(instrument).filePrefix(int(run_number))
instrument = instrument.lower()
if instrument != '':
facility = config.getFacility()
instrument = facility.instrument(instrument).filePrefix(int(run_number))
instrument = instrument.lower()

return instrument, run_number


Expand Down

0 comments on commit 3d82e85

Please sign in to comment.