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
c639106f
Commit
c639106f
authored
9 years ago
by
Anton Piccardo-Selg
Browse files
Options
Downloads
Patches
Plain Diff
Refs #13872 Update doctests
parent
284173ca
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
docs/source/algorithms/IntegratePeaksHybrid-v1.rst
+27
-8
27 additions, 8 deletions
docs/source/algorithms/IntegratePeaksHybrid-v1.rst
docs/source/algorithms/IntegratePeaksUsingClusters-v1.rst
+28
-11
28 additions, 11 deletions
docs/source/algorithms/IntegratePeaksUsingClusters-v1.rst
with
55 additions
and
19 deletions
docs/source/algorithms/IntegratePeaksHybrid-v1.rst
+
27
−
8
View file @
c639106f
...
...
@@ -63,14 +63,33 @@ Usage
.. testcode:: IntegratePeaksUsingClustersExample
# Load an MDEventWorkspace (QLab) containing some SC diffration peaks
mdew = Load("TOPAZ_3680_5_sec_MDEW.nxs")
# The following algorithms need to know that frame to use, this is an older file. Newer files will automaticall have this.
SetSpecialCoordinates(InputWorkspace=mdew, SpecialCoordinates='Q (lab frame)')
# Find the 5 most intense peaks
peaks = FindPeaksMD(InputWorkspace=mdew, MaxPeaks=5)
# Perform the integration
integrated_peaks, cluster_images = IntegratePeaksHybrid(InputWorkspace=mdew, PeaksWorkspace=peaks, BackgroundOuterRadius=0.4)
import os
def make_input_workspaces():
instrument_path = os.path.join(config.getInstrumentDirectory(), 'SXD_Definition.xml')
sxd = LoadEmptyInstrument(Filename=instrument_path)
# Set lattice parameters
SetUB(sxd, 5.6, 5.6, 5.6, 90, 90, 90)
# Predict peaks
predicted = PredictPeaks(sxd)
# Keep every 20th predicted peak for speed
rows_to_delete = set(range(predicted.getNumberPeaks())) - set([i for i in range(predicted.getNumberPeaks()) if i % 20 == 0])
DeleteTableRows(predicted, Rows=list(rows_to_delete))
# Set the Frame to QLab
mdws = CreateMDWorkspace(Dimensions=3, Extents='-10,10,-10,10,-10,10',
Names='Q_lab_x,Q_lab_y,Q_lab_z', Frames = "QLab,QLab,QLab",
Units='U,U,U')
qlab = predicted.column('QLab')
peak_radius = 0.1
n_events = 1000
for coords in qlab:
FakeMDEventData(InputWorkspace=mdws, PeakParams=[n_events, coords.X(), coords.Y(), coords.Z(), peak_radius])
return (predicted, mdws, peak_radius)
predicted, mdws, peak_radius = make_input_workspaces()
# Perform the integration
integrated, clusters = IntegratePeaksHybrid(InputWorkspace=mdws, PeaksWorkspace=predicted, NumberOfBins=10, BackgroundOuterRadius=peak_radius*3)
.. categories::
...
...
This diff is collapsed.
Click to expand it.
docs/source/algorithms/IntegratePeaksUsingClusters-v1.rst
+
28
−
11
View file @
c639106f
...
...
@@ -95,17 +95,34 @@ Usage
.. testcode:: IntegratePeaksUsingClustersExample
# Load an MDEventWorkspace (QLab) containing some SC diffration peaks
mdew = Load("TOPAZ_3680_5_sec_MDEW.nxs")
# The following algorithms need to know that frame to use, this is an older file. Newer files will automaticall have this.
SetSpecialCoordinates(InputWorkspace=mdew, SpecialCoordinates='Q (lab frame)')
# Find the 5 most intense peaks
peaks = FindPeaksMD(InputWorkspace=mdew, MaxPeaks=5)
# Bin to a 100 by 100 by 100 image. A 300 by 300 by 300 image is better.
mdhw = BinMD(InputWorkspace=mdew, AxisAligned=True,AlignedDim0='Q_lab_x,0,8,100', AlignedDim1='Q_lab_y,-10,10,100', AlignedDim2='Q_lab_z,0,10,100')
# Perform the integration
integrated_peaks, cluster_image = IntegratePeaksUsingClusters(InputWorkspace=mdhw, PeaksWorkspace=peaks, Threshold=1e7)
import os
def make_input_workspaces():
instrument_path = os.path.join(config.getInstrumentDirectory(), 'SXD_Definition.xml')
sxd = LoadEmptyInstrument(Filename=instrument_path)
# Set lattice parameters
SetUB(sxd, 5.6, 5.6, 5.6, 90, 90, 90)
# Predict peaks
predicted = PredictPeaks(sxd)
# Keep every 20th predicted peak for speed
rows_to_delete = set(range(predicted.getNumberPeaks())) - set([i for i in range(predicted.getNumberPeaks()) if i % 20 == 0])
DeleteTableRows(predicted, Rows=list(rows_to_delete))
# Set the Frame to QLab
mdws = CreateMDWorkspace(Dimensions=3, Extents='-10,10,-10,10,-10,10',
Names='Q_lab_x,Q_lab_y,Q_lab_z', Frames = "QLab,QLab,QLab",
Units='U,U,U')
qlab = predicted.column('QLab')
peak_radius = 0.1
n_events = 1000
for coords in qlab:
FakeMDEventData(InputWorkspace=mdws, PeakParams=[n_events, coords.X(), coords.Y(), coords.Z(), peak_radius])
# Create MDHisto workspace
mdws_binned = BinMD(InputWorkspace=mdws, AlignedDim0='Q_lab_x,-10,10,20', AlignedDim1='Q_lab_y,-10,10,200', AlignedDim2='Q_lab_z,-10,10,200')
return (predicted, mdws_binned, peak_radius)
predicted, mdws_binned, peak_radius = make_input_workspaces()
# Perform the integration
integrated, clusters = IntegratePeaksUsingClusters(InputWorkspace=mdws_binned, PeaksWorkspace=predicted, Threshold=1e7)
.. categories::
...
...
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