Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature/8096_support_fp_profile9'
Browse files Browse the repository at this point in the history
  • Loading branch information
KarlPalmen committed Oct 15, 2013
2 parents 7bff58a + 2269a99 commit fd46878
Show file tree
Hide file tree
Showing 5 changed files with 648 additions and 204 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@ namespace DataHandling

void parseBankLine(std::string line, double& cwl, int& bankid);

/// Search token for profile number
int searchProfile();

/// Parse 1 bank of lines of profile 9
void parseProfile9();

/// Parse 1 bank of lines of profile 10
void parseProfile10();

/// Generate output workspace
DataObjects::TableWorkspace_sptr genTableWorkspace(std::map<int, std::map<std::string, double> > bankparammap);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,43 @@ namespace DataHandling
virtual void initDocs();
/// Initialisation code
void init();
///Execution code
/// Execution code
void exec();

///Write the header information

std::string toProf10IrfString(int bankid);
/// Process properties
void processProperties();

/// Write out string for profile 10 .irf file
std::string toProf10IrfString();

/// Write out string for profile 9 .irf file
std::string toProf9IrfString();

/// Parse input workspace to map of parameters
void parseTableWorkspace();

/// Check wether a profile parameter map has the parameter
bool has_key(std::map<std::string, double> profmap, std::string key);

/// Map containing the name of value of each parameter required by .irf file
std::map<std::string, double> mParameters;
std::map<std::string, double> m_profileParamMap;

/// Input table workspace
DataObjects::TableWorkspace_sptr inpWS;
DataObjects::TableWorkspace_sptr m_profileTableWS;

/// Output Irf file name
std::string m_outIrfFilename;

/// Bank to write
int m_bankID;

/// Profile number
int m_fpProfileNumber;

/// Append to existing file
bool m_append;

};

Expand Down
17 changes: 6 additions & 11 deletions Code/Mantid/Framework/DataHandling/src/LoadFullprofResolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@ Load Fullprof resolution (.irf) file to TableWorkspace(s)

#include <fstream>

/**
CHANGE:
1. Remove the 2nd output for bank information
2. Make the output to be a n(bank) + 1 column workspace
**/

using namespace Mantid;
using namespace Mantid::API;
using namespace Mantid::DataObjects;
Expand Down Expand Up @@ -328,6 +321,7 @@ namespace DataHandling

if (boost::starts_with(line, "TOFRG"))
{
// TOFRG tof-min step tof-max
vector<string> terms;
boost::split(terms, line, boost::is_any_of(" "), boost::token_compress_on);
if (terms.size() != 4)
Expand All @@ -349,12 +343,13 @@ namespace DataHandling
}
else if (boost::starts_with(line, "D2TOF"))
{
// D2TOF Dtt1 Dtt2 Zero
vector<string> terms;
boost::split(terms, line, boost::is_any_of(" "), boost::token_compress_on);
if (terms.size() != 2 && terms.size() != 4)
{
stringstream errmsg;
errmsg << "Line TOFRG has " << terms.size() << " terms. Different from 2/4 terms in definition.";
errmsg << "Line D2TOF has " << terms.size() << " terms. Different from 2/4 terms in definition.";
g_log.error(errmsg.str());
throw runtime_error(errmsg.str());
}
Expand Down Expand Up @@ -383,7 +378,7 @@ namespace DataHandling
if (terms.size() != 3)
{
stringstream errmsg;
errmsg << "Line TOFRG has " << terms.size() << " terms. Different from 4 terms in definition.";
errmsg << "Line ZD2TOF has " << terms.size() << " terms. Different from 4 terms in definition.";
g_log.error(errmsg.str());
throw runtime_error(errmsg.str());
}
Expand Down Expand Up @@ -507,6 +502,7 @@ namespace DataHandling
} // "GAMMA"
else if (boost::starts_with(line, "ALFBE"))
{
// ALFBE alph0 beta0 alph1 beta1
vector<string> terms;
boost::split(terms, line, boost::is_any_of(" "), boost::token_compress_on);
if (terms.size() != 5)
Expand Down Expand Up @@ -554,7 +550,7 @@ namespace DataHandling
else if (boost::starts_with(line,"END"))
{
// Ignore END line
g_log.debug() << "END line of bank";
g_log.debug("END line of bank." );
}
else
{
Expand Down Expand Up @@ -709,7 +705,6 @@ namespace DataHandling
return tablews;
}


} // namespace DataHandling
} // namespace Mantid

Expand Down

0 comments on commit fd46878

Please sign in to comment.