Unverified Commit a89b4085 authored by Gigg, Martyn Anthony's avatar Gigg, Martyn Anthony Committed by GitHub
Browse files

Merge pull request #33066 from DavidFair/Fix_linux_pre_commit

Fix linux pre commit
parents 61e936a1 d2d6fad7
......@@ -4,6 +4,7 @@ default_language_version:
exclude: ^$|instrument/
repos:
# Run fast code improvement/checks before running PR specific helpers.
- repo: https://github.com/pre-commit/pre-commit-hooks.git
rev: 2618198e9658cccb4a53f04af0f7d642109f3b54
......@@ -12,13 +13,13 @@ repos:
args: [--markdown-linebreak-ext=md]
exclude: .patch$
- id: check-added-large-files
args: ["--maxkb=4096"]
args: ['--maxkb=4096']
- id: check-xml
- id: check-yaml
args: [--allow-multiple-documents]
- repo: https://github.com/mantidproject/pre-commit-hooks.git
rev: f99fd08a5f4ece5a196adeda23d20b4491cfd97b
rev: 511456a60b0c6cbb079e64a7cd8e3302f04859a6
hooks:
- id: clang-format
exclude: Testing/Tools/cxxtest|tools
......@@ -26,10 +27,11 @@ repos:
# Exclude sphinx / template file
exclude: test_doctest.py|python_export_maker.py
- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.13
hooks:
- id: cmake-format
- id: cmake-format
#- id: cmake-lint <- not ready yet
- repo: https://gitlab.com/pycqa/flake8.git
......@@ -38,4 +40,4 @@ repos:
- id: flake8
# Have to manually copy this from the .flake8 as flake8 will just ignore the config if the file is passed
exclude: Framework/PythonInterface/test|qt/applications/workbench/workbench/app/resources.py|qt/python/mantidqt/mantidqt/resources.py|qt/python/mantidqt/mantidqt/dialogs/errorreports/resources_qt4.py|qt/python/mantidqt/mantidqt/dialogs/errorreports/resources_qt5.py|Testing/PerformanceTests|Testing/SystemTests/lib|Testing/SystemTests/scripts|Testing/SystemTests/tests/framework/reference|scripts/ErrorReporter/ui_errorreport.py
args: ["--extend-ignore=E999,F821,E127"]
args: ['--extend-ignore=E999,F821,E127']
......@@ -29,10 +29,10 @@ using namespace Mantid;
// allow testing of protected methods
class PDFFourierTransform2Wrapper : public PDFFourierTransform2 {
public:
size_t determineMinIndex(double min, const std::vector<double> &X, const std::vector<double> &Y){
size_t determineMinIndex(double min, const std::vector<double> &X, const std::vector<double> &Y) {
return PDFFourierTransform2::determineMinIndex(min, X, Y);
};
size_t determineMaxIndex(double max, const std::vector<double> &X, const std::vector<double> &Y){
size_t determineMaxIndex(double max, const std::vector<double> &X, const std::vector<double> &Y) {
return PDFFourierTransform2::determineMaxIndex(max, X, Y);
};
};
......
.. _01_introduction_conn:
============
Introduction
Introduction
============
......
.. _02_displaying_and_navigating:
=========================
Displaying And Navigating
Displaying And Navigating
=========================
.. raw:: html
<style> .red {color:#FF0000; font-weight:bold} </style>
<style> .green {color:#008000; font-weight:bold} </style>
<style> .blue {color:#0000FF; font-weight:bold} </style>
<style> .orange {color:#FF8C00; font-weight:bold} </style>
<style> .green {color:#008000; font-weight:bold} </style>
<style> .blue {color:#0000FF; font-weight:bold} </style>
<style> .orange {color:#FF8C00; font-weight:bold} </style>
.. role:: red
.. role:: blue
......@@ -20,7 +20,7 @@ Opening the Instrument View
To see the Instrument View
#. Load a data set, such as MUSR00015189
#. Load a data set, such as MUSR00015189
#. As this is a WorkspaceGroup, reveal the contained workspaces by clicking on the small triangle
#. Right-click on the workspace named MUSR0001589_1 in the Workspaces Toolbox and select "Show Instrument"
......
.. _03_investigating_data:
==================
Investigating Data
Investigating Data
==================
The Pick tab on the controls panel allows you to see the data in the
......@@ -48,7 +48,7 @@ Picking a Tube
The Tube selection tool |PickTube.png| is useful for tube instruments.
When it's on the mini-plot displays the integrated data in the whole
tube. The integration is done either over the detectors in the tube (Sum
option) or over time (Integrate). To switch between the options, right-click on the mini-plot
option) or over time (Integrate). To switch between the options, right-click on the mini-plot
to display the following menu:
.. figure:: /images/SumIntegrateMenu.png
......
......@@ -20,7 +20,7 @@ functions.
.. figure:: /images/MaskOrGroup.png
:alt: MaskOrGroup.png
The shapes ready for masking have red border
The shapes ready for masking have red border
|MaskRedRing.png|
......@@ -28,7 +28,7 @@ Shapes marked as Regions of Interest have a yellow border
|ROIYellowcircle.png|
The shapes ready for grouping have blue border
The shapes ready for grouping have blue border
|GroupBlueRing.png|
......@@ -82,7 +82,7 @@ and it can be applied to the current View or to the underlying Workspace.
*Word of Warning*: If masking (or setting of ROI) is applied to the data (by clicking |ApplyToDataButton.png|, near the bottom left of Instrument View window)
it **cannot be undone**!
it **cannot be undone**!
.. figure:: /images/Fullmaskview.png
......@@ -90,9 +90,9 @@ it **cannot be undone**!
:alt: Fullmaskview.png
Note that the first button in the View section above is called "Apply bin mask to View", because it only covers bins within the time
range selected on the bottom bar (between -0.55 to 28.47 microseconds). This range bar selects the interval over which instrument
view sums/integrates and correspnds to the x-axis of the underlying workspace. This button is called "Apply detector mask to View"
Note that the first button in the View section above is called "Apply bin mask to View", because it only covers bins within the time
range selected on the bottom bar (between -0.55 to 28.47 microseconds). This range bar selects the interval over which instrument
view sums/integrates and correspnds to the x-axis of the underlying workspace. This button is called "Apply detector mask to View"
when the entire x-axis range is selected as in this way you mask an entire spectrum (and its related detector).
Be aware that any data analysis on spectra from a region of interest (ROI) should not be performed on data in the Pick > mini-plot. You would need to run the :ref:`algm-DiffractionFocussing` algorithm.
......@@ -102,5 +102,5 @@ Be aware that any data analysis on spectra from a region of interest (ROI) shoul
.. |GroupBlueRing.png| image:: /images/GroupBlueRing.png
.. |ClearAllButton.png| image:: /images/ClearAllButton.png
.. |ApplyToDataButton.png| image:: /images/ApplyToDataButton.png
.. |ROIYellowcircle.png| image:: /images/ROIYellowcircle.png
.. |ROIYellowcircle.png| image:: /images/ROIYellowcircle.png
:width: 150px
.. _05_instrument_tree:
===============
Instrument Tree
Instrument Tree
===============
......
......@@ -11,7 +11,7 @@ certain quantities over time, e.g. SampleTemp.
To access these:
- Load data with logs attached (e.g. ``CNCS_7860_event.nxs``)
- Load data with logs attached (e.g. ``CNCS_7860_event.nxs``)
- Right-click on the workspace in the Workspace Toolbox and select "Show Sample Logs".
.. figure:: /images/SampleLogs.png
......
.. _08_exercises_c:
=========
Exercises
Exercises
=========
Exercise 1
......@@ -59,14 +59,14 @@ detector for a small angle dataset.
#. Select the ellipse drawing button |PickTabEllipseButton.png|.
#. Draw an ellipse in the middle of the panel to cover completely the
blue disk there. [Tip: Set the Instrument View window to full screen to make this easier!]
|LOQEllipseMasking.png|
#. Select the button for drawing a rectangular ring
|PickTabRectRingButton.png|
#. Draw a ring masking the edge detectors of the panel. Use its control
points to adjust it to the right size and thickness.
|LOQRectRingMasking.png|
#. Click |ApplyToViewButton.png| button.
......
.. _connecting_data_to_instruments:
.. _connecting_data_to_instruments:
==============================
Connecting Data To Instruments
Connecting Data To Instruments
==============================
.. toctree::
:hidden:
:glob:
:maxdepth: 1
.. toctree::
:hidden:
:glob:
:maxdepth: 1
01_introduction
02_displaying_and_navigating
......
......@@ -20,40 +20,35 @@ namespace MantidQt {
namespace MantidWidgets {
namespace BankRenderingHelpers {
EXPORT_OPT_MANTIDQT_INSTRUMENTVIEW std::pair<size_t, size_t>
getCorrectedTextureSize(const size_t width, const size_t height);
EXPORT_OPT_MANTIDQT_INSTRUMENTVIEW std::pair<size_t, size_t> getCorrectedTextureSize(const size_t width,
const size_t height);
/** Render GridDetector Bank as 6 bitmaps for all layers or one bitmap for the
selected layer Makes OpenGL calls for drawing the bank in an OpenGL window as
textures. NB glBegin() and glEnd() are called within this function.
*/
EXPORT_OPT_MANTIDQT_INSTRUMENTVIEW void
renderGridBankLayer(const Mantid::Geometry::ComponentInfo &compInfo,
size_t index, size_t layer);
EXPORT_OPT_MANTIDQT_INSTRUMENTVIEW void renderGridBankLayer(const Mantid::Geometry::ComponentInfo &compInfo,
size_t index, size_t layer);
EXPORT_OPT_MANTIDQT_INSTRUMENTVIEW void
renderGridBankOutline(const Mantid::Geometry::ComponentInfo &compInfo,
size_t index);
EXPORT_OPT_MANTIDQT_INSTRUMENTVIEW void renderGridBankOutline(const Mantid::Geometry::ComponentInfo &compInfo,
size_t index);
EXPORT_OPT_MANTIDQT_INSTRUMENTVIEW void
renderGridBankFull(const Mantid::Geometry::ComponentInfo &compInfo,
size_t index, detail::GridTextureFace gridFace);
EXPORT_OPT_MANTIDQT_INSTRUMENTVIEW void renderGridBankFull(const Mantid::Geometry::ComponentInfo &compInfo,
size_t index, detail::GridTextureFace gridFace);
/** Render RectangularDetector Bank as bitmap texture
Makes OpenGL calls for drawing the bank in an OpenGL window. NB glBegin() and
glEnd() are called within this function.
*/
EXPORT_OPT_MANTIDQT_INSTRUMENTVIEW void
renderRectangularBank(const Mantid::Geometry::ComponentInfo &compInfo,
size_t index);
EXPORT_OPT_MANTIDQT_INSTRUMENTVIEW void renderRectangularBank(const Mantid::Geometry::ComponentInfo &compInfo,
size_t index);
/** Render Structured Detector Bank as quads
Makes OpenGL calls for drawing the bank in an OpenGL window. NB glBegin() and
glEnd() are called within this function.
*/
EXPORT_OPT_MANTIDQT_INSTRUMENTVIEW void
renderStructuredBank(const Mantid::Geometry::ComponentInfo &compInfo,
size_t index, const std::vector<GLColor> &color);
EXPORT_OPT_MANTIDQT_INSTRUMENTVIEW void renderStructuredBank(const Mantid::Geometry::ComponentInfo &compInfo,
size_t index, const std::vector<GLColor> &color);
} // namespace BankRenderingHelpers
} // namespace MantidWidgets
} // namespace MantidQt
......@@ -25,29 +25,21 @@ namespace MantidWidgets {
namespace detail {
class BankTextureBuilder {
public:
BankTextureBuilder(const Mantid::Geometry::ComponentInfo &compInfo,
size_t index);
BankTextureBuilder(const Mantid::Geometry::ComponentInfo &compInfo, size_t index);
~BankTextureBuilder();
void buildColorTextures(const std::vector<GLColor> &colors,
bool isUsingLayer = false, size_t layer = 0);
void buildPickTextures(const std::vector<GLColor> &colors,
bool isUsingLayer = false, size_t layer = 0);
void uploadTextures(bool picking,
GridTextureFace gridFace = GridTextureFace::Front);
void buildColorTextures(const std::vector<GLColor> &colors, bool isUsingLayer = false, size_t layer = 0);
void buildPickTextures(const std::vector<GLColor> &colors, bool isUsingLayer = false, size_t layer = 0);
void uploadTextures(bool picking, GridTextureFace gridFace = GridTextureFace::Front);
void bindTextures(bool picking) const;
void unbindTextures() const;
private:
void buildOpenGLTextures(bool picking, const std::vector<GLColor> &colors,
bool isUsingLayer, size_t layer);
void buildOpenGLTextures(bool picking, const std::vector<GLColor> &colors, bool isUsingLayer, size_t layer);
void buildTubeBankTextures(const std::vector<GLColor> &colors, bool picking);
void buildGridBankFull(const std::vector<GLColor> &colors, bool picking);
void buildGridBankLayer(const std::vector<GLColor> &colors, bool picking,
size_t layer);
void buildGridBankTextures(const std::vector<GLColor> &colors, bool picking,
bool isUsingLayer, size_t layer);
void buildRectangularBankTextures(const std::vector<GLColor> &colors,
bool picking);
void buildGridBankLayer(const std::vector<GLColor> &colors, bool picking, size_t layer);
void buildGridBankTextures(const std::vector<GLColor> &colors, bool picking, bool isUsingLayer, size_t layer);
void buildRectangularBankTextures(const std::vector<GLColor> &colors, bool picking);
void uploadTubeBankTextures(bool picking);
void uploadGridBankTexture(bool picking, GridTextureFace gridFace);
void uploadRectangularBankTextures(bool picking);
......
......@@ -28,11 +28,9 @@ using Mantid::Geometry::Instrument;
using namespace MantidQt;
using namespace MantidQt::MantidWidgets;
class MockBaseCustomInstrumentView
: public MantidQt::MantidWidgets::IBaseCustomInstrumentView {
class MockBaseCustomInstrumentView : public MantidQt::MantidWidgets::IBaseCustomInstrumentView {
public:
explicit MockBaseCustomInstrumentView(const std::string &instrument,
QWidget *parent = nullptr) {
explicit MockBaseCustomInstrumentView(const std::string &instrument, QWidget *parent = nullptr) {
(void)instrument;
(void)parent;
};
......@@ -45,21 +43,16 @@ public:
MOCK_METHOD1(setInstrumentWidget, void(InstrumentWidget *instrument));
MOCK_METHOD0(getInstrumentView, MantidWidgets::InstrumentWidget *());
MOCK_METHOD2(
setUpInstrument,
void(const std::string &fileName,
std::vector<std::function<bool(std::map<std::string, bool>)>>
&instrument));
MOCK_METHOD1(addObserver,
void(std::tuple<std::string, Observer *> &listener));
MOCK_METHOD2(setUpInstrument, void(const std::string &fileName,
std::vector<std::function<bool(std::map<std::string, bool>)>> &instrument));
MOCK_METHOD1(addObserver, void(std::tuple<std::string, Observer *> &listener));
MOCK_METHOD1(setupInstrumentAnalysisSplitters, void(QWidget *analysis));
MOCK_METHOD0(setupHelp, void());
// override getQWidget
MOCK_METHOD0(getQWidget, QWidget *());
};
class MockBaseCustomInstrumentModel
: public MantidQt::MantidWidgets::IBaseCustomInstrumentModel {
class MockBaseCustomInstrumentModel : public MantidQt::MantidWidgets::IBaseCustomInstrumentModel {
public:
explicit MockBaseCustomInstrumentModel(){};
~MockBaseCustomInstrumentModel(){};
......@@ -80,15 +73,12 @@ public:
// Allows us to turn on and off mocks to functions from the presenter
// do not repeat testing
class PartMockBaseCustomInstrumentPresenter
: public BaseCustomInstrumentPresenter {
class PartMockBaseCustomInstrumentPresenter : public BaseCustomInstrumentPresenter {
public:
explicit PartMockBaseCustomInstrumentPresenter(
IBaseCustomInstrumentView *view, IBaseCustomInstrumentModel *model,
IPlotFitAnalysisPanePresenter *analysis)
: BaseCustomInstrumentPresenter(view, model, analysis),
m_initInstrument(0), m_load(0), m_layout(0), m_sideEffects(0),
m_mockInitInstrument(false), m_mockLoad(false), m_mockLayout(false),
explicit PartMockBaseCustomInstrumentPresenter(IBaseCustomInstrumentView *view, IBaseCustomInstrumentModel *model,
IPlotFitAnalysisPanePresenter *analysis)
: BaseCustomInstrumentPresenter(view, model, analysis), m_initInstrument(0), m_load(0), m_layout(0),
m_sideEffects(0), m_mockInitInstrument(false), m_mockLoad(false), m_mockLayout(false),
m_mockSideEffects(false){};
~PartMockBaseCustomInstrumentPresenter(){};
......@@ -98,8 +88,7 @@ public:
void setMockLayout() { m_mockLayout = true; };
void setMockSideEffects() { m_mockSideEffects = true; };
// override functions so we can call mocked versions
void initInstrument(std::pair<instrumentSetUp, instrumentObserverOptions>
*setUp = nullptr) override {
void initInstrument(std::pair<instrumentSetUp, instrumentObserverOptions> *setUp = nullptr) override {
if (m_mockInitInstrument) {
m_initInstrument += 1;
} else {
......@@ -107,8 +96,7 @@ public:
};
}
void initLayout(std::pair<instrumentSetUp, instrumentObserverOptions> *setup =
nullptr) override final {
void initLayout(std::pair<instrumentSetUp, instrumentObserverOptions> *setup = nullptr) override final {
if (m_mockLayout == true) {
m_layout += 1;
} else {
......@@ -139,14 +127,9 @@ public:
int getLoadSideEffectsCount() { return m_sideEffects; };
// allow tests to get at protected/private functions/members
void setUpInstrumentAnalysisSplitter() override {
BaseCustomInstrumentPresenter::setUpInstrumentAnalysisSplitter();
};
void loadRunNumber() override {
BaseCustomInstrumentPresenter::loadRunNumber();
};
std::pair<instrumentSetUp, instrumentObserverOptions> *
setupInstrument() override {
void setUpInstrumentAnalysisSplitter() override { BaseCustomInstrumentPresenter::setUpInstrumentAnalysisSplitter(); };
void loadRunNumber() override { BaseCustomInstrumentPresenter::loadRunNumber(); };
std::pair<instrumentSetUp, instrumentObserverOptions> *setupInstrument() override {
return BaseCustomInstrumentPresenter::setupInstrument();
};
......
......@@ -33,8 +33,7 @@ class BinDialog : public QDialog {
public:
explicit BinDialog(QWidget *parent = nullptr);
~BinDialog() override;
void setIntegralMinMax(double /*minBin*/, double /*maxBin*/,
bool /*useEverything*/);
void setIntegralMinMax(double /*minBin*/, double /*maxBin*/, bool /*useEverything*/);
signals:
/// This signal is sent when changing the bin range selected.
/// Parameters are: min, max, and a bool set to true to mean "everything"
......
......@@ -33,8 +33,7 @@ public:
/// Set all four values atomically
void set(float red, float green, float blue, float alpha);
/// Retrieve the component colours
void get(float & /*red*/, float & /*green*/, float & /*blue*/,
float & /*alpha*/) const;
void get(float & /*red*/, float & /*green*/, float & /*blue*/, float & /*alpha*/) const;
void get(unsigned char &r, unsigned char &g, unsigned char &b) const;
/// Retrieve the component colours
void getUB3(unsigned char *c) const;
......
......@@ -39,8 +39,7 @@ public:
~InstrumentRenderer();
void renderInstrument(const std::vector<bool> &visibleComps, bool showGuides,
bool picking = false);
void renderInstrument(const std::vector<bool> &visibleComps, bool showGuides, bool picking = false);
void reset();
......@@ -67,8 +66,7 @@ public:
private:
void resetColors();
void resetPickColors();
void draw(const std::vector<bool> &visibleComps, bool showGuides,
bool picking);
void draw(const std::vector<bool> &visibleComps, bool showGuides, bool picking);
void drawGridBank(size_t bankIndex, bool picking);
void drawRectangularBank(size_t bankIndex, bool picking);
void drawStructuredBank(size_t bankIndex, bool picking);
......
......@@ -33,8 +33,7 @@ class BinDialog;
/**
* Implements the Render tab in InstrumentWidget.
*/
class EXPORT_OPT_MANTIDQT_INSTRUMENTVIEW InstrumentWidgetRenderTab
: public InstrumentWidgetTab {
class EXPORT_OPT_MANTIDQT_INSTRUMENTVIEW InstrumentWidgetRenderTab : public InstrumentWidgetTab {
Q_OBJECT
public:
......@@ -48,8 +47,7 @@ public:
void setScaleType(ColorMap::ScaleType type);
void setAxis(const QString &axisName);
bool areAxesOn() const;
void setupColorBar(const ColorMap & /*cmap*/, double /*minValue*/,
double /*maxValue*/, double /*minPositive*/,
void setupColorBar(const ColorMap & /*cmap*/, double /*minValue*/, double /*maxValue*/, double /*minPositive*/,
bool /*autoscaling*/);
/// Load the render window tab settings from file.
virtual void loadFromProject(const std::string &lines) override;
......
......@@ -23,9 +23,7 @@ namespace MantidWidgets {
class InstrumentWidget;
class ProjectionSurface;
class EXPORT_OPT_MANTIDQT_INSTRUMENTVIEW InstrumentWidgetTab
: public QFrame,
public InstrumentWidgetTypes {
class EXPORT_OPT_MANTIDQT_INSTRUMENTVIEW InstrumentWidgetTab : public QFrame, public InstrumentWidgetTypes {
Q_OBJECT
public:
explicit InstrumentWidgetTab(InstrumentWidget *parent);
......@@ -39,9 +37,7 @@ public:
virtual void loadSettings(const QSettings & /*unused*/) {}
/// Add tab-specific items to the context menu
/// Return true if at least 1 item was added or false otherwise.
virtual bool addToDisplayContextMenu(QMenu & /*unused*/) const {
return false;
}
virtual bool addToDisplayContextMenu(QMenu & /*unused*/) const { return false; }
/// Get the projection surface
std::shared_ptr<ProjectionSurface> getSurface() const;
/// Load state for the widget tab from a project file
......
......@@ -17,8 +17,7 @@ class InstrumentTreeWidget;
/**
* Implements the instrument tree tab in InstrumentWidget
*/
class EXPORT_OPT_MANTIDQT_INSTRUMENTVIEW InstrumentWidgetTreeTab
: public InstrumentWidgetTab {
class EXPORT_OPT_MANTIDQT_INSTRUMENTVIEW InstrumentWidgetTreeTab : public InstrumentWidgetTab {
Q_OBJECT
public:
explicit InstrumentWidgetTreeTab(InstrumentWidget *instrWidget);
......
......@@ -30,8 +30,7 @@ public:
explicit MiniPlotQwt(QWidget *parent);
~MiniPlotQwt() override;
void setXLabel(QString xunit);
void setData(std::vector<double> x, std::vector<double> y, QString xunit,
QString curveLabel);
void setData(std::vector<double> x, std::vector<double> y, QString xunit, QString curveLabel);
QString label() const { return m_label; }
void setYAxisLabelRotation(double degrees);
void addPeakLabel(const PeakMarker2D * /*marker*/);
......@@ -79,8 +78,7 @@ private:
class PeakLabel : public QwtPlotItem {
public:
PeakLabel(const PeakMarker2D *m, const MiniPlotQwt *plot)
: m_marker(m), m_plot(plot) {}
PeakLabel(const PeakMarker2D *m, const MiniPlotQwt *plot) : m_marker(m), m_plot(plot) {}
void draw(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap,
const QRect &canvasRect) const override;
......
Markdown is supported
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