Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mantidproject
mantid
Commits
b396588f
Commit
b396588f
authored
Mar 24, 2016
by
Lamar Moore
Browse files
Re #15542 merge with master
parent
8ecd3c4f
Changes
482
Hide whitespace changes
Inline
Side-by-side
.github/ISSUE_TEMPLATE.md
0 → 100644
View file @
b396588f
<!-- TEMPLATE FOR BUG REPORTS -->
### Expected behavior
### Actual behavior
### Steps to reproduce the behavior
### Platforms affected
.github/PULL_REQUEST_TEMPLATE.md
View file @
b396588f
...
...
@@ -6,8 +6,10 @@ Description of work.
Fixes #xxxx.
[
Release notes
](
/docs/source/release/
)
<!-- Replace with a link above to the updated file or state "Does not need to be in the release notes." -->
<!-- RELEASE NOTES
Either edit the file in docs/source/release/... and it will be in your pull request or state
*Does not need to be in the release notes.*
-->
---
...
...
Framework/API/inc/MantidAPI/BoxController.h
View file @
b396588f
...
...
@@ -9,6 +9,7 @@
#include
<nexus/NeXusFile.hpp>
#include
<boost/optional.hpp>
#include
<numeric>
#include
<vector>
namespace
Mantid
{
...
...
@@ -294,10 +295,10 @@ public:
// We need to account for optional top level splitting
if
(
depth
==
0
&&
m_splitTopInto
)
{
size_t
numSplitTop
=
1
;
for
(
size_t
d
=
0
;
d
<
m_splitTopInto
.
get
().
size
();
d
++
)
numSplitTop
*=
m_splitTopInto
.
get
()[
d
];
const
auto
&
splitTopInto
=
m_splitTopInto
.
get
()
;
size_t
numSplitTop
=
std
::
accumulate
(
splitTopInto
.
cbegin
(),
splitTopInto
.
cend
(),
size_t
{
1
},
std
::
multiplies
<
size_t
>
());
m_numMDBoxes
[
depth
+
1
]
+=
numSplitTop
;
}
else
{
m_numMDBoxes
[
depth
+
1
]
+=
m_numSplit
;
...
...
@@ -321,20 +322,14 @@ public:
/** Return the total number of MD Boxes, irrespective of depth */
size_t
getTotalNumMDBoxes
()
const
{
size_t
total
=
0
;
for
(
size_t
depth
=
0
;
depth
<
m_numMDBoxes
.
size
();
depth
++
)
{
total
+=
m_numMDBoxes
[
depth
];
}
return
total
;
return
std
::
accumulate
(
m_numMDBoxes
.
cbegin
(),
m_numMDBoxes
.
cend
(),
size_t
{
0
},
std
::
plus
<
size_t
>
());
}
/** Return the total number of MDGridBox'es, irrespective of depth */
size_t
getTotalNumMDGridBoxes
()
const
{
size_t
total
=
0
;
for
(
size_t
depth
=
0
;
depth
<
m_numMDGridBoxes
.
size
();
depth
++
)
{
total
+=
m_numMDGridBoxes
[
depth
];
}
return
total
;
return
std
::
accumulate
(
m_numMDGridBoxes
.
cbegin
(),
m_numMDGridBoxes
.
cend
(),
size_t
{
0
},
std
::
plus
<
size_t
>
());
}
/** Return the average recursion depth of gridding.
...
...
Framework/API/inc/MantidAPI/FunctionFactory.h
View file @
b396588f
...
...
@@ -134,12 +134,11 @@ const std::vector<std::string> &FunctionFactoryImpl::getFunctionNames() const {
// Create the entry in the cache and work with it directly
std
::
vector
<
std
::
string
>
&
typeNames
=
m_cachedFunctionNames
[
soughtType
];
const
std
::
vector
<
std
::
string
>
names
=
this
->
getKeys
();
for
(
auto
it
=
names
.
begin
();
it
!=
names
.
end
();
++
it
)
{
boost
::
shared_ptr
<
IFunction
>
func
=
this
->
createFunction
(
*
it
);
if
(
func
&&
dynamic_cast
<
FunctionType
*>
(
func
.
get
()))
{
typeNames
.
push_back
(
*
it
);
}
}
std
::
copy_if
(
names
.
cbegin
(),
names
.
cend
(),
std
::
back_inserter
(
typeNames
),
[
this
](
const
std
::
string
&
name
)
{
boost
::
shared_ptr
<
IFunction
>
func
=
this
->
createFunction
(
name
);
return
boost
::
dynamic_pointer_cast
<
FunctionType
>
(
func
);
});
return
typeNames
;
}
...
...
Framework/API/inc/MantidAPI/IMDWorkspace.h
View file @
b396588f
...
...
@@ -167,6 +167,9 @@ protected:
/// Protected copy constructor. May be used by childs for cloning.
IMDWorkspace
(
const
IMDWorkspace
&
)
=
default
;
void
makeSinglePointWithNaN
(
std
::
vector
<
coord_t
>
&
x
,
std
::
vector
<
signal_t
>
&
y
,
std
::
vector
<
signal_t
>
&
e
)
const
;
const
std
::
string
toString
()
const
override
;
private:
...
...
Framework/API/inc/MantidAPI/MatrixWorkspace.h
View file @
b396588f
...
...
@@ -108,12 +108,12 @@ public:
std
::
map
<
specnum_t
,
Mantid
::
Kernel
::
V3D
>
getNeighbours
(
const
Geometry
::
IDetector
*
comp
,
const
double
radius
=
0.0
,
const
bool
ignoreMaskedDetectors
=
false
)
const
;
/// Query the NearestNeighbours object for a given spectrum
index
using a
/// Query the NearestNeighbours object for a given spectrum
number
using a
/// search radius
std
::
map
<
specnum_t
,
Mantid
::
Kernel
::
V3D
>
getNeighbours
(
specnum_t
spec
,
const
double
radius
,
const
bool
ignoreMaskedDetectors
=
false
)
const
;
/// Query the NearestNeighbours object for a given spectrum
index
using the
/// Query the NearestNeighbours object for a given spectrum
number
using the
/// direct number of nearest neighbours
std
::
map
<
specnum_t
,
Mantid
::
Kernel
::
V3D
>
getNeighboursExact
(
specnum_t
spec
,
const
int
nNeighbours
,
...
...
@@ -315,7 +315,7 @@ public:
/**
* Probes if DX (X Error) values were set on a particular spectrum
* @param index: the
spectrum
index
* @param index: the
workspace
index
*/
virtual
bool
hasDx
(
const
std
::
size_t
index
)
const
{
return
getSpectrum
(
index
)
->
hasDx
();
...
...
@@ -364,7 +364,7 @@ public:
// Methods to set and access masked bins
void
maskBin
(
const
size_t
&
workspaceIndex
,
const
size_t
&
binIndex
,
const
double
&
weight
=
1.0
);
void
flagMasked
(
const
size_t
&
spectrumI
ndex
,
const
size_t
&
binIndex
,
void
flagMasked
(
const
size_t
&
i
ndex
,
const
size_t
&
binIndex
,
const
double
&
weight
=
1.0
);
bool
hasMaskedBins
(
const
size_t
&
workspaceIndex
)
const
;
/// Masked bins for each spectrum are stored as a set of pairs containing <bin
...
...
@@ -512,7 +512,7 @@ private:
/// Flag indicating whether the data has common bins. False by default
mutable
bool
m_isCommonBinsFlag
;
/// The set of masked bins in a map keyed on
spectrum
index
/// The set of masked bins in a map keyed on
workspace
index
std
::
map
<
int64_t
,
MaskList
>
m_masks
;
/// A workspace holding monitor data relating to the main data in the
...
...
Framework/API/inc/MantidAPI/WorkspaceProperty.h
View file @
b396588f
...
...
@@ -399,8 +399,7 @@ private:
std
::
string
error
;
// Cycle through each workspace in the group ...
for
(
auto
it
=
wsGroupNames
.
begin
();
it
!=
wsGroupNames
.
end
();
++
it
)
{
std
::
string
memberWsName
=
*
it
;
for
(
const
auto
&
memberWsName
:
wsGroupNames
)
{
boost
::
shared_ptr
<
Workspace
>
memberWs
=
AnalysisDataService
::
Instance
().
retrieve
(
memberWsName
);
...
...
Framework/API/src/AlgorithmFactory.cpp
View file @
b396588f
...
...
@@ -328,17 +328,17 @@ AlgorithmFactoryImpl::getDescriptors(bool includeHidden) const {
// results vector
std
::
vector
<
Algorithm_descriptor
>
res
;
for
(
auto
s
=
sv
.
cbegin
();
s
!=
sv
.
cend
();
++
s
)
{
if
(
s
->
empty
())
for
(
const
auto
&
s
:
sv
)
{
if
(
s
.
empty
())
continue
;
Algorithm_descriptor
desc
;
size_t
i
=
s
->
find
(
'|'
);
size_t
i
=
s
.
find
(
'|'
);
if
(
i
==
std
::
string
::
npos
)
{
desc
.
name
=
*
s
;
desc
.
name
=
s
;
desc
.
version
=
1
;
}
else
if
(
i
>
0
)
{
desc
.
name
=
s
->
substr
(
0
,
i
);
std
::
string
vers
=
s
->
substr
(
i
+
1
);
desc
.
name
=
s
.
substr
(
0
,
i
);
std
::
string
vers
=
s
.
substr
(
i
+
1
);
desc
.
version
=
vers
.
empty
()
?
1
:
atoi
(
vers
.
c_str
());
}
else
continue
;
...
...
Framework/API/src/GeometryInfoFactory.cpp
View file @
b396588f
...
...
@@ -8,7 +8,8 @@ namespace Mantid {
namespace
API
{
GeometryInfoFactory
::
GeometryInfoFactory
(
const
MatrixWorkspace
&
workspace
)
:
m_workspace
(
workspace
),
m_instrument
(
workspace
.
getInstrument
())
{
:
m_workspace
(
workspace
),
m_instrument
(
workspace
.
getInstrument
()),
m_L1
(
-
1.0
)
{
// Note: This does not seem possible currently (the instrument objects is
// always allocated, even if it is empty), so this will not fail.
if
(
!
m_instrument
)
...
...
Framework/API/src/GroupingLoader.cpp
View file @
b396588f
...
...
@@ -275,9 +275,9 @@ ITableWorkspace_sptr Grouping::toTable() const {
newTable
->
addColumn
(
"vector_int"
,
"Detectors"
);
for
(
auto
it
=
this
->
groups
.
begin
();
it
!=
this
->
groups
.
end
();
++
it
)
{
for
(
const
auto
&
group
:
this
->
groups
)
{
TableRow
newRow
=
newTable
->
appendRow
();
newRow
<<
Kernel
::
Strings
::
parseRange
(
*
it
);
newRow
<<
Kernel
::
Strings
::
parseRange
(
group
);
}
return
newTable
;
...
...
Framework/API/src/IMDWorkspace.cpp
View file @
b396588f
...
...
@@ -115,6 +115,22 @@ const std::string IMDWorkspace::toString() const {
return
os
.
str
();
}
//----------------------------------------------------------------------------------------------
/**
* Make a single point with NaN as the signal and error
* This can be returned when there would otherwise be nothing to plot
* @param x :: position on the line
* @param y :: signal value
* @param e :: error value
*/
void
IMDWorkspace
::
makeSinglePointWithNaN
(
std
::
vector
<
coord_t
>
&
x
,
std
::
vector
<
signal_t
>
&
y
,
std
::
vector
<
signal_t
>
&
e
)
const
{
x
.
push_back
(
0
);
y
.
push_back
(
std
::
numeric_limits
<
signal_t
>::
quiet_NaN
());
e
.
push_back
(
std
::
numeric_limits
<
signal_t
>::
quiet_NaN
());
}
//-----------------------------------------------------------------------------------------------
/** Obtain coordinates for a line plot through a IMDWorkspace.
* Cross the workspace from start to end points, recording the signal along the
...
...
Framework/API/src/MatrixWorkspace.cpp
View file @
b396588f
...
...
@@ -1037,7 +1037,7 @@ void MatrixWorkspace::maskWorkspaceIndex(const std::size_t index) {
* on the same spectrum. Writing to
* the mask set is marked parrallel critical so different spectra can be
* analysised in parallel
* @param workspaceIndex :: The workspace
spectrum
index of the bin
* @param workspaceIndex :: The workspace index of the bin
* @param binIndex :: The index of the bin in the spectrum
* @param weight :: 'How heavily' the bin is to be masked. =1 for full
* masking (the default).
...
...
@@ -1065,20 +1065,20 @@ void MatrixWorkspace::maskBin(const size_t &workspaceIndex,
}
/** Writes the masking weight to m_masks (doesn't alter y-values). Contains a
* par
r
allel critical section
* parallel critical section
* and so is thread safe
* @param
spectrumI
ndex :: The workspace
spectrum
index of the
bin
* @param
i
ndex :: The workspace index of the
spectrum
* @param binIndex :: The index of the bin in the spectrum
* @param weight :: 'How heavily' the bin is to be masked. =1 for full
* masking (the default).
*/
void
MatrixWorkspace
::
flagMasked
(
const
size_t
&
spectrum
Index
,
const
size_t
&
binIndex
,
const
double
&
weight
)
{
void
MatrixWorkspace
::
flagMasked
(
const
size_t
&
index
,
const
size_t
&
bin
Index
,
const
double
&
weight
)
{
// Writing to m_masks is not thread-safe, so put in some protection
PARALLEL_CRITICAL
(
maskBin
)
{
// First get a reference to the list for this spectrum (or create a new
// list)
MaskList
&
binList
=
m_masks
[
spectrumI
ndex
];
MaskList
&
binList
=
m_masks
[
i
ndex
];
auto
it
=
binList
.
find
(
binIndex
);
if
(
it
!=
binList
.
end
())
{
binList
.
erase
(
it
);
...
...
@@ -1088,7 +1088,7 @@ void MatrixWorkspace::flagMasked(const size_t &spectrumIndex,
}
/** Does this spectrum contain any masked bins
* @param workspaceIndex :: The workspace
spectrum
index to test
* @param workspaceIndex :: The workspace index to test
* @return True if there are masked bins for this spectrum
*/
bool
MatrixWorkspace
::
hasMaskedBins
(
const
size_t
&
workspaceIndex
)
const
{
...
...
Framework/API/src/SpectrumDetectorMapping.cpp
View file @
b396588f
...
...
@@ -101,7 +101,8 @@ std::set<specnum_t> SpectrumDetectorMapping::getSpectrumNumbers() const {
const
std
::
set
<
detid_t
>
&
SpectrumDetectorMapping
::
getDetectorIDsForSpectrumNo
(
const
specnum_t
spectrumNo
)
const
{
if
(
!
m_indexIsSpecNo
)
throw
std
::
runtime_error
(
"Indices are in spectrum index, not number."
);
throw
std
::
runtime_error
(
"Indices are in the spectrum detector map, not spectrum number."
);
return
m_mapping
.
at
(
spectrumNo
);
}
...
...
@@ -109,7 +110,8 @@ const std::set<detid_t> &
SpectrumDetectorMapping
::
getDetectorIDsForSpectrumIndex
(
const
size_t
spectrumIndex
)
const
{
if
(
m_indexIsSpecNo
)
throw
std
::
runtime_error
(
"Indices are in spectrum number, not index."
);
throw
std
::
runtime_error
(
"Spectrum numbers are in the spectrum detector map, not index."
);
return
m_mapping
.
at
(
static_cast
<
int
>
(
spectrumIndex
));
}
...
...
Framework/API/test/MatrixWorkspaceTest.h
View file @
b396588f
...
...
@@ -306,7 +306,7 @@ public:
auto
ws2
=
makeWorkspaceWithDetectors
(
1
,
2
);
TS_ASSERT
(
!
ws2
->
hasMaskedBins
(
0
));
// Doesn't throw on invalid spectrum
index
, just returns false
// Doesn't throw on invalid spectrum
number
, just returns false
TS_ASSERT
(
!
ws2
->
hasMaskedBins
(
1
));
TS_ASSERT
(
!
ws2
->
hasMaskedBins
(
-
1
));
...
...
Framework/Algorithms/CMakeLists.txt
View file @
b396588f
...
...
@@ -96,6 +96,7 @@ set ( SRC_FILES
src/EditInstrumentGeometry.cpp
src/ElasticWindow.cpp
src/EstimateResolutionDiffraction.cpp
src/EventWorkspaceAccess.cpp
src/Exponential.cpp
src/ExponentialCorrection.cpp
src/ExportTimeSeriesLog.cpp
...
...
@@ -150,6 +151,7 @@ set ( SRC_FILES
src/MaskBins.cpp
src/MaskBinsFromTable.cpp
src/MaskDetectorsIf.cpp
src/MatrixWorkspaceAccess.cpp
src/Max.cpp
src/MaxEnt.cpp
src/MaxEnt/MaxentData.cpp
...
...
@@ -243,6 +245,7 @@ set ( SRC_FILES
src/SolidAngle.cpp
src/SortEvents.cpp
src/SpatialGrouping.cpp
src/SpectrumAlgorithm.cpp
src/SpecularReflectionAlgorithm.cpp
src/SpecularReflectionCalculateTheta.cpp
src/SpecularReflectionPositionCorrect.cpp
...
...
@@ -375,6 +378,7 @@ set ( INC_FILES
inc/MantidAlgorithms/EditInstrumentGeometry.h
inc/MantidAlgorithms/ElasticWindow.h
inc/MantidAlgorithms/EstimateResolutionDiffraction.h
inc/MantidAlgorithms/EventWorkspaceAccess.h
inc/MantidAlgorithms/Exponential.h
inc/MantidAlgorithms/ExponentialCorrection.h
inc/MantidAlgorithms/ExportTimeSeriesLog.h
...
...
@@ -430,6 +434,7 @@ set ( INC_FILES
inc/MantidAlgorithms/MaskBins.h
inc/MantidAlgorithms/MaskBinsFromTable.h
inc/MantidAlgorithms/MaskDetectorsIf.h
inc/MantidAlgorithms/MatrixWorkspaceAccess.h
inc/MantidAlgorithms/Max.h
inc/MantidAlgorithms/MaxEnt.h
inc/MantidAlgorithms/MaxEnt/MaxentData.h
...
...
@@ -524,6 +529,7 @@ set ( INC_FILES
inc/MantidAlgorithms/SolidAngle.h
inc/MantidAlgorithms/SortEvents.h
inc/MantidAlgorithms/SpatialGrouping.h
inc/MantidAlgorithms/SpectrumAlgorithm.h
inc/MantidAlgorithms/SpecularReflectionAlgorithm.h
inc/MantidAlgorithms/SpecularReflectionCalculateTheta.h
inc/MantidAlgorithms/SpecularReflectionPositionCorrect.h
...
...
Framework/Algorithms/inc/MantidAlgorithms/ApplyDeadTimeCorr.h
View file @
b396588f
...
...
@@ -44,7 +44,7 @@ public:
const
std
::
string
name
()
const
override
{
return
"ApplyDeadTimeCorr"
;
};
/// Summary of algorithms purpose
const
std
::
string
summary
()
const
override
{
return
"Apply deadtime correction to each spectr
a
of a workspace."
;
return
"Apply deadtime correction to each spectr
um
of a workspace."
;
}
/// Algorithm's version for identification
...
...
@@ -59,6 +59,8 @@ private:
void
init
()
override
;
/// Run the algorithm
void
exec
()
override
;
/// Validate the inputs
std
::
map
<
std
::
string
,
std
::
string
>
validateInputs
()
override
;
};
}
// namespace Algorithms
...
...
Framework/Algorithms/inc/MantidAlgorithms/AsymmetryCalc.h
View file @
b396588f
...
...
@@ -68,11 +68,13 @@ public:
/// Algorithm's category for identification overriding a virtual method
const
std
::
string
category
()
const
override
{
return
"Muon"
;
}
protected:
std
::
map
<
std
::
string
,
std
::
string
>
validateInputs
()
override
;
private:
// Overridden Algorithm methods
void
init
()
override
;
void
exec
()
override
;
std
::
map
<
std
::
string
,
std
::
string
>
validateInputs
()
override
;
};
}
// namespace Algorithm
...
...
Framework/Algorithms/inc/MantidAlgorithms/CalMuonDetectorPhases.h
View file @
b396588f
...
...
@@ -51,13 +51,15 @@ public:
/// Algorithm's category for identification overriding a virtual method
const
std
::
string
category
()
const
override
{
return
"Muon"
;
}
protected:
/// Validate the inputs
std
::
map
<
std
::
string
,
std
::
string
>
validateInputs
()
override
;
private:
/// Initialise the algorithm
void
init
()
override
;
/// Execute the algorithm
void
exec
()
override
;
/// Validate the inputs
std
::
map
<
std
::
string
,
std
::
string
>
validateInputs
()
override
;
/// Prepare workspace for fit by extracting data
API
::
MatrixWorkspace_sptr
extractDataFromWorkspace
(
double
startTime
,
double
endTime
);
...
...
Framework/Algorithms/inc/MantidAlgorithms/CalculateFlatBackground.h
View file @
b396588f
...
...
@@ -85,8 +85,8 @@ private:
void
convertToDistribution
(
API
::
MatrixWorkspace_sptr
workspace
);
void
restoreDistributionState
(
API
::
MatrixWorkspace_sptr
workspace
);
void
checkRange
(
double
&
startX
,
double
&
endX
);
void
get
Spec
Inds
(
std
::
vector
<
int
>
&
output
,
const
int
workspaceTotal
);
double
Mean
(
const
API
::
MatrixWorkspace_const_sptr
WS
,
const
int
s
pec
Ind
,
void
get
Ws
Inds
(
std
::
vector
<
int
>
&
output
,
const
int
workspaceTotal
);
double
Mean
(
const
API
::
MatrixWorkspace_const_sptr
WS
,
const
int
w
sInd
,
const
double
startX
,
const
double
endX
,
double
&
variance
)
const
;
double
LinearFit
(
API
::
MatrixWorkspace_sptr
WS
,
int
spectrum
,
double
startX
,
double
endX
);
...
...
Framework/Algorithms/inc/MantidAlgorithms/ChangeBinOffset.h
View file @
b396588f
#ifndef MANTID_ALGORITHM_CHANGEBINOFFSET_H_
#define MANTID_ALGORITHM_CHANGEBINOFFSET_H_
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#include
"MantidAPI/Algorithm.h"
#include
"MantidAPI/Workspace_fwd.h"
#include
"MantidAlgorithms/SpectrumAlgorithm.h"
namespace
Mantid
{
namespace
Algorithms
{
...
...
@@ -43,12 +39,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
File change history is stored at: <https://github.com/mantidproject/mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class
DLLExport
ChangeBinOffset
:
public
API
::
Algorithm
{
class
DLLExport
ChangeBinOffset
:
public
Spectrum
Algorithm
{
public:
/// Default constructor
ChangeBinOffset
();
/// Destructor
~
ChangeBinOffset
()
override
;
/// Algorithm's name for identification overriding a virtual method
const
std
::
string
name
()
const
override
{
return
"ChangeBinOffset"
;
}
/// Summary of algorithms purpose
...
...
@@ -65,25 +57,10 @@ public:
const
std
::
string
alias
()
const
override
{
return
"OffsetX"
;
}
private:
//
Overridde
n
A
lgorithm
methods
//
/ Initialisation method. Declares properties to be used i
n
a
lgorithm
.
void
init
()
override
;
/// Executes the algorithm
void
exec
()
override
;
/// Execute algorithm for EventWorkspaces
void
execEvent
();
/// Create output workspace
API
::
MatrixWorkspace_sptr
createOutputWS
(
API
::
MatrixWorkspace_sptr
input
);
/// The progress reporting object
API
::
Progress
*
m_progress
;
/// Offset to shift by
double
offset
;
/// Start workspace index
int64_t
wi_min
;
/// Stop workspace index
int64_t
wi_max
;
};
}
// namespace Algorithm
...
...
Prev
1
2
3
4
5
…
25
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment