Skip to content
Snippets Groups Projects
Commit f4cb058b authored by Samuel Jackson's avatar Samuel Jackson
Browse files

Refs #9584 Add examples for Stitch1D.

parent 7ef08b9c
No related branches found
No related tags found
No related merge requests found
......@@ -22,4 +22,53 @@ The workspaces must be histogrammed. Use
:ref:`algm-ConvertToHistogram` on workspaces prior to
passing them to this algorithm.
Usage
-----
**Example - a basic example using stitch1D to stitch two workspaces together.**
.. testcode:: ExStitch1DSimple
import numpy as np
def gaussian(x, mu, sigma):
"""Creates a gaussian peak centered on mu and with width sigma."""
return (1/ sigma * np.sqrt(2 * np.pi)) * np.exp( - (x-mu)**2 / (2*sigma**2))
#create two histograms with a single peak in each one
x1 = np.arange(-1, 1, 0.02)
x2 = np.arange(0.4, 1.6, 0.02)
ws1 = CreateWorkspace(UnitX="1/q", DataX=x1, DataY=gaussian(x1[:-1], 0, 0.1)+1)
ws2 = CreateWorkspace(UnitX="1/q", DataX=x2, DataY=gaussian(x2[:-1], 1, 0.05)+1)
#stitch the histograms together
stitched, scale = Stitch1D(LHSWorkspace=ws1, RHSWorkspace=ws2, StartOverlap=0.4, EndOverlap=0.6, Params=0.02)
Output:
.. image:: /images/Stitch1D1.png
:scale: 65 %
:alt: Stitch1D output
:align: center
**Example - a practical example using reflectometry data and a scale factor.**
.. testcode:: ExStitch1DPractical
trans1 = Load('INTER00013463')
trans2 = Load('INTER00013464')
trans1_wav = CreateTransmissionWorkspaceAuto(trans1)
trans2_wav = CreateTransmissionWorkspaceAuto(trans2)
stitched_wav, y = Stitch1D(trans1_wav, trans2_wav, UseManualScaleFactor=True, ManualScaleFactor=0.85)
Output:
.. image:: /images/Stitch1D2.png
:scale: 65 %
:alt: Stitch1D output
:align: center
.. categories::
Code/Mantid/docs/source/images/Stitch1D1.png

23.9 KiB

Code/Mantid/docs/source/images/Stitch1D2.png

38.8 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment