Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mantid
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mantidproject
mantid
Commits
48a7d489
Commit
48a7d489
authored
7 years ago
by
Peterson, Peter
Browse files
Options
Downloads
Patches
Plain Diff
Check SplittersWorkspace before running algorithm
parent
07cd4c28
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Framework/Algorithms/inc/MantidAlgorithms/FilterEvents.h
+1
-0
1 addition, 0 deletions
Framework/Algorithms/inc/MantidAlgorithms/FilterEvents.h
Framework/Algorithms/src/FilterEvents.cpp
+38
-7
38 additions, 7 deletions
Framework/Algorithms/src/FilterEvents.cpp
with
39 additions
and
7 deletions
Framework/Algorithms/inc/MantidAlgorithms/FilterEvents.h
+
1
−
0
View file @
48a7d489
...
...
@@ -72,6 +72,7 @@ public:
const
std
::
string
category
()
const
override
{
return
"Events
\\
EventFiltering"
;
}
std
::
map
<
std
::
string
,
std
::
string
>
validateInputs
()
override
;
private
:
// Implement abstract Algorithm methods
...
...
This diff is collapsed.
Click to expand it.
Framework/Algorithms/src/FilterEvents.cpp
+
38
−
7
View file @
48a7d489
...
...
@@ -171,6 +171,36 @@ void FilterEvents::init() {
"Otherwise, only those specified logs will be split."
);
}
std
::
map
<
std
::
string
,
std
::
string
>
FilterEvents
::
validateInputs
()
{
const
std
::
string
SPLITER_PROP_NAME
=
"SplitterWorkspace"
;
std
::
map
<
std
::
string
,
std
::
string
>
result
;
// check the splitters workspace for special behavior
API
::
Workspace_const_sptr
wksp
=
this
->
getProperty
(
SPLITER_PROP_NAME
);
// SplittersWorkspace is a special type that needs no further checking
if
(
!
bool
(
boost
::
dynamic_pointer_cast
<
const
SplittersWorkspace
>
(
wksp
)))
{
const
auto
table
=
boost
::
dynamic_pointer_cast
<
const
TableWorkspace
>
(
wksp
);
const
auto
matrix
=
boost
::
dynamic_pointer_cast
<
const
MatrixWorkspace
>
(
wksp
);
if
(
bool
(
table
))
{
if
(
table
->
columnCount
()
!=
3
)
result
[
SPLITER_PROP_NAME
]
=
"TableWorkspace must have 3 columns"
;
}
else
if
(
bool
(
matrix
))
{
if
(
matrix
->
getNumberHistograms
()
==
1
)
{
if
(
!
matrix
->
isHistogramData
())
result
[
SPLITER_PROP_NAME
]
=
"MatrixWorkspace must be histogram"
;
}
else
{
result
[
SPLITER_PROP_NAME
]
=
"MatrixWorkspace can have only one histogram"
;
}
}
else
{
result
[
SPLITER_PROP_NAME
]
=
"Incompatible workspace type"
;
}
}
return
result
;
}
/** Execution body
*/
void
FilterEvents
::
exec
()
{
...
...
@@ -845,23 +875,24 @@ void FilterEvents::processMatrixSplitterWorkspace() {
// Check input workspace validity
assert
(
m_matrixSplitterWS
);
auto
X
=
m_matrixSplitterWS
->
binEdges
(
0
);
auto
&
Y
=
m_matrixSplitterWS
->
y
(
0
);
size_t
sizex
=
X
.
size
();
size_t
sizey
=
Y
.
size
();
const
auto
X
=
m_matrixSplitterWS
->
binEdges
(
0
);
const
auto
&
Y
=
m_matrixSplitterWS
->
y
(
0
);
const
size_t
sizex
=
X
.
size
();
const
size_t
sizey
=
Y
.
size
();
// Assign vectors for time comparison
m_vecSplitterTime
.
assign
(
X
.
size
(),
0
);
m_vecSplitterGroup
.
assign
(
Y
.
size
(),
-
1
);
m_vecSplitterTime
.
assign
(
size
x
,
static_cast
<
int64_t
>
(
0
)
);
m_vecSplitterGroup
.
assign
(
size
y
,
static_cast
<
int
>
(
-
1
)
)
;
// Transform vector
for
(
size_t
i
=
0
;
i
<
sizex
;
++
i
)
{
m_vecSplitterTime
[
i
]
=
static_cast
<
int64_t
>
(
X
[
i
]
*
1.E9
);
}
// shift the splitters' time if user specifis that the input times are
// relative
if
(
m_isSplittersRelativeTime
)
{
int64_t
time_shift_ns
=
m_filterStartTime
.
totalNanoseconds
();
const
int64_t
time_shift_ns
=
m_filterStartTime
.
totalNanoseconds
();
for
(
size_t
i
=
0
;
i
<
sizex
;
++
i
)
m_vecSplitterTime
[
i
]
+=
time_shift_ns
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment