Commit f157ce38 authored by Peterson, Peter's avatar Peterson, Peter
Browse files

Merge remote-tracking branches 'upstream/release-next' and 'upstream/ornl-next'

......@@ -116,10 +116,9 @@ void ProcessBankData::run() { // override {
// Will we need to compress?
const bool compress = (alg->compressTolerance >= 0);
// Which detector IDs were touched? - only matters if compress is on
// Which detector IDs were touched?
std::vector<bool> usedDetIds;
if (compress)
usedDetIds.assign(m_max_id - m_min_id + 1, false);
usedDetIds.assign(m_max_id - m_min_id + 1, false);
const double TOF_MIN = alg->filter_tof_min;
const double TOF_MAX = alg->filter_tof_max;
......@@ -190,10 +189,8 @@ void ProcessBankData::run() { // override {
} else
badTofs++;
// Track all the touched wi (only necessary when compressing events,
// for thread safety)
if (compress)
usedDetIds[detId - m_min_id] = true;
// Track all the touched wi
usedDetIds[detId - m_min_id] = true;
} // valid time-of-flight
} // valid detector IDs
......@@ -210,11 +207,12 @@ void ProcessBankData::run() { // override {
//------------ Compress Events (or set sort order) ------------------
// Do it on all the detector IDs we touched
if (compress) {
for (detid_t pixID = m_min_id; pixID <= m_max_id; ++pixID) {
if (usedDetIds[pixID - m_min_id]) {
// Find the the workspace index corresponding to that pixel ID
size_t wi = getWorkspaceIndexFromPixelID(pixID);
const size_t numEventLists = outputWS.getNumberHistograms();
for (detid_t pixID = m_min_id; pixID <= m_max_id; ++pixID) {
if (usedDetIds[pixID - m_min_id]) {
// Find the the workspace index corresponding to that pixel ID
size_t wi = getWorkspaceIndexFromPixelID(pixID);
if (wi < numEventLists) {
auto &el = outputWS.getSpectrum(wi);
if (compress)
el.compressEvents(alg->compressTolerance, &el);
......
......@@ -181,6 +181,19 @@ private:
TS_ASSERT_EQUALS("2010-Mar-25 16:11:51.558003540", filteredLogEndTime.toSimpleString());
}
void validate_pulse_time_sorting(EventWorkspace_sptr eventWS) {
for (size_t i = 0; i < eventWS->getNumberHistograms(); i++) {
auto eventList = eventWS->getSpectrum(i);
if (eventList.getSortType() == DataObjects::PULSETIME_SORT) {
std::vector<DateAndTime> pulsetimes;
for (auto &event : eventList.getEvents()) {
pulsetimes.emplace_back(event.pulseTime());
}
TS_ASSERT(std::is_sorted(pulsetimes.cbegin(), pulsetimes.cend()));
}
}
}
public:
void test_load_event_nexus_v20_ess() {
const std::string file = "V20_ESS_example.nxs";
......@@ -219,6 +232,8 @@ public:
TS_ASSERT_EQUALS(eventWS->getNumberEvents(), 1439);
TS_ASSERT_EQUALS(eventWS->detectorInfo().size(),
(150 * 150) + 2) // Two monitors
validate_pulse_time_sorting(eventWS);
}
void test_load_event_nexus_v20_ess_integration_2018() {
......@@ -241,6 +256,8 @@ public:
(300 * 300) + 2) // Two monitors
TS_ASSERT_DELTA(eventWS->getTofMin(), 9.815, 1.0e-3);
TS_ASSERT_DELTA(eventWS->getTofMax(), 130748.563, 1.0e-3);
validate_pulse_time_sorting(eventWS);
}
}
......
......@@ -38,6 +38,7 @@ Bugfixes
- :ref:`LoadNexusLogs <algm-LoadNexusLogs>` now creates a warning message for logs that are poorly formed and the other logs are loaded. Previously it stopped loading logs at that point.
- Fixed a bug where :ref:`LoadRaw <algm-LoadRaw>` would not load all log files for raw files with an alternate data stream.
- Fixed a problem calculating default beam size in :ref:`MonteCarloAbsorption <algm-MonteCarloAbsorption>` when sample is offset from origin.
- Fixed a problem with sorting of events in :ref:`LoadEventNexus <algm-LoadEventNexus>` that was causing :ref:`FilterByTime <algm-FilterByTime>` to give incorrect results
Fit Functions
-------------
......
......@@ -32,6 +32,7 @@ Bugfixes
- In frequency domain analysis the phasetables calculated from :ref:`MuonMaxent <algm-MuonMaxent>` can be used for
:ref:`PhaseQuad <algm-PhaseQuad>` calculations on the phase tab.
- A bug has been fixed in ALC that caused mantid to crash when a user changed the PeakPicker in the PeakFitting plot.
- A bug has been fixed in ALC where setting an invalid function would cause a crash.
Muon Analysis
-------------
......
......@@ -1903,22 +1903,28 @@ void FunctionTreeView::attributeChanged(QtProperty *prop) {
// Some attributes require the function to be fully reconstructed, in this
// case we'd need to emit a function replaced signal. If its not one of these
// attributes emit an attributeValueChanged signal.
if (std::find(REQUIRESRECONSTRUCTIONATTRIBUTES.begin(), REQUIRESRECONSTRUCTIONATTRIBUTES.end(),
removePrefix(attributeName)) != REQUIRESRECONSTRUCTIONATTRIBUTES.end()) {
auto funProp = m_properties[prop].parent;
if (!funProp)
return;
auto fun = getFunction(funProp, true);
// delete and recreate all function's properties (attributes, parameters,
// etc)
setFunction(funProp, fun);
updateFunctionIndices();
if (m_emitAttributeValueChange)
emit functionReplaced(QString::fromStdString(getFunction()->asString()));
} else {
if (m_emitAttributeValueChange)
emit attributePropertyChanged(attributeName);
try {
if (std::find(REQUIRESRECONSTRUCTIONATTRIBUTES.begin(), REQUIRESRECONSTRUCTIONATTRIBUTES.end(),
removePrefix(attributeName)) != REQUIRESRECONSTRUCTIONATTRIBUTES.end()) {
auto funProp = m_properties[prop].parent;
if (!funProp)
return;
auto fun = getFunction(funProp, true);
// delete and recreate all function's properties (attributes, parameters,
// etc)
setFunction(funProp, fun);
updateFunctionIndices();
if (m_emitAttributeValueChange) {
emit functionReplaced(QString::fromStdString(getFunction()->asString()));
}
} else {
if (m_emitAttributeValueChange) {
emit attributePropertyChanged(attributeName);
}
}
} catch (std::exception &expt) {
QMessageBox::critical(this, "Mantid - Error", QString::fromStdString(expt.what()));
}
}
......
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