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
2e262a3a
Commit
2e262a3a
authored
6 years ago
by
Lynch, Vickie
Browse files
Options
Downloads
Patches
Plain Diff
Refs #24333 logger not print
parent
a4db2b1f
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Framework/PythonInterface/plugins/algorithms/OptimizeCrystalPlacementByRun.py
+11
-8
11 additions, 8 deletions
...rface/plugins/algorithms/OptimizeCrystalPlacementByRun.py
with
11 additions
and
8 deletions
Framework/PythonInterface/plugins/algorithms/OptimizeCrystalPlacementByRun.py
+
11
−
8
View file @
2e262a3a
...
...
@@ -5,7 +5,6 @@
# & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
#pylint: disable=no-init
from
__future__
import
(
absolute_import
,
division
,
print_function
)
from
mantid.api
import
PythonAlgorithm
,
AlgorithmFactory
,
ITableWorkspaceProperty
,
WorkspaceFactory
from
mantid.kernel
import
Direction
...
...
@@ -42,33 +41,37 @@ class OptimizeCrystalPlacementByRun(PythonAlgorithm):
if
not
ws
.
sample
().
hasOrientedLattice
():
FindUBUsingIndexedPeaks
(
PeaksWorkspace
=
ws
,
Tolerance
=
tolerance
)
num
,
err
=
IndexPeaks
(
PeaksWorkspace
=
ws
,
Tolerance
=
tolerance
)
print
(
'
Initial Number indexed: %s error: %s
\n
'
%
(
num
,
err
))
logger
.
notice
(
'
Initial Number indexed: %s error: %s
\n
'
%
(
num
,
err
))
stats
=
StatisticsOfTableWorkspace
(
InputWorkspace
=
ws
)
stat_col
=
stats
.
column
(
'
Statistic
'
)
minR
=
int
(
stats
.
column
(
'
RunNumber
'
)[
stat_col
.
index
(
'
Minimum
'
)])
maxR
=
int
(
stats
.
column
(
'
RunNumber
'
)[
stat_col
.
index
(
'
Maximum
'
)])
+
1
AnalysisDataService
.
remove
(
stats
.
getName
())
group
=
[]
for
run
in
range
(
minR
,
maxR
):
FilterPeaks
(
InputWorkspace
=
ws
,
OutputWorkspace
=
str
(
run
),
FilterVariable
=
'
RunNumber
'
,
FilterValue
=
run
,
Operator
=
'
=
'
)
FilterPeaks
(
InputWorkspace
=
ws
,
OutputWorkspace
=
str
(
run
),
FilterVariable
=
'
RunNumber
'
,
FilterValue
=
run
,
Operator
=
'
=
'
)
run
=
mtd
[
str
(
run
)]
peaks
=
run
.
getNumberPeaks
()
if
peaks
==
0
:
AnalysisDataService
.
remove
(
str
(
run
))
AnalysisDataService
.
remove
(
str
(
run
))
else
:
group
.
append
(
str
(
run
))
GroupWorkspaces
(
InputWorkspaces
=
group
,
OutputWorkspace
=
ws_group
)
OptimizeCrystalPlacement
(
PeaksWorkspace
=
ws_group
,
ModifiedPeaksWorkspace
=
ws_group
,
AdjustSampleOffsets
=
True
,
MaxSamplePositionChangeMeters
=
0.005
,
MaxIndexingError
=
tolerance
)
OptimizeCrystalPlacement
(
PeaksWorkspace
=
ws_group
,
ModifiedPeaksWorkspace
=
ws_group
,
AdjustSampleOffsets
=
True
,
MaxSamplePositionChangeMeters
=
0.005
,
MaxIndexingError
=
tolerance
)
CloneWorkspace
(
InputWorkspace
=
str
(
minR
),
OutputWorkspace
=
ws_append
)
AnalysisDataService
.
remove
(
str
(
minR
))
for
run
in
range
(
minR
+
1
,
maxR
):
if
AnalysisDataService
.
doesExist
(
str
(
run
)):
if
AnalysisDataService
.
doesExist
(
str
(
run
)):
CombinePeaksWorkspaces
(
LHSWorkspace
=
ws_append
,
RHSWorkspace
=
str
(
run
),
OutputWorkspace
=
ws_append
)
print
(
'
Optimized %s sample position: %s
\n
'
%
(
str
(
run
),
mtd
[
str
(
run
)].
getPeak
(
0
).
getSamplePos
()))
logger
.
notice
(
'
Optimized %s sample position: %s
\n
'
%
(
str
(
run
),
mtd
[
str
(
run
)].
getPeak
(
0
).
getSamplePos
()))
AnalysisDataService
.
remove
(
str
(
run
))
num
,
err
=
IndexPeaks
(
PeaksWorkspace
=
ws_append
,
Tolerance
=
tolerance
)
print
(
'
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
)
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