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
5551241d
Commit
5551241d
authored
6 years ago
by
Lynch, Vickie
Browse files
Options
Downloads
Patches
Plain Diff
Refs #24333 flake8 fixes
parent
4b188774
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/OptimizeCrystalPlacementByRun.py
+6
-10
6 additions, 10 deletions
...rface/plugins/algorithms/OptimizeCrystalPlacementByRun.py
with
6 additions
and
10 deletions
Framework/PythonInterface/plugins/algorithms/OptimizeCrystalPlacementByRun.py
+
6
−
10
View file @
5551241d
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
# SPDX - License - Identifier: GPL - 3.0 +
# SPDX - License - Identifier: GPL - 3.0 +
#pylint: disable=no-init
#pylint: disable=no-init
from
mantid.api
import
PythonAlgorithm
,
AlgorithmFactory
,
ITableWorkspaceProperty
,
WorkspaceFactory
from
mantid.api
import
PythonAlgorithm
,
AlgorithmFactory
,
ITableWorkspaceProperty
from
mantid.kernel
import
Direction
from
mantid.kernel
import
Direction
from
mantid.simpleapi
import
*
from
mantid.simpleapi
import
*
from
mantid
import
mtd
from
mantid
import
mtd
...
@@ -30,7 +30,7 @@ class OptimizeCrystalPlacementByRun(PythonAlgorithm):
...
@@ -30,7 +30,7 @@ class OptimizeCrystalPlacementByRun(PythonAlgorithm):
self
.
declareProperty
(
ITableWorkspaceProperty
(
"
InputWorkspace
"
,
""
,
Direction
.
Input
),
self
.
declareProperty
(
ITableWorkspaceProperty
(
"
InputWorkspace
"
,
""
,
Direction
.
Input
),
"
The name of the peaks workspace that will be optimized.
"
)
"
The name of the peaks workspace that will be optimized.
"
)
self
.
declareProperty
(
"
Tolerance
"
,
0.15
,
"
Tolerance of indexing of peaks.
"
)
self
.
declareProperty
(
"
Tolerance
"
,
0.15
,
"
Tolerance of indexing of peaks.
"
)
self
.
declareProperty
(
"
OutputWorkspace
"
,
""
,
self
.
declareProperty
(
"
OutputWorkspace
"
,
""
,
"
The name of the peaks workspace that will be created.
"
)
"
The name of the peaks workspace that will be created.
"
)
def
PyExec
(
self
):
def
PyExec
(
self
):
...
@@ -47,11 +47,10 @@ class OptimizeCrystalPlacementByRun(PythonAlgorithm):
...
@@ -47,11 +47,10 @@ class OptimizeCrystalPlacementByRun(PythonAlgorithm):
minR
=
int
(
stats
.
column
(
'
RunNumber
'
)[
stat_col
.
index
(
'
Minimum
'
)])
minR
=
int
(
stats
.
column
(
'
RunNumber
'
)[
stat_col
.
index
(
'
Minimum
'
)])
maxR
=
int
(
stats
.
column
(
'
RunNumber
'
)[
stat_col
.
index
(
'
Maximum
'
)])
+
1
maxR
=
int
(
stats
.
column
(
'
RunNumber
'
)[
stat_col
.
index
(
'
Maximum
'
)])
+
1
AnalysisDataService
.
remove
(
stats
.
getName
())
AnalysisDataService
.
remove
(
stats
.
getName
())
group
=
[]
group
=
[]
for
run
in
range
(
minR
,
maxR
):
for
run
in
range
(
minR
,
maxR
):
FilterPeaks
(
InputWorkspace
=
ws
,
OutputWorkspace
=
str
(
run
),
FilterVariable
=
'
RunNumber
'
,
FilterPeaks
(
InputWorkspace
=
ws
,
OutputWorkspace
=
str
(
run
),
FilterVariable
=
'
RunNumber
'
,
FilterValue
=
run
,
Operator
=
'
=
'
)
FilterValue
=
run
,
Operator
=
'
=
'
)
run
=
mtd
[
str
(
run
)]
run
=
mtd
[
str
(
run
)]
peaks
=
run
.
getNumberPeaks
()
peaks
=
run
.
getNumberPeaks
()
if
peaks
==
0
:
if
peaks
==
0
:
...
@@ -59,10 +58,8 @@ class OptimizeCrystalPlacementByRun(PythonAlgorithm):
...
@@ -59,10 +58,8 @@ class OptimizeCrystalPlacementByRun(PythonAlgorithm):
else
:
else
:
group
.
append
(
str
(
run
))
group
.
append
(
str
(
run
))
GroupWorkspaces
(
InputWorkspaces
=
group
,
OutputWorkspace
=
ws_group
)
GroupWorkspaces
(
InputWorkspaces
=
group
,
OutputWorkspace
=
ws_group
)
OptimizeCrystalPlacement
(
PeaksWorkspace
=
ws_group
,
ModifiedPeaksWorkspace
=
ws_group
,
AdjustSampleOffsets
=
True
,
OptimizeCrystalPlacement
(
PeaksWorkspace
=
ws_group
,
ModifiedPeaksWorkspace
=
ws_group
,
AdjustSampleOffsets
=
True
,
MaxSamplePositionChangeMeters
=
0.005
,
MaxIndexingError
=
tolerance
)
MaxSamplePositionChangeMeters
=
0.005
,
MaxIndexingError
=
tolerance
)
RenameWorkspace
(
InputWorkspace
=
str
(
minR
),
OutputWorkspace
=
ws_append
)
RenameWorkspace
(
InputWorkspace
=
str
(
minR
),
OutputWorkspace
=
ws_append
)
for
run
in
range
(
minR
+
1
,
maxR
):
for
run
in
range
(
minR
+
1
,
maxR
):
if
AnalysisDataService
.
doesExist
(
str
(
run
)):
if
AnalysisDataService
.
doesExist
(
str
(
run
)):
...
@@ -72,7 +69,6 @@ class OptimizeCrystalPlacementByRun(PythonAlgorithm):
...
@@ -72,7 +69,6 @@ class OptimizeCrystalPlacementByRun(PythonAlgorithm):
num
,
err
=
IndexPeaks
(
PeaksWorkspace
=
ws_append
,
Tolerance
=
tolerance
)
num
,
err
=
IndexPeaks
(
PeaksWorkspace
=
ws_append
,
Tolerance
=
tolerance
)
logger
.
notice
(
'
After Optimization Number indexed: %s error: %s
\n
'
%
(
num
,
err
))
logger
.
notice
(
'
After Optimization Number indexed: %s error: %s
\n
'
%
(
num
,
err
))
AnalysisDataService
.
remove
(
ws_group
)
AnalysisDataService
.
remove
(
ws_group
)
self
.
setProperty
(
"
OutputWorkspace
"
,
ws_append
)
self
.
setProperty
(
"
OutputWorkspace
"
,
ws_append
)
...
...
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