15#include <boost/algorithm/string/classification.hpp>
16#include <boost/algorithm/string/split.hpp>
36 const std::string &mndspstr,
const std::string &mxdspstr,
const std::string &maxtofstr);
39 std::vector<unsigned int> getBankIDs()
const;
41 bool hasBank(
unsigned int bankid)
const;
43 double getParameter(
unsigned int bankid,
const std::string ¶mname)
const;
45 void setParameter(
unsigned int bankid,
const std::string ¶mname,
double value);
50 std::vector<double> parseStringDbl(
const std::string &instring)
const;
52 std::vector<unsigned int> parseStringUnsignedInt(
const std::string &instring)
const;
77 const size_t numbanks = bankids.size();
87 m_bankIDs.assign(bankids.begin(), bankids.end());
89 for (
size_t ib = 0; ib < numbanks; ++ib) {
99 const std::string &mndspstr,
const std::string &mxdspstr,
100 const std::string &maxtofstr)
101 : m_frequency(freq), m_bankIDs(parseStringUnsignedInt(bankidstr)), m_vecCWL(parseStringDbl(cwlstr)),
102 m_mindsps(parseStringDbl(mndspstr)), m_maxdsps(parseStringDbl(mxdspstr)), m_maxtofs(parseStringDbl(maxtofstr))
110 std::string errmsg(
"Default chopper constants have different number of elements. ");
111 throw runtime_error(errmsg);
121 for (
size_t ib = 0; ib < numbanks; ++ib) {
145 errss <<
"Bank ID and index map does not have entry for bank " << bankid;
146 throw runtime_error(errss.str());
148 size_t bindex = biter->second;
152 if (paramname ==
"TwoTheta") {
154 }
else if (paramname ==
"MinDsp") {
158 }
else if (paramname ==
"MaxDsp") {
162 }
else if (paramname ==
"MaxTOF") {
166 }
else if (paramname ==
"CWL") {
170 errss <<
"ChopperConfiguration unable to locate: Bank ID = " << bankid <<
", Parameter = " << paramname;
171 throw runtime_error(errss.str());
185 errss <<
"Chopper configuration does not have bank " << bankid;
186 throw runtime_error(errss.str());
188 size_t ibank = biter->second;
190 if (paramname ==
"2Theta")
192 else if (paramname ==
"CWL")
194 else if (paramname ==
"L1")
196 else if (paramname ==
"L2")
198 else if (paramname ==
"MinTOF") {
200 }
else if (paramname ==
"MaxTOF")
202 else if (paramname ==
"MinDsp")
204 else if (paramname ==
"MaxDsp")
208 errss <<
"In Chopper configuration's bank " << bankid <<
", there is no parameter named " << paramname;
209 throw runtime_error(errss.str());
219 boost::split(strs, instring, boost::is_any_of(
", "));
221 vector<double> vecdouble;
222 for (
auto &str : strs) {
224 double item = std::stod(str.c_str());
225 vecdouble.emplace_back(item);
241 boost::split(strs, instring, boost::is_any_of(
", "));
243 vector<unsigned int> vecinteger;
244 for (
auto &str : strs) {
246 int item = std::stoi(str);
248 throw runtime_error(
"Found negative number in a string for unsigned integers.");
250 vecinteger.emplace_back(
static_cast<unsigned int>(item));
264 :
API::
Algorithm(), m_instrument(), m_L1(0.),
m_L2(0.), m_2theta(0.), m_frequency(0), m_id_line(), m_sample(),
265 m_vecBankID2File(), m_gsasFileName(), m_configuration(), m_profileMap(), m_gdsp(), m_gdt(), m_galpha(), m_gbeta(),
266 m_bank_mndsp(), m_bank_mxtof() {}
274 "Name of the table workspace containing the parameters.");
276 vector<string> infileexts{
".irf"};
278 declareProperty(std::move(infileprop),
"Name of the input Fullprof resolution file (.irf).");
280 vector<string> outfileexts{
".iparam",
".prm"};
281 auto fileprop = std::make_unique<FileProperty>(
"OutputFileName",
"",
FileProperty::Save, outfileexts);
282 declareProperty(std::move(fileprop),
"Name of the output GSAS instrument file.");
285 "Bank IDs of the banks to be written to GSAS instrument file.");
287 vector<string> instruments{
"powgen",
"nomad"};
288 declareProperty(
"Instrument",
"powgen", std::make_shared<StringListValidator>(instruments),
289 "Name of the instrument that parameters are belonged to. "
290 "So far, only PG3 and NOM are supported.");
292 vector<string> vecfreq{
"10",
"30",
"60"};
293 declareProperty(
"ChopperFrequency",
"60", std::make_shared<StringListValidator>(vecfreq),
294 "Frequency of the chopper. ");
296 declareProperty(
"IDLine",
"",
"ID line to be written in GSAS instrument file");
297 declareProperty(
"Sample",
"",
"Sample information written to header (title) ");
300 mustBePositive->setLower(0.0);
304 "L2 (secondary flight path) of the instrument. "
305 "It must be given if 2Theta is not given. ");
307 "Angle of the detector bank. "
308 "It must be given if L2 is not given. ");
319 map<unsigned int, map<string, double>> bankprofileparammap;
328 for (
auto &miter : bankprofileparammap) {
329 unsigned int bankid = miter.first;
350 std::string errorstr(
"FindPeaks algorithm requires the CurveFitting library");
352 throw std::runtime_error(errorstr);
361 bool loadirf =
false;
373 errss <<
"Neither input table workspace (" <<
getPropertyValue(
"InputWorkspace") <<
") nor "
374 <<
"input .irf file " <<
getPropertyValue(
"InputFileName") <<
" is valid. ";
376 throw runtime_error(errss.str());
390 throw runtime_error(
"L1 must be given!");
393 string freqtempstr =
getProperty(
"ChopperFrequency");
426 string errmsg(
"User must specify either 2theta or L2. Neither of them is given.");
428 throw runtime_error(errmsg);
466 map<
unsigned int, map<string, double>> &profilemap) {
467 size_t numbanks = ws->columnCount() - 1;
468 size_t numparams = ws->rowCount();
469 vector<map<string, double>> vec_maptemp(numbanks);
470 vector<unsigned int> vecbankindex(numbanks);
473 vector<string> colnames = ws->getColumnNames();
474 if (colnames[0] !=
"Name")
475 throw runtime_error(
"The first column must be Name");
478 for (
size_t irow = 0; irow < numparams; ++irow) {
482 if (parname !=
"BANK") {
483 for (
size_t icol = 0; icol < numbanks; ++icol) {
486 vec_maptemp[icol].emplace(parname, tmpdbl);
489 for (
size_t icol = 0; icol < numbanks; ++icol) {
492 vecbankindex[icol] =
static_cast<unsigned int>(tmpint);
499 db1ss <<
"[DBx912] Number of banks in profile table = " << vecbankindex.
size() <<
" containing bank ";
500 for (
auto bankIndex : vecbankindex)
501 db1ss << bankIndex <<
", ";
507 for (
size_t i = 0; i < vecbankindex.size(); ++i) {
508 unsigned int bankid = vecbankindex[i];
509 profilemap.emplace(bankid, vec_maptemp[i]);
520 map<unsigned int, map<string, double>>::const_iterator bmiter;
521 for (bmiter = profmap.begin(); bmiter != profmap.end(); ++bmiter) {
522 int bankid = bmiter->first;
523 bankids.emplace_back(bankid);
530 for (bmiter = profmap.begin(); bmiter != profmap.end(); ++bmiter) {
531 int bankid = bmiter->first;
542 chconfig->setParameter(bankid,
"CWL", cwl);
543 chconfig->setParameter(bankid,
"MaxTOF", maxtof);
544 chconfig->setParameter(bankid,
"MinDsp", dmin);
545 chconfig->setParameter(bankid,
"MaxDsp", dmax);
547 g_log.
information() <<
"Import bank " << bankid <<
". TOF range: " << mintof <<
", " << maxtof
548 <<
"; D-space range: " << dmin <<
", " << dmax <<
".\n";
558 string bankidstr, cwlstr, mndspstr, mxdspstr, maxtofstr;
561 switch (intfrequency) {
563 bankidstr =
"1,2,3,4,5,6,7";
564 cwlstr =
"0.533, 1.066, 1.333, 1.599, 2.665, 3.731, 4.797";
565 mndspstr =
"0.10, 0.276, 0.414, 0.552, 1.104, 1.656, 2.208";
566 mxdspstr =
"2.06, 3.090, 3.605, 4.120, 6.180, 8.240, 10.30";
567 maxtofstr =
"46.76, 70.14, 81.83, 93.52, 140.3, 187.0, 233.8";
572 cwlstr =
"1.066, 3.198, 5.33";
573 mndspstr =
"0.10, 1.104, 2.208";
574 mxdspstr =
"4.12, 8.24, 12.36";
575 maxtofstr =
"93.5, 187.0, 280.5";
590 throw runtime_error(
"Not supported");
595 return std::make_shared<ChopperConfiguration>(intfrequency, bankidstr, cwlstr, mndspstr, mxdspstr, maxtofstr);
604 string bankidstr, cwlstr, mndspstr, mxdspstr, maxtofstr;
607 switch (intfrequency) {
610 cwlstr =
"1.500, 1.5000";
611 mndspstr =
"0.052, 0.0450";
612 mxdspstr =
"2.630, 2.6000";
613 maxtofstr =
"93.52, 156.00";
618 errss <<
"NOMAD Frequency = " << intfrequency <<
" is not supported. ";
619 throw runtime_error(errss.str());
624 return std::make_shared<ChopperConfiguration>(intfrequency, bankidstr, cwlstr, mndspstr, mxdspstr, maxtofstr);
635 const std::vector<unsigned int> &outputbankids,
const std::string &gsasinstrfilename,
636 const std::map<
unsigned int, std::map<std::string, double>> &bankprofilemap) {
639 throw runtime_error(
"Not set up yet!");
642 for (
auto bankid : outputbankids) {
644 throw runtime_error(
"Chopper configuration does not have some certain bank.");
653 g_log.
information() <<
"Export header of GSAS instrument file " << gsasinstrfilename <<
".\n";
657 vector<unsigned int> banks = outputbankids;
658 sort(banks.begin(), banks.end());
659 for (
auto bankid : banks) {
666 errss <<
"Bank " << bankid <<
" does not exist in source resolution file. "
667 <<
"There are " << bankids.size() <<
" banks given, including "
669 for (
size_t i = 0; i < bankids.size(); ++i) {
671 if (i < bankids.size() - 1)
675 throw runtime_error(errss.str());
688 const std::map<
unsigned int, std::map<std::string, double>> &bankprofilemap,
unsigned int bankid) {
690 auto biter = bankprofilemap.find(bankid);
691 if (biter == bankprofilemap.end())
692 throw runtime_error(
"Bank ID cannot be found in bank-profile-map-map. 001");
693 const map<string, double> &profilemap = biter->second;
704 m_gdt.assign(90, 0.);
706 vector<double> gtof(90, 0.);
707 vector<double> gpkX(90, 0.);
730 double instC = dtt1 - 4 * (alph0 + alph1);
735 double ddstep = ((1.05 * mxdsp) - (0.9 * mndsp)) / 90.;
737 for (
size_t k = 0; k < 90; ++k) {
738 m_gdsp[k] = (0.9 * mndsp) + (
static_cast<double>(k) * ddstep);
739 double rd = 1.0 /
m_gdsp[k];
740 double dmX = mx - rd;
741 gpkX[k] = 0.5 *
erfc(mxb * dmX);
742 gtof[k] =
calTOF(gpkX[k], zero, dtt1, dtt2, zerot, dtt1t, -dtt2t,
m_gdsp[k]);
747 g_log.
debug() << k <<
"\t" << setw(20) << setprecision(10) << gtof[k] <<
"\t " << setw(20) << setprecision(10)
748 <<
m_gdsp[k] <<
"\t " << setw(20) << setprecision(10) << instC <<
"\t " << setw(20)
749 << setprecision(10) <<
m_gdt[k] <<
".\n";
757 auto numbanks =
static_cast<int>(banks.size());
760 pFile = fopen(prmfilename.c_str(),
"w");
763 errss <<
"Unable to open file " << prmfilename <<
" in write-mode";
764 throw runtime_error(errss.str());
767 "1234567890123456789012345678901234567890123456789012345678901"
769 fprintf(pFile,
"ID %s\n",
m_id_line.c_str());
770 fprintf(pFile,
"INS BANK %5d\n", numbanks);
771 fprintf(pFile,
"INS FPATH1 %f \n",
m_L1);
772 fprintf(pFile,
"INS HTYPE PNTR \n");
783 const std::map<
unsigned int, std::map<std::string, double>> &bankprofilemap,
unsigned int bankid,
784 const std::string &prmfilename) {
786 auto biter = bankprofilemap.find(bankid);
787 if (biter == bankprofilemap.end())
788 throw runtime_error(
"Bank does not exist in bank-profile-map. 002");
790 const map<string, double> &profilemap = biter->second;
809 int randint = 10001 + (rand() % (99999 - 10001 + 1));
816 double instC = dtt1 - (4 * (alph0 + alph1));
817 g_log.
debug() <<
"Bank " << bankid <<
": MaxTOF = " << maxtof <<
"; Dtt1 = " << dtt1 <<
", Alph0 = " << alph0
818 <<
", Alph1 = " << alph1 <<
", MinDsp = " << mindsp <<
".\n";
825 stringstream titless;
827 string titleline(titless.str());
831 pFile = fopen(prmfilename.c_str(),
"a");
834 errss <<
"Unable to open file " << prmfilename <<
" in append-mode";
835 throw runtime_error(errss.str());
838 fprintf(pFile,
"INS %2u ICONS%10.3f%10.3f%10.3f %10.3f%5d%10.3f\n", bankid, instC * 1.00009, 0.0, zero, 0.0,
840 fprintf(pFile,
"INS %2uBNKPAR%10.3f%10.3f%10.3f%10.3f%10.3f%5d%5d\n", bankid,
m_L2, twotheta, 0., 0., 0.2, 1, 1);
842 fprintf(pFile,
"INS %2uBAKGD 1 4 Y 0 Y\n", bankid);
843 fprintf(pFile,
"INS %2uI HEAD %s\n", bankid, titleline.c_str());
844 fprintf(pFile,
"INS %2uI ITYP%5d%10.4f%10.4f%10i\n", bankid, 0, mindsp * 0.001 * instC, maxtof, randint);
845 fprintf(pFile,
"INS %2uINAME %s \n", bankid,
m_instrument.c_str());
846 fprintf(pFile,
"INS %2uPRCF1 %5d%5d%10.5f\n", bankid, -3, 21, 0.002);
847 fprintf(pFile,
"INS %2uPRCF11%15.6f%15.6f%15.6f%15.6f\n", bankid, 0.0, 0.0, 0.0, sig0);
848 fprintf(pFile,
"INS %2uPRCF12%15.6f%15.6f%15.6f%15.6f\n", bankid, sig1, sig2, gam0, gam1);
849 fprintf(pFile,
"INS %2uPRCF13%15.6f%15.6f%15.6f%15.6f\n", bankid, gam2, 0.0, 0.0, 0.0);
850 fprintf(pFile,
"INS %2uPRCF14%15.6f%15.6f%15.6f%15.6f\n", bankid, 0.0, 0.0, 0.0, 0.0);
851 fprintf(pFile,
"INS %2uPRCF15%15.6f%15.6f%15.6f%15.6f\n", bankid, 0.0, 0.0, 0.0, 0.0);
852 fprintf(pFile,
"INS %2uPRCF16%15.6f\n", bankid, 0.0);
853 fprintf(pFile,
"INS %2uPAB3 %3d\n", bankid, 90);
855 for (
size_t k = 0; k < 90; ++k) {
856 fprintf(pFile,
"INS %2uPAB3%2d%10.5f%10.5f%10.5f%10.5f\n", bankid,
static_cast<int>(k) + 1,
m_gdsp[k],
m_gdt[k],
859 fprintf(pFile,
"INS %2uPRCF2 %5i%5i%10.5f\n", bankid, -4, 27, 0.002);
860 fprintf(pFile,
"INS %2uPRCF21%15.6f%15.6f%15.6f%15.6f\n", bankid, 0.0, 0.0, 0.0, sig1);
861 fprintf(pFile,
"INS %2uPRCF22%15.6f%15.6f%15.6f%15.6f\n", bankid, sig2, gam2, 0.0, 0.0);
862 fprintf(pFile,
"INS %2uPRCF23%15.6f%15.6f%15.6f%15.6f\n", bankid, 0.0, 0.0, 0.0, 0.0);
863 fprintf(pFile,
"INS %2uPRCF24%15.6f%15.6f%15.6f%15.6f\n", bankid, 0.0, 0.0, 0.0, 0.0);
864 fprintf(pFile,
"INS %2uPRCF25%15.6f%15.6f%15.6f%15.6f\n", bankid, 0.0, 0.0, 0.0, 0.0);
865 fprintf(pFile,
"INS %2uPRCF26%15.6f%15.6f%15.6f%15.6f\n", bankid, 0.0, 0.0, 0.0, 0.0);
866 fprintf(pFile,
"INS %2uPRCF27%15.6f%15.6f%15.6f \n", bankid, 0.0, 0.0, 0.0);
868 fprintf(pFile,
"INS %2uPAB4 %3i\n", bankid, 90);
869 for (
size_t k = 0; k < 90; ++k) {
870 fprintf(pFile,
"INS %2uPAB4%2d%10.5f%10.5f%10.5f%10.5f\n", bankid,
static_cast<int>(k) + 1,
m_gdsp[k],
m_gdt[k],
874 fprintf(pFile,
"INS %2uPRCF3 %5i%5i%10.5f\n", bankid, -5, 21, 0.002);
875 fprintf(pFile,
"INS %2uPRCF31%15.6f%15.6f%15.6f%15.6f\n", bankid, 0.0, 0.0, 0.0, sig0);
876 fprintf(pFile,
"INS %2uPRCF32%15.6f%15.6f%15.6f%15.6f\n", bankid, sig1, sig2, gam0, gam1);
877 fprintf(pFile,
"INS %2uPRCF33%15.6f%15.6f%15.6f%15.6f\n", bankid, gam2, 0.0, 0.0, 0.0);
878 fprintf(pFile,
"INS %2uPRCF34%15.6f%15.6f%15.6f%15.6f\n", bankid, 0.0, 0.0, 0.0, 0.0);
879 fprintf(pFile,
"INS %2uPRCF35%15.6f%15.6f%15.6f%15.6f\n", bankid, 0.0, 0.0, 0.0, 0.0);
880 fprintf(pFile,
"INS %2uPRCF36%15.6f\n", bankid, 0.0);
882 fprintf(pFile,
"INS %2uPAB5 %3i\n", bankid,
884 for (
size_t k = 0; k < 90; k++) {
885 fprintf(pFile,
"INS %2uPAB5%2d%10.5f%10.5f%10.5f%10.5f\n", bankid,
static_cast<int>(k) + 1,
m_gdsp[k],
m_gdt[k],
897 double l2 =
difc / (252.816 * 2.0 * sin(0.5 * twotheta * M_PI / 180.0)) - L1;
898 g_log.
debug() <<
"DIFC = " <<
difc <<
", L1 = " << L1 <<
", 2Theta = " << twotheta <<
" ==> L2 = " <<
l2 <<
".\n";
920 double te = ep + (eq * dsp) + er * 0.5 *
erfc(((1.0 / dsp) - 1.05) * 10.0);
921 double tt =
tp + (tq * dsp) + (tr / dsp);
922 double t = (
n * te) + tt - (
n * tt);
932 double ea = ea1 + (ea2 * dsp);
933 double ta = ta1 - (ta2 / dsp);
934 double am1 = (
n * ea) + ta - (
n * ta);
935 double a = 1.0 / am1;
944 std::map<std::string, double>::const_iterator piter;
945 piter = profilemap.find(parname);
946 if (piter == profilemap.end()) {
948 errss <<
"Profile parameter map does not contain parameter" << parname <<
". ";
950 throw runtime_error(errss.str());
953 double value = piter->second;
962 const string ¶mname) {
963 auto piter = profilemap.find(paramname);
964 if (piter == profilemap.end()) {
966 errss <<
"Profile map does not contain parameter " << paramname <<
". Available parameters are ";
967 for (
const auto ¶meter : profilemap) {
968 errss << parameter.first <<
", ";
971 throw runtime_error(errss.str());
974 double value = piter->second;
987 double dsp = (tof - zero) / dtt1;
1002 g_log.
error(
"SaveGSASInstrumentFile requires DataHandling library for "
1003 "LoadFullprofResolution.");
1004 throw runtime_error(
"SaveGSASInstrumentFile requires DataHandling library "
1005 "for LoadFullprofResolution.");
1008 loadfpirf->setProperty(
"Filename", irffilename);
1009 loadfpirf->setProperty(
"OutputTableWorkspace",
"outputTableWorkspace");
1011 loadfpirf->execute();
1012 if (!loadfpirf->isExecuted())
1013 throw runtime_error(
"LoadFullprof cannot be executed. ");
1015 m_inpWS = loadfpirf->getProperty(
"OutputTableWorkspace");
1017 throw runtime_error(
"Failed to obtain a table workspace from "
1018 "LoadFullprofResolution's output.");
1025 double x =
fabs(xx);
1026 double t = 1.0 / (1.0 + (0.5 *
x));
1027 double ty = (0.27886807 + t * (-1.13520398 + t * (1.48851587 + t * (-0.82215223 + t * 0.17087277))));
1028 double tx = (1.00002368 + t * (0.37409196 + t * (0.09678418 + t * (-0.18628806 + t * ty))));
1029 double y = t * exp(-
x *
x - 1.26551223 + t * tx);
#define DECLARE_ALGORITHM(classname)
static std::unique_ptr< QThreadPool > tp
double value
The value of the point.
const std::vector< double > & m_L2
Base class from which all concrete algorithm classes should be derived.
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
std::string getPropertyValue(const std::string &name) const override
Get the value of a property as a string.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
virtual std::shared_ptr< Algorithm > createChildAlgorithm(const std::string &name, const double startProgress=-1., const double endProgress=-1., const bool enableLogging=true, const int &version=-1)
Create a Child Algorithm.
static bool isEmpty(const NumT toCheck)
checks that the value was not set by users, uses the value in empty double/int.
@ OptionalLoad
to specify a file to read but the file doesn't have to exist
@ Save
to specify a file to write to, the file may or may not exist
TableRow represents a row in a TableWorkspace.
size_t size() const
Returns the number of rows in the TableWorkspace.
A property class for workspaces.
ChopperConfiguration(vector< int > bankids)
Constructor.
std::vector< unsigned int > getBankIDs() const
Get bank IDs in configuration.
std::map< unsigned int, size_t > m_bankIDIndexMap
std::vector< double > m_mindsps
std::vector< double > m_maxdsps
double getParameter(unsigned int bankid, const std::string ¶mname) const
Get a parameter from a bank.
bool hasBank(unsigned int bankid) const
Check wehther a bank is defined.
std::vector< double > m_vecL2
std::vector< double > m_splitds
std::vector< double > m_vec2Theta
std::vector< double > m_vecCWL
std::vector< double > m_maxtofs
std::vector< int > m_vruns
std::vector< double > parseStringDbl(const std::string &instring) const
Parse string to a double vector.
std::vector< unsigned int > parseStringUnsignedInt(const std::string &instring) const
Parse string to an integer vector.
std::vector< unsigned int > m_bankIDs
void setParameter(unsigned int bankid, const std::string ¶mname, double value)
Set a parameter to a bank.
std::vector< double > m_vecL1
std::string parseString() const
SaveGSASInstrumentFile : Convert Fullprof"s instrument resolution file (.irf) to GSAS"s instrument f...
API::ITableWorkspace_sptr m_inpWS
Input workspace.
std::string m_sample
Sample.
double calDspRange(double dtt1, double zero, double tof)
Calcualte d-space value.
void buildGSASTabulatedProfile(const std::map< unsigned int, std::map< std::string, double > > &bankprofilemap, unsigned int bankid)
Build a data structure for GSAS's tabulated peak profile.
void convertToGSAS(const std::vector< unsigned int > &outputbankids, const std::string &gsasinstrfilename, const std::map< unsigned int, std::map< std::string, double > > &bankprofilemap)
Convert to GSAS instrument file.
int m_frequency
Frequency.
std::vector< double > m_gbeta
std::string m_gsasFileName
Output file name.
std::shared_ptr< ChopperConfiguration > m_configuration
Chopper configuration.
double getProfileParameterValue(const std::map< std::string, double > &profilemap, const std::string ¶mname)
Get parameter value from class storage.
double aaba(double n, double ea1, double ea2, double ta1, double ta2, double dsp)
Calculate a value related to (alph0, alph1, alph0t, alph1t) or (beta0, beta1, beta0t,...
std::shared_ptr< ChopperConfiguration > setupInstrumentConstants(const std::map< unsigned int, std::map< std::string, double > > &profmap)
Set up chopper/instrument constant parameters from profile map.
double calL2FromDtt1(double difc, double L1, double twotheta)
Caclualte L2 from DIFFC and L1.
double calTOF(double n, double ep, double eq, double er, double tp, double tq, double tr, double dsp)
Calculate TOF difference.
std::map< unsigned int, double > m_bank_mndsp
void processProperties()
Process properties.
std::vector< double > m_gdsp
SaveGSASInstrumentFile()
Constructor.
void initConstants(const std::map< unsigned int, std::map< std::string, double > > &profmap)
Set up some constant by default.
double erfc(double xx)
Complementary error function.
std::map< unsigned int, double > m_bank_mxtof
void init() override
Initialisation code.
void loadFullprofResolutionFile(const std::string &irffilename)
Load fullprof resolution file.
std::vector< unsigned int > m_vecBankID2File
Banks IDs to process.
std::vector< double > m_galpha
std::shared_ptr< ChopperConfiguration > setupPG3Constants(int intfrequency)
Set up for PG3 chopper constants.
void parseProfileTableWorkspace(const API::ITableWorkspace_sptr &ws, std::map< unsigned int, std::map< std::string, double > > &profilemap)
Parse profile table workspace to a map.
void writePRMSingleBank(const std::map< unsigned int, std::map< std::string, double > > &bankprofilemap, unsigned int bankid, const std::string &prmfilename)
Write out .prm/.iparm file.
double getValueFromMap(const std::map< std::string, double > &profilemap, const std::string &parname)
Get parameter value from a map.
std::string m_id_line
User input ID line.
std::shared_ptr< ChopperConfiguration > setupNOMConstants(int intfrequency)
Set up for NOM chopper constants.
void exec() override
Execution code.
std::string m_instrument
Instrument.
void writePRMHeader(const std::vector< unsigned int > &banks, const std::string &prmfilename)
Write the header of the file.
std::vector< double > m_gdt
Support for a property that holds an array of values.
BoundedValidator is a validator that requires the values to be between upper or lower bounds,...
Exception for when an item is not found in a collection.
void debug(const std::string &msg)
Logs at debug level.
void error(const std::string &msg)
Logs at error level.
void information(const std::string &msg)
Logs at information level.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
std::shared_ptr< IAlgorithm > IAlgorithm_sptr
shared pointer to Mantid::API::IAlgorithm
std::shared_ptr< ITableWorkspace > ITableWorkspace_sptr
shared pointer to Mantid::API::ITableWorkspace
std::shared_ptr< ChopperConfiguration > ChopperConfiguration_sptr
Helper class which provides the Collimation Length for SANS instruments.
constexpr double EMPTY_DBL() noexcept
Returns what we consider an "empty" double within a property.
@ Input
An input workspace.