Commit 848f6fbc authored by Lynch, Vickie's avatar Lynch, Vickie
Browse files

Refs #22420 more changes

parent 1373750f
......@@ -48,6 +48,7 @@ private:
double &ysize);
bool bankMasked(Geometry::IComponent_const_sptr parent,
const Geometry::DetectorInfo &detectorInfo);
void writeOffsets(std::ofstream &out, double qSign, std::vector<double> offset);
Geometry::Instrument_const_sptr inst;
};
......
......@@ -97,12 +97,17 @@ void IndexPeakswithSatellites::init() {
make_unique<PropertyWithValue<double>>("SatelliteError", 0.0,
Direction::Output),
"Gets set with the average HKL indexing error of Satellite Peaks.");
declareProperty(make_unique<PropertyWithValue<bool>>(
"CrossTerms", false, Direction::Input),
"Include cross terms (false)");
}
/** Execute the algorithm.
*/
void IndexPeakswithSatellites::exec() {
bool CrossTerms = false;
bool crossTerms = getProperty("CrossTerms");
PeaksWorkspace_sptr ws = getProperty("PeaksWorkspace");
if (!ws) {
throw std::runtime_error("Could not read the peaks workspace");
......@@ -170,11 +175,10 @@ void IndexPeakswithSatellites::exec() {
// index the peaks for each run separately, using a UB matrix optimized for
// that run
for (size_t run_index = 0; run_index < run_numbers.size(); run_index++) {
for (int run : run_numbers) {
std::vector<V3D> miller_indices;
std::vector<V3D> q_vectors;
int run = run_numbers[run_index];
for (size_t i = 0; i < n_peaks; i++) {
if (peaks[i].getRunNumber() == run)
q_vectors.push_back(peaks[i].getQSampleFrame());
......@@ -268,7 +272,7 @@ void IndexPeakswithSatellites::exec() {
k_error = fabs(round(hkl[1]) - hkl[1]);
l_error = fabs(round(hkl[2]) - hkl[2]);
main_error += h_error + k_error + l_error;
} else if (!CrossTerms) {
} else if (!crossTerms) {
for (int order = -maxOrder; order <= maxOrder; order++) {
if (order == 0)
continue; // exclude order 0
......@@ -368,6 +372,8 @@ void IndexPeakswithSatellites::exec() {
<< main_error << '\n';
g_log.notice() << "Average error in h,k,l for indexed satellite peaks = "
<< satellite_error << '\n';
// Show the lattice parameters
g_log.notice() << o_lattice << "\n";
// Save output properties
setProperty("TotalNumIndexed", total_indexed);
......@@ -375,8 +381,6 @@ void IndexPeakswithSatellites::exec() {
setProperty("SateNumIndexed", sate_indexed);
setProperty("MainError", main_error);
setProperty("SatelliteError", satellite_error);
// Show the lattice parameters
g_log.notice() << o_lattice << "\n";
}
} // namespace Mantid
......
......@@ -379,9 +379,7 @@ DataObjects::Peak LoadIsawPeaks::readPeak(PeaksWorkspace_sptr outWS,
Peak peak(outWS->getInstrument(), pixelID, wl);
peak.setHKL(h, k, l);
peak.setIntHKL(intHKL);
if (m_isModulatedStructure) {
peak.setIntMNP(mod);
}
peak.setIntMNP(mod);
peak.setIntensity(Inti);
peak.setSigmaIntensity(SigI);
peak.setBinCount(IPK);
......@@ -495,7 +493,7 @@ void LoadIsawPeaks::appendFile(PeaksWorkspace_sptr outWS,
// Read the header, load the instrument
double T0;
std::string s = readHeader(outWS, in, T0, qSign);
auto s = readHeader(outWS, in, T0, qSign);
// set T0 in the run parameters
API::Run &m_run = outWS->mutableRun();
m_run.addProperty<double>("T0", T0, true);
......
......@@ -279,24 +279,11 @@ void SaveIsawPeaks::exec() {
offset2 = run.getPropertyValueAsType<std::vector<double>>("Offset2");
offset3 = run.getPropertyValueAsType<std::vector<double>>("Offset3");
out << "9 MODVECTOR ";
out << std::setw(12) << std::fixed << std::setprecision(6)
<< qSign * offset1[0] << " ";
out << std::setw(12) << std::fixed << std::setprecision(6)
<< qSign * offset1[1] << " ";
out << std::setw(12) << std::fixed << std::setprecision(6)
<< qSign * offset1[2] << " ";
out << std::setw(12) << std::fixed << std::setprecision(6)
<< qSign * offset2[0] << " ";
out << std::setw(12) << std::fixed << std::setprecision(6)
<< qSign * offset2[1] << " ";
out << std::setw(12) << std::fixed << std::setprecision(6)
<< qSign * offset2[2] << " ";
out << std::setw(12) << std::fixed << std::setprecision(6)
<< qSign * offset3[0] << " ";
out << std::setw(12) << std::fixed << std::setprecision(6)
<< qSign * offset3[1] << " ";
out << std::setw(12) << std::fixed << std::setprecision(6)
<< qSign * offset3[2] << "\n";
writeOffsets(out, qSign, offset1);
writeOffsets(out, qSign, offset2);
writeOffsets(out, qSign, offset3);
out << "\n";
}
int maxPeakNumb = 0;
int appendPeakNumb = 0;
......@@ -550,6 +537,11 @@ void SaveIsawPeaks::sizeBanks(std::string bankName, int &NCOLS, int &NROWS,
ysize = first->getDistance(*last);
}
}
void SaveIsawPeaks::writeOffsets(std::ofstream &out, double qSign, std::vector<double> offset) {
for (size_t i = 0; i < 3; i++) {
out << std::setw(12) << std::fixed << std::setprecision(6)
<< qSign * offset[i] << " ";
}
}
} // namespace Crystal
} // namespace Mantid
......@@ -154,7 +154,7 @@ public:
void setCol(int m_col);
void setPeakNumber(int m_peakNumber) override;
int getPeakNumber() const override;
void setIntMNP(const Mantid::Kernel::V3D m_modStru) override;
void setIntMNP(const Mantid::Kernel::V3D modulatedStructure) override;
Mantid::Kernel::V3D getIntMNP() const override;
virtual Mantid::Kernel::V3D getDetPos() const override;
......@@ -251,7 +251,7 @@ private:
// keep peak number
int m_peakNumber;
Mantid::Kernel::V3D m_modStru;
Mantid::Kernel::V3D m_modulatedStructure;
/// integer HKL of the peak
std::array<int, 3> m_intHKL;
......
......@@ -30,7 +30,7 @@ Peak::Peak()
m_finalEnergy(0.), m_GoniometerMatrix(3, 3, true),
m_InverseGoniometerMatrix(3, 3, true), m_runNumber(0), m_monitorCount(0),
m_row(-1), m_col(-1), m_orig_H(0), m_orig_K(0), m_orig_L(0),
m_peakNumber(0), m_modStru(V3D(0, 0, 0)), m_intHKL{ {0, 0, 0} },
m_peakNumber(0), m_modulatedStructure(V3D(0, 0, 0)), m_intHKL{ {0, 0, 0} },
m_peakShape(boost::make_shared<NoShape>()) {
convention = Kernel::ConfigService::Instance().getString("Q.convention");
}
......@@ -52,7 +52,7 @@ Peak::Peak(const Geometry::Instrument_const_sptr &m_inst,
m_binCount(0), m_GoniometerMatrix(3, 3, true),
m_InverseGoniometerMatrix(3, 3, true), m_runNumber(0), m_monitorCount(0),
m_orig_H(0), m_orig_K(0), m_orig_L(0), m_peakNumber(0),
m_modStru(V3D(0, 0, 0)), m_intHKL{ {0, 0, 0} },
m_modulatedStructure(V3D(0, 0, 0)), m_intHKL{ {0, 0, 0} },
m_peakShape(boost::make_shared<NoShape>()) {
convention = Kernel::ConfigService::Instance().getString("Q.convention");
this->setInstrument(m_inst);
......@@ -80,7 +80,7 @@ Peak::Peak(const Geometry::Instrument_const_sptr &m_inst,
m_binCount(0), m_GoniometerMatrix(goniometer),
m_InverseGoniometerMatrix(goniometer), m_runNumber(0), m_monitorCount(0),
m_orig_H(0), m_orig_K(0), m_orig_L(0), m_peakNumber(0),
m_modStru(V3D(0, 0, 0)), m_intHKL{ {0, 0, 0} },
m_modulatedStructure(V3D(0, 0, 0)), m_intHKL{ {0, 0, 0} },
m_peakShape(boost::make_shared<NoShape>()) {
convention = Kernel::ConfigService::Instance().getString("Q.convention");
if (fabs(m_InverseGoniometerMatrix.Invert()) < 1e-8)
......@@ -104,7 +104,7 @@ Peak::Peak(const Geometry::Instrument_const_sptr &m_inst, int m_detectorID,
m_binCount(0), m_GoniometerMatrix(3, 3, true),
m_InverseGoniometerMatrix(3, 3, true), m_runNumber(0), m_monitorCount(0),
m_orig_H(0), m_orig_K(0), m_orig_L(0), m_peakNumber(0),
m_modStru(V3D(0, 0, 0)), m_intHKL{ {0, 0, 0} },
m_modulatedStructure(V3D(0, 0, 0)), m_intHKL{ {0, 0, 0} },
m_peakShape(boost::make_shared<NoShape>()) {
convention = Kernel::ConfigService::Instance().getString("Q.convention");
this->setInstrument(m_inst);
......@@ -127,7 +127,7 @@ Peak::Peak(const Geometry::Instrument_const_sptr &m_inst, int m_detectorID,
m_sigmaIntensity(0), m_binCount(0), m_GoniometerMatrix(3, 3, true),
m_InverseGoniometerMatrix(3, 3, true), m_runNumber(0), m_monitorCount(0),
m_orig_H(0), m_orig_K(0), m_orig_L(0), m_peakNumber(0),
m_modStru(V3D(0, 0, 0)), m_intHKL{ {0, 0, 0} },
m_modulatedStructure(V3D(0, 0, 0)), m_intHKL{ {0, 0, 0} },
m_peakShape(boost::make_shared<NoShape>()) {
convention = Kernel::ConfigService::Instance().getString("Q.convention");
this->setInstrument(m_inst);
......@@ -152,7 +152,7 @@ Peak::Peak(const Geometry::Instrument_const_sptr &m_inst, int m_detectorID,
m_sigmaIntensity(0), m_binCount(0), m_GoniometerMatrix(goniometer),
m_InverseGoniometerMatrix(goniometer), m_runNumber(0), m_monitorCount(0),
m_orig_H(0), m_orig_K(0), m_orig_L(0), m_peakNumber(0),
m_modStru(V3D(0, 0, 0)), m_intHKL{ {0, 0, 0} },
m_modulatedStructure(V3D(0, 0, 0)), m_intHKL{ {0, 0, 0} },
m_peakShape(boost::make_shared<NoShape>()) {
convention = Kernel::ConfigService::Instance().getString("Q.convention");
if (fabs(m_InverseGoniometerMatrix.Invert()) < 1e-8)
......@@ -176,7 +176,7 @@ Peak::Peak(const Geometry::Instrument_const_sptr &m_inst, double scattering,
m_binCount(0), m_GoniometerMatrix(3, 3, true),
m_InverseGoniometerMatrix(3, 3, true), m_runNumber(0), m_monitorCount(0),
m_row(-1), m_col(-1), m_orig_H(0), m_orig_K(0), m_orig_L(0),
m_peakNumber(0), m_modStru(V3D(0, 0, 0)), m_intHKL{ {0, 0, 0} },
m_peakNumber(0), m_modulatedStructure(V3D(0, 0, 0)), m_intHKL{ {0, 0, 0} },
m_peakShape(boost::make_shared<NoShape>()) {
convention = Kernel::ConfigService::Instance().getString("Q.convention");
this->setInstrument(m_inst);
......@@ -206,7 +206,7 @@ Peak::Peak(const Peak &other)
samplePos(other.samplePos), detPos(other.detPos),
m_orig_H(other.m_orig_H), m_orig_K(other.m_orig_K),
m_orig_L(other.m_orig_L), m_peakNumber(other.m_peakNumber),
m_modStru(other.m_modStru), m_intHKL(other.m_intHKL),
m_modulatedStructure(other.m_modulatedStructure), m_intHKL(other.m_intHKL),
m_detIDs(other.m_detIDs),
m_peakShape(other.m_peakShape->clone()), convention(other.convention) {}
......@@ -228,7 +228,7 @@ Peak::Peak(const Geometry::IPeak &ipeak)
m_runNumber(ipeak.getRunNumber()),
m_monitorCount(ipeak.getMonitorCount()), m_row(ipeak.getRow()),
m_col(ipeak.getCol()), m_orig_H(0.), m_orig_K(0.), m_orig_L(0.),
m_peakNumber(ipeak.getPeakNumber()), m_modStru(ipeak.getIntMNP()),
m_peakNumber(ipeak.getPeakNumber()), m_modulatedStructure(ipeak.getIntMNP()),
m_intHKL{ {static_cast<int>(ipeak.getIntHKL()[0]), static_cast<int>(ipeak.getIntHKL()[1]), static_cast<int>(ipeak.getIntHKL()[2])} },
m_peakShape(boost::make_shared<NoShape>()) {
convention = Kernel::ConfigService::Instance().getString("Q.convention");
......@@ -920,7 +920,7 @@ int Peak::getPeakNumber() const { return m_peakNumber; }
// -------------------------------------------------------------------------------------
/**Returns the unique peak number
* Returns -1 if it could not find it. */
V3D Peak::getIntMNP() const { return m_modStru; }
V3D Peak::getIntMNP() const { return m_modulatedStructure; }
// -------------------------------------------------------------------------------------
/** For RectangularDetectors only, sets the row (y) of the pixel of the
......@@ -943,8 +943,8 @@ void Peak::setPeakNumber(int m_peakNumber) {
// -------------------------------------------------------------------------------------
/** Sets the modulated peak structure number
* @param m_modStru :: modulated peak structure value */
void Peak::setIntMNP(V3D m_modStru) { this->m_modStru = m_modStru; }
* @param m_modulatedStructure :: modulated peak structure value */
void Peak::setIntMNP(V3D modulatedStructure) { this->m_modulatedStructure = modulatedStructure; }
// -------------------------------------------------------------------------------------
/** Return the detector position vector */
......
Supports Markdown
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