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
6b1db88c
Commit
6b1db88c
authored
6 years ago
by
Tom Titcombe
Browse files
Options
Downloads
Patches
Plain Diff
Merge ws zeroing and moving to one function
Refs #23960
parent
16922b3d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANS/SANSLoad.py
+38
-23
38 additions, 23 deletions
...ce/plugins/algorithms/WorkflowAlgorithms/SANS/SANSLoad.py
with
38 additions
and
23 deletions
Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANS/SANSLoad.py
+
38
−
23
View file @
6b1db88c
...
...
@@ -145,18 +145,17 @@ class SANSLoad(ParallelDataProcessorAlgorithm):
progress
.
report
(
"
Loaded the data.
"
)
# Centre the workspaces
progress
.
report
(
"
Centring the workspace.
"
)
self
.
_centre
(
workspaces
,
state
)
progress
.
report
(
"
Finished centring the workspace
"
)
#
progress.report("Centring the workspace.")
#
self._centre(workspaces, state)
#
progress.report("Finished centring the workspace")
# Check if a move has been requested and perform it. This can be useful if scientists want to load the data and
# have it moved in order to inspect it with other tools
move_workspaces
=
self
.
getProperty
(
"
MoveWorkspace
"
).
value
if
move_workspaces
:
progress_move
=
Progress
(
self
,
start
=
0.8
,
end
=
1.0
,
nreports
=
2
)
progress_move
.
report
(
"
Starting to move the workspaces.
"
)
self
.
_perform_initial_move
(
workspaces
,
state
)
progress_move
.
report
(
"
Finished moving the workspaces.
"
)
progress_move
=
Progress
(
self
,
start
=
0.8
,
end
=
1.0
,
nreports
=
2
)
progress_move
.
report
(
"
Starting to move the workspaces.
"
)
workspaces
=
self
.
_perform_initial_move
(
workspaces
,
state
,
move_workspaces
)
progress_move
.
report
(
"
Finished moving the workspaces.
"
)
# Set output workspaces
for
workspace_type
,
workspace
in
list
(
workspaces
.
items
()):
...
...
@@ -347,34 +346,50 @@ class SANSLoad(ParallelDataProcessorAlgorithm):
move_alg
=
create_child_algorithm
(
self
,
move_name
,
**
move_options
)
for
key
,
workspace_list
in
workspaces
.
items
():
for
workspace
in
list
(
workspace_list
):
# The workspaces are stored in a dict: workspace_names (sample_scatter, etc) : ListOfWorkspaces
for
key
,
workspace_list
in
list
(
workspaces
.
items
()):
for
workspace
in
workspace_list
:
move_alg
.
setProperty
(
"
Workspace
"
,
workspace
)
move_alg
.
execute
()
def
_perform_initial_move
(
self
,
workspaces
,
state
):
def
_perform_initial_move
(
self
,
workspaces
,
state
,
perform_move
):
move_name
=
"
SANSMove
"
state_dict
=
state
.
property_manager
zero_options
=
{
"
SANSState
"
:
state_dict
,
"
MoveType
"
:
"
SetToZero
"
,
"
Component
"
:
""
}
move_options
=
{
"
SANSState
"
:
state_dict
,
"
MoveType
"
:
"
InitialMove
"
}
# If beam centre was specified then use it
beam_coordinates
=
self
.
getProperty
(
"
BeamCoordinates
"
).
value
if
beam_coordinates
:
move_options
.
update
({
"
BeamCoordinates
"
:
beam_coordinates
})
# If component was specified then use it
component
=
self
.
getProperty
(
"
Component
"
).
value
if
beam_coordinates
:
move_options
.
update
({
"
Component
"
:
component
})
zero_alg
=
create_child_algorithm
(
self
,
move_name
,
**
zero_options
)
move_alg
=
create_child_algorithm
(
self
,
move_name
,
**
move_options
)
# The workspaces are stored in a dict: workspace_names (sample_scatter, etc) : ListOfWorkspaces
new_ws
=
{}
for
key
,
workspace_list
in
list
(
workspaces
.
items
()):
new_ws_list
=
[]
for
workspace
in
workspace_list
:
move_alg
.
setProperty
(
"
Workspace
"
,
workspace
)
move_alg
.
execute
()
zero_alg
.
setProperty
(
"
Workspace
"
,
workspace
)
zero_alg
.
execute
()
new_workspace
=
zero_alg
.
getProperty
(
"
Workspace
"
).
value
if
perform_move
:
# If beam centre was specified then use it
beam_coordinates
=
self
.
getProperty
(
"
BeamCoordinates
"
).
value
if
beam_coordinates
:
move_alg
.
setProperty
(
"
BeamCoordinates
"
,
beam_coordinates
)
# If component was specified then use it
component
=
self
.
getProperty
(
"
Component
"
).
value
if
beam_coordinates
:
move_alg
.
setProperty
(
"
Component
"
,
component
)
move_alg
.
setProperty
(
"
Workspace
"
,
new_workspace
)
move_alg
.
execute
()
new_workspace
=
move_alg
.
getProperty
(
"
Workspace
"
).
value
new_ws_list
.
append
(
new_workspace
)
new_ws
[
key
]
=
new_ws_list
return
new_ws
def
_get_progress_for_file_loading
(
self
,
data
):
# Get the number of workspaces which are to be loaded
...
...
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