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
3f089218
Commit
3f089218
authored
9 years ago
by
Lamar Moore
Browse files
Options
Downloads
Patches
Plain Diff
Re #14252 Added progress Report to CreateSampleWorkspace algorithm
parent
a270ad46
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Framework/Algorithms/inc/MantidAlgorithms/CreateSampleWorkspace.h
+2
-2
2 additions, 2 deletions
...k/Algorithms/inc/MantidAlgorithms/CreateSampleWorkspace.h
Framework/Algorithms/src/CreateSampleWorkspace.cpp
+17
-7
17 additions, 7 deletions
Framework/Algorithms/src/CreateSampleWorkspace.cpp
with
19 additions
and
9 deletions
Framework/Algorithms/inc/MantidAlgorithms/CreateSampleWorkspace.h
+
2
−
2
View file @
3f089218
...
...
@@ -53,12 +53,12 @@ private:
void
exec
();
DataObjects
::
EventWorkspace_sptr
createEventWorkspace
(
int
numPixels
,
int
numBins
,
int
numEvents
,
double
x0
,
createEventWorkspace
(
API
::
Progress
&
progress
,
int
numPixels
,
int
numBins
,
int
numEvents
,
double
x0
,
double
binDelta
,
int
start_at_pixelID
,
Geometry
::
Instrument_sptr
inst
,
const
std
::
string
&
functionString
,
bool
isRandom
);
API
::
MatrixWorkspace_sptr
createHistogramWorkspace
(
int
numPixels
,
int
numBins
,
double
x0
,
createHistogramWorkspace
(
API
::
Progress
&
progress
,
int
numPixels
,
int
numBins
,
double
x0
,
double
binDelta
,
int
start_at_pixelID
,
Geometry
::
Instrument_sptr
inst
,
const
std
::
string
&
functionString
,
bool
isRandom
);
...
...
This diff is collapsed.
Click to expand it.
Framework/Algorithms/src/CreateSampleWorkspace.cpp
+
17
−
7
View file @
3f089218
...
...
@@ -203,21 +203,27 @@ void CreateSampleWorkspace::exec() {
}
m_randGen
=
new
Kernel
::
MersenneTwister
(
seedValue
);
}
// Create an instrument with one or more rectangular banks.
Instrument_sptr
inst
=
createTestInstrumentRectangular
(
numBanks
,
bankPixelWidth
,
pixelSpacing
,
bankDistanceFromSample
,
sourceSampleDistance
);
int
num_bins
=
static_cast
<
int
>
((
xMax
-
xMin
)
/
binWidth
);
int
numPixels
=
numBanks
*
bankPixelWidth
*
bankPixelWidth
;
Progress
progress
(
this
,
0
,
1
,
numPixels
);
MatrixWorkspace_sptr
ws
;
if
(
wsType
==
"Event"
)
{
ws
=
createEventWorkspace
(
numBanks
*
bankPixelWidth
*
bankPixelWidth
,
num_bins
,
numEvents
,
xMin
,
binWidth
,
ws
=
createEventWorkspace
(
progress
,
numPixels
,
num_bins
,
numEvents
,
xMin
,
binWidth
,
bankPixelWidth
*
bankPixelWidth
,
inst
,
functionString
,
isRandom
);
}
else
{
ws
=
createHistogramWorkspace
(
numBanks
*
bankPixelWidth
*
bankPixelWidth
,
num_bins
,
xMin
,
binWidth
,
progress
,
numPixels
,
num_bins
,
xMin
,
binWidth
,
bankPixelWidth
*
bankPixelWidth
,
inst
,
functionString
,
isRandom
);
}
// add chopper
...
...
@@ -282,8 +288,8 @@ void CreateSampleWorkspace::addChopperParameters(
/** Create histogram workspace
*/
MatrixWorkspace_sptr
CreateSampleWorkspace
::
createHistogramWorkspace
(
int
numPixels
,
int
numBins
,
double
x0
,
double
binDelta
,
int
start_at_pixelID
,
Geometry
::
Instrument_sptr
inst
,
API
::
Progress
&
progress
,
int
numPixels
,
int
numBins
,
double
x0
,
double
binDelta
,
int
start_at_pixelID
,
Geometry
::
Instrument_sptr
inst
,
const
std
::
string
&
functionString
,
bool
isRandom
)
{
MantidVecPtr
x
,
y
,
e
;
x
.
access
().
resize
(
numBins
+
1
);
...
...
@@ -311,6 +317,8 @@ MatrixWorkspace_sptr CreateSampleWorkspace::createHistogramWorkspace(
retVal
->
setData
(
wi
,
y
,
e
);
retVal
->
getSpectrum
(
wi
)
->
setDetectorID
(
detid_t
(
start_at_pixelID
+
wi
));
retVal
->
getSpectrum
(
wi
)
->
setSpectrumNo
(
specid_t
(
wi
+
1
));
progress
.
report
();
}
return
retVal
;
...
...
@@ -319,8 +327,8 @@ MatrixWorkspace_sptr CreateSampleWorkspace::createHistogramWorkspace(
/** Create event workspace
*/
EventWorkspace_sptr
CreateSampleWorkspace
::
createEventWorkspace
(
int
numPixels
,
int
numBins
,
int
numEvents
,
double
x0
,
double
binDelta
,
int
start_at_pixelID
,
Geometry
::
Instrument_sptr
inst
,
API
::
Progress
&
progress
,
int
numPixels
,
int
numBins
,
int
numEvents
,
double
x0
,
double
binDelta
,
int
start_at_pixelID
,
Geometry
::
Instrument_sptr
inst
,
const
std
::
string
&
functionString
,
bool
isRandom
)
{
DateAndTime
run_start
(
"2010-01-01T00:00:00"
);
...
...
@@ -375,6 +383,8 @@ EventWorkspace_sptr CreateSampleWorkspace::createEventWorkspace(
run_start
+
(
m_randGen
->
nextValue
()
*
hourInSeconds
);
el
+=
TofEvent
((
i
+
m_randGen
->
nextValue
())
*
binDelta
,
pulseTime
);
}
progress
.
report
();
}
workspaceIndex
++
;
}
...
...
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