Commit 107e7fea authored by mantid-builder's avatar mantid-builder
Browse files

Merge remote-tracking branch 'origin/release-next'

parents 8b091ee4 f9c6ff0c
......@@ -90,6 +90,7 @@ public:
bool isDetector(const size_t componentIndex) const {
return componentIndex < m_assemblySortedDetectorIndices->size();
}
bool isMonitor(const size_t componentIndex) const;
size_t compOffsetIndex(const size_t componentIndex) const {
return componentIndex - m_assemblySortedDetectorIndices->size();
}
......
......@@ -162,6 +162,13 @@ size_t ComponentInfo::numberOfDetectorsInSubtree(const size_t componentIndex) co
return std::distance(range.begin(), range.end());
}
bool ComponentInfo::isMonitor(const size_t componentIndex) const {
if (hasDetectorInfo()) {
return this->m_detectorInfo->isMonitor(componentIndex);
}
return false;
}
const Eigen::Vector3d &ComponentInfo::position(const size_t componentIndex) const {
checkNoTimeDependence();
if (isDetector(componentIndex)) {
......
......@@ -49,14 +49,15 @@ private:
/// Shapes for each component
std::shared_ptr<std::vector<std::shared_ptr<const Geometry::IObject>>> m_shapes;
BoundingBox componentBoundingBox(const size_t index, const BoundingBox *reference) const;
BoundingBox componentBoundingBox(const size_t index, const BoundingBox *reference,
const bool excludeMonitors = false) const;
/// Private copy constructor. Do not make public.
ComponentInfo(const ComponentInfo &other);
void growBoundingBoxAsRectuangularBank(size_t index, const Geometry::BoundingBox *reference,
Geometry::BoundingBox &mutableBB) const;
void growBoundingBoxAsOutline(size_t index, const Geometry::BoundingBox *reference,
Geometry::BoundingBox &mutableBB) const;
Geometry::BoundingBox &mutableBB, const bool excludeMonitors = false) const;
void growBoundingBoxAsOutline(size_t index, const Geometry::BoundingBox *reference, Geometry::BoundingBox &mutableBB,
const bool excludeMonitors = false) const;
public:
struct QuadrilateralComponent {
......@@ -121,7 +122,8 @@ public:
const Geometry::IObject &shape(const size_t componentIndex) const;
double solidAngle(const size_t componentIndex, const Kernel::V3D &observer) const;
BoundingBox boundingBox(const size_t componentIndex, const BoundingBox *reference = nullptr) const;
BoundingBox boundingBox(const size_t componentIndex, const BoundingBox *reference = nullptr,
const bool excludeMonitors = false) const;
Beamline::ComponentType componentType(const size_t componentIndex) const;
void setScanInterval(const std::pair<Types::Core::DateAndTime, Types::Core::DateAndTime> &interval);
size_t scanCount() const;
......
......@@ -279,15 +279,17 @@ double ComponentInfo::solidAngle(const size_t componentIndex, const Kernel::V3D
* @param index : Index of the component to get the bounding box for
* @param reference : Reference bounding box (optional)
* @param mutableBB : Output bounding box. This will be grown.
* @param excludeMonitors : Optional flag to exclude monitors and choppers
*/
void ComponentInfo::growBoundingBoxAsRectuangularBank(size_t index, const Geometry::BoundingBox *reference,
Geometry::BoundingBox &mutableBB) const {
Geometry::BoundingBox &mutableBB,
const bool excludeMonitors) const {
auto panel = quadrilateralComponent(index);
mutableBB.grow(componentBoundingBox(panel.bottomLeft, reference));
mutableBB.grow(componentBoundingBox(panel.topRight, reference));
mutableBB.grow(componentBoundingBox(panel.topLeft, reference));
mutableBB.grow(componentBoundingBox(panel.bottomRight, reference));
mutableBB.grow(componentBoundingBox(panel.bottomLeft, reference, excludeMonitors));
mutableBB.grow(componentBoundingBox(panel.topRight, reference, excludeMonitors));
mutableBB.grow(componentBoundingBox(panel.topLeft, reference, excludeMonitors));
mutableBB.grow(componentBoundingBox(panel.bottomRight, reference, excludeMonitors));
}
/**
......@@ -298,9 +300,11 @@ void ComponentInfo::growBoundingBoxAsRectuangularBank(size_t index, const Geomet
* @param index : Index of the component to get the bounding box for
* @param reference : Reference bounding box (optional)
* @param mutableBB : Output bounding box. This will be grown.
* @param excludeMonitors : Optional flag to exclude monitors and choppers
*/
void ComponentInfo::growBoundingBoxAsOutline(size_t index, const BoundingBox *reference, BoundingBox &mutableBB) const {
mutableBB.grow(componentBoundingBox(index, reference));
void ComponentInfo::growBoundingBoxAsOutline(size_t index, const BoundingBox *reference, BoundingBox &mutableBB,
const bool excludeMonitors) const {
mutableBB.grow(componentBoundingBox(index, reference, excludeMonitors));
}
/**
......@@ -309,13 +313,25 @@ void ComponentInfo::growBoundingBoxAsOutline(size_t index, const BoundingBox *re
* @param index : Component index
* @param reference : Optional reference for coordinate system for non-axis
*aligned bounding boxes
* @param excludeMonitors : Optional flag to exclude monitor and choppers
* @return Absolute bounding box.
*/
BoundingBox ComponentInfo::componentBoundingBox(const size_t index, const BoundingBox *reference) const {
BoundingBox ComponentInfo::componentBoundingBox(const size_t index, const BoundingBox *reference,
const bool excludeMonitors) const {
// Check that we have a valid shape here
if (componentType(index) == Beamline::ComponentType::Infinite) {
return BoundingBox(); // Return null bounding box
}
if (excludeMonitors) {
// skip monitors
if (isDetector(index) && m_componentInfo->isMonitor(index)) {
return BoundingBox();
}
// skip other components such as choppers, etc
if (componentType(index) == Beamline::ComponentType::Generic) {
return BoundingBox();
}
}
if (!hasValidShape(index)) {
return BoundingBox(this->position(index).X(), this->position(index).Y(), this->position(index).Z(),
this->position(index).X(), this->position(index).Y(), this->position(index).Z());
......@@ -366,11 +382,13 @@ BoundingBox ComponentInfo::componentBoundingBox(const size_t index, const Boundi
* @param componentIndex : Component index to get the bounding box for
* @param reference : Optional reference for coordinate system for non-axis
*aligned bounding boxes
* @param excludeMonitors : Optional flag to exclude monitors and choppers
* @return Absolute bounding box
*/
BoundingBox ComponentInfo::boundingBox(const size_t componentIndex, const BoundingBox *reference) const {
BoundingBox ComponentInfo::boundingBox(const size_t componentIndex, const BoundingBox *reference,
const bool excludeMonitors) const {
if (isDetector(componentIndex) || componentType(componentIndex) == Beamline::ComponentType::Infinite) {
return componentBoundingBox(componentIndex, reference);
return componentBoundingBox(componentIndex, reference, excludeMonitors);
}
BoundingBox absoluteBB;
......@@ -385,20 +403,20 @@ BoundingBox ComponentInfo::boundingBox(const size_t componentIndex, const Boundi
// box calculations.
} else if (compFlag == Beamline::ComponentType::Unstructured) {
for (const auto &childIndex : this->children(componentIndex)) {
absoluteBB.grow(boundingBox(childIndex, reference));
absoluteBB.grow(boundingBox(childIndex, reference, excludeMonitors));
}
} else if (compFlag == Beamline::ComponentType::Grid) {
for (const auto &childIndex : this->children(componentIndex)) {
growBoundingBoxAsRectuangularBank(childIndex, reference, absoluteBB);
growBoundingBoxAsRectuangularBank(childIndex, reference, absoluteBB, excludeMonitors);
}
} else if (compFlag == Beamline::ComponentType::Rectangular || compFlag == Beamline::ComponentType::Structured ||
parentFlag == Beamline::ComponentType::Grid) {
growBoundingBoxAsRectuangularBank(componentIndex, reference, absoluteBB);
growBoundingBoxAsRectuangularBank(componentIndex, reference, absoluteBB, excludeMonitors);
} else if (compFlag == Beamline::ComponentType::OutlineComposite) {
growBoundingBoxAsOutline(componentIndex, reference, absoluteBB);
growBoundingBoxAsOutline(componentIndex, reference, absoluteBB, excludeMonitors);
} else {
// General case
absoluteBB.grow(componentBoundingBox(componentIndex, reference));
absoluteBB.grow(componentBoundingBox(componentIndex, reference, excludeMonitors));
}
return absoluteBB;
}
......
......@@ -41,6 +41,7 @@ Bug Fixes
- A bug has been fixed in Indirect data analysis on the F(Q)Fit tab, Multiple Input tab that allowed duplicate spectra to be added.
- A bug has been fixed that stopped additional spectra being added to Indirect Data Analysis if spectra from that workspace had already been added.
- :ref:`IndirectILLEnertyTransfer <algm-IndirectILLEnertyTransfer>` will now perform the monitor normalisation correctly; that is, in wavelength instead of energy. It will also provide the monitor workspace as a diagnostic output, if requested.
- A bug has been fixed in Indirect Data Analysis that limited the integration range on the tabs to between -1 and 1.
:ref:`Release 6.2.0 <v6.2.0>`
......@@ -30,6 +30,7 @@ New and Improved
- Added help button to the sliceviewer
- SliceViewer can toggle between different scales again without any issue.
- SliceViewer uses a more visible divider between the main data view and the peaks table view.
- SliceViewer now loads customized colormap from the colorbar directory upon starting.
Bugfixes
--------
......@@ -54,6 +55,7 @@ Bugfixes
- Fixed the help icon not showing on OSX and high-resolution monitors.
- Tabbing between fields in the error reporter now works as expected, rather than jumping to a random place each time.
- Fixed the advanced plotting dialog incorrectly laying out, causing the options to be partially occluded.
- Fixed a bug in the Instrument Viewer causing the projection to not be updated when different axis views were selected in Full 3D.
:ref:`Release 6.2.0 <v6.2.0>`
......@@ -82,6 +82,7 @@ Bugfixes
- A bug has been fixed in the BinWidth for the :ref:`DynamicKobuToyabe <func-DynamicKuboToyabe>` Fitting Function which caused a crash and did not provide
any information about why the value was invalid. It will now revert to last viable BinWidth used and explain why.
- The autoscale option when ``All`` is selected will now show the largest and smallest y value for all of the plots.
- The global parameters in a results table will no longer be given a zero error arbitrarily if one with an error exists.
ALC
---
......
......@@ -5,10 +5,6 @@ Reflectometry Changes
.. contents:: Table of Contents
:local:
.. warning:: **Developers:** Sort changes under appropriate heading
putting new features at the top of the section, followed by
improvements, followed by bug fixes.
Reflectometry
-------------
......@@ -16,8 +12,8 @@ Improvements
############
- :ref:`LRSubtractAverageBackground <algm-LRSubtractAverageBackground-v1>` now optionally uses weighted error for background with new input property ErrorWeighting.
- :ref:`LiquidsReflectometryReduction <algm-LiquidsReflectometryReduction-v1>` now optionally uses weighted error for background with new input property ErrorWeighting with the default as False.
- Version 2 of :ref:`ConvertToReflectometryQ <algm-ConvertToReflectometryQ>` has been added which assumes detectors are at :math:`2\theta` rather than :math:`\theta_f`. Use version 1 if you require detectors at :math:`\theta_f`.
- The detectors positions in the INTER IDF were changed from theta to two theta.
:ref:`Release 6.2.0 <v6.2.0>`
0 172 252
0 172 252
0 168 252
0 164 252
0 160 252
0 156 252
0 152 252
0 152 252
0 148 252
0 144 252
0 140 252
0 136 252
0 132 252
0 132 252
0 128 252
0 124 252
0 120 252
0 116 252
0 112 252
0 112 252
0 108 252
0 104 252
0 100 252
0 96 252
0 92 252
0 92 252
0 88 252
0 84 252
0 80 252
0 76 252
0 72 252
0 68 252
0 64 252
0 60 252
0 56 252
0 52 252
0 48 252
0 44 252
0 40 252
0 36 252
0 32 252
0 28 252
0 24 252
0 20 252
0 16 252
0 12 252
0 8 252
0 4 252
0 4 252
4 4 248
4 4 248
8 4 244
8 8 240
12 8 240
12 8 236
16 8 232
16 12 232
20 12 228
20 12 224
24 12 224
24 16 220
28 16 216
28 16 216
32 16 212
32 20 212
36 20 208
36 20 204
40 20 204
40 24 200
44 24 196
44 24 196
48 24 192
48 24 188
52 28 188
52 28 184
56 28 180
56 28 180
60 32 176
60 32 172
64 32 172
64 32 168
68 36 168
68 36 164
72 36 160
72 36 160
76 40 156
76 40 152
80 40 152
80 40 148
84 44 144
84 44 144
88 44 140
88 44 136
92 48 136
92 48 132
96 48 128
100 48 128
100 48 124
104 52 124
104 52 120
108 52 116
108 52 116
112 56 112
112 56 108
116 56 108
116 56 104
120 60 100
120 60 100
124 60 96
124 60 92
128 64 92
128 64 88
132 64 88
132 64 84
136 68 80
136 68 80
140 68 76
140 68 72
144 72 72
144 72 68
148 72 64
148 72 64
152 72 60
152 76 56
156 76 56
156 76 52
160 76 48
160 80 48
164 80 44
164 80 44
168 80 40
168 84 36
172 84 36
172 84 32
176 84 28
176 88 28
180 88 24
180 88 20
184 88 20
184 92 16
188 92 12
188 92 12
192 92 8
196 96 4
196 96 4
196 100 4
196 100 4
196 104 4
200 108 4
200 108 4
200 112 4
200 112 4
200 116 4
204 120 4
204 120 4
204 124 4
204 124 4
208 128 4
208 132 4
208 132 4
208 136 4
208 136 4
212 140 4
212 144 4
212 144 4
212 148 4
216 152 4
216 152 4
216 156 4
216 156 4
216 160 4
220 164 4
220 164 4
220 168 4
220 168 4
224 172 4
224 176 4
224 176 4
224 180 4
224 180 4
228 184 4
228 188 4
228 188 4
228 192 4
228 192 4
232 196 4
232 200 4
232 200 4
232 204 4
236 208 4
236 208 4
236 212 4
236 212 4
236 216 4
240 220 4
240 220 4
240 224 4
240 224 4
244 228 4
244 232 4
244 232 4
244 236 4
244 236 4
248 240 4
248 244 4
248 244 4
248 248 4
252 252 0
252 252 104
252 252 104
252 252 108
252 252 112
252 252 116
252 252 120
252 252 120
252 252 124
252 252 128
252 252 132
252 252 136
252 252 136
252 252 140
252 252 144
252 252 148
252 252 152
252 252 152
252 252 156
252 252 160
252 252 164
252 252 168
252 252 168
252 252 172
252 252 176
252 252 180
252 252 184
252 252 184
252 252 188
252 252 192
252 252 196
252 252 200
252 252 200
252 252 204
252 252 208
252 252 212
252 252 216
252 252 216
252 252 220
252 252 224
252 252 228
252 252 232
252 252 232
252 252 236
252 252 240
252 252 244
252 252 248
252 252 252
......@@ -8,13 +8,14 @@
#
#
import sys
import glob
import os
from mantid.kernel import ConfigService
from mantid.plots.utility import mpl_version_info, get_current_cmap
from mantidqt.MPLwidgets import FigureCanvas
from matplotlib.colorbar import Colorbar
from matplotlib.figure import Figure
from matplotlib.colors import Normalize, SymLogNorm, PowerNorm, LogNorm
from matplotlib.colors import ListedColormap, Normalize, SymLogNorm, PowerNorm, LogNorm
from matplotlib import cm
import numpy as np
from qtpy.QtWidgets import QWidget, QVBoxLayout, QHBoxLayout, QLineEdit, QComboBox, QCheckBox, QLabel
......@@ -25,14 +26,31 @@ NORM_OPTS = ["Linear", "Log", "SymmetricLog10", "Power"]
MIN_LOG_VALUE = 1e-4
def register_customized_colormaps():
"""register customized colormaps to matplotlib runtime"""
cmap_path = os.path.dirname(os.path.realpath(__file__))
cmap_files = glob.glob(os.path.join(cmap_path, "*.map"))
for cmap_file in cmap_files:
cmap_name = os.path.basename(cmap_file).split(".")[0]
cmap_data = np.loadtxt(cmap_file)/255.0
cmap = ListedColormap(cmap_data, name=cmap_name)
cm.register_cmap(name=cmap_name, cmap=cmap)
cmap_data_r = np.flipud(cmap_data)
cmap_r = ListedColormap(cmap_data_r, name=f"{cmap_name}_r")
cm.register_cmap(name=f"{cmap_name}_r", cmap=cmap_r)
class ColorbarWidget(QWidget):
colorbarChanged = Signal() # The parent should simply redraw their canvas
scaleNormChanged = Signal()
# register additional color maps from file
register_customized_colormaps()
# create the list
cmap_list = sorted([cmap for cmap in cm.cmap_d.keys() if not cmap.endswith('_r')])
def __init__(self, parent=None, default_norm_scale=None):
"""
:param default_scale: None uses linear, else either a string or tuple(string, other arguuments), e.g. tuple('Power', exponent)
:param default_scale: None uses linear, else either a string or tuple(string, other arguments), e.g. tuple('Power', exponent)
"""
super(ColorbarWidget, self).__init__(parent)
......
......@@ -13,5 +13,8 @@ setup(
install_requires=['mantid'],
version=os.environ['MANTID_VERSION_STR'],
packages=find_packages(exclude=['*.test']),
package_data={'': ['*.ui']},
package_data={
'': ['*.ui'],
'widgets': ['*.map'],
},
)
......@@ -219,13 +219,13 @@ void IndirectDataAnalysisElwinTab::setup() {
// We always want one range selector... the second one can be controlled from
// within the elwinTwoRanges(bool state) function
auto integrationRangeSelector = m_uiForm.ppPlot->addRangeSelector("ElwinIntegrationRange");
integrationRangeSelector->setBounds(-1.0, 1.0);
integrationRangeSelector->setBounds(-DBL_MAX, DBL_MAX);
connect(integrationRangeSelector, SIGNAL(minValueChanged(double)), this, SLOT(minChanged(double)));
connect(integrationRangeSelector, SIGNAL(maxValueChanged(double)), this, SLOT(maxChanged(double)));
// create the second range
auto backgroundRangeSelector = m_uiForm.ppPlot->addRangeSelector("ElwinBackgroundRange");
backgroundRangeSelector->setColour(Qt::darkGreen); // dark green for background
backgroundRangeSelector->setBounds(-1.0, 1.0);
backgroundRangeSelector->setBounds(-DBL_MAX, DBL_MAX);
connect(integrationRangeSelector, SIGNAL(selectionChanged(double, double)), backgroundRangeSelector,
SLOT(setRange(double, double)));
connect(backgroundRangeSelector, SIGNAL(minValueChanged(double)), this, SLOT(minChanged(double)));
......
......@@ -190,7 +190,7 @@ void IndirectDataAnalysisIqtTab::setup() {
setPreviewSpectrumMaximum(0);
auto xRangeSelector = m_uiForm.ppPlot->addRangeSelector("IqtRange");
xRangeSelector->setBounds(-1.0, 1.0);
xRangeSelector->setBounds(-DBL_MAX, DBL_MAX);
// signals / slots & validators
connect(xRangeSelector, SIGNAL(selectionChanged(double, double)), this, SLOT(rangeChanged(double, double)));
......
......@@ -12,6 +12,7 @@
#include <QMessageBox>
#include <QTimer>
#include <limits>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include "MantidQtIcons/Icon.h"
......@@ -277,7 +278,7 @@ void IndirectFitPlotView::setHWHMMinimum(double maximum) {
void IndirectFitPlotView::addFitRangeSelector() {
auto fitRangeSelector = m_topPlot->addRangeSelector("FitRange");
fitRangeSelector->setBounds(-1.0, 1.0);
fitRangeSelector->setBounds(-DBL_MAX, DBL_MAX);
connect(fitRangeSelector, SIGNAL(minValueChanged(double)), this, SIGNAL(startXChanged(double)));
connect(fitRangeSelector, SIGNAL(maxValueChanged(double)), this, SIGNAL(endXChanged(double)));
......@@ -304,7 +305,7 @@ void IndirectFitPlotView::setBackgroundBounds() {
void IndirectFitPlotView::addHWHMRangeSelector() {
auto hwhmRangeSelector = m_topPlot->addRangeSelector("HWHM");
hwhmRangeSelector->setBounds(-1.0, 1.0);
hwhmRangeSelector->setBounds(-DBL_MAX, DBL_MAX);
hwhmRangeSelector->setColour(Qt::red);
hwhmRangeSelector->setRange(0.0, 0.0);
hwhmRangeSelector->setVisible(false);
......
......@@ -63,15 +63,13 @@ public:
static constexpr double INVALID_VALUE = std::numeric_limits<double>::lowest();
/// Constructor
InstrumentActor(const QString &wsName, bool autoscaling = true,
double scaleMin = 0.0, double scaleMax = 0.0);
InstrumentActor(const QString &wsName, bool autoscaling = true, double scaleMin = 0.0, double scaleMax = 0.0);
///< Destructor
~InstrumentActor();
/// Draw the instrument in 3D
void draw(bool picking = false) const;
/// Return the bounding box in 3D
void getBoundingBox(Mantid::Kernel::V3D &minBound,
Mantid::Kernel::V3D &maxBound) const;
void getBoundingBox(Mantid::Kernel::V3D &minBound, Mantid::Kernel::V3D &maxBound, const bool excludeMonitors) const;
/// Set a component (and all its children) visible.
void setComponentVisible(size_t componentIndex);
/// Set visibilit of all components.
......@@ -163,11 +161,9 @@ public:
/// Get the integrated counts of a detector by its detector Index.