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
c1061498
Commit
c1061498
authored
10 years ago
by
Roman Tolchenov
Browse files
Options
Downloads
Patches
Plain Diff
Re #9579. Added Usage section to ChangeBinOffset doc
parent
0eba20b3
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Code/Mantid/docs/source/algorithms/ChangeBinOffset-v1.rst
+28
-0
28 additions, 0 deletions
Code/Mantid/docs/source/algorithms/ChangeBinOffset-v1.rst
Code/Mantid/docs/source/algorithms/SplineBackground-v1.rst
+7
-0
7 additions, 0 deletions
Code/Mantid/docs/source/algorithms/SplineBackground-v1.rst
with
35 additions
and
0 deletions
Code/Mantid/docs/source/algorithms/ChangeBinOffset-v1.rst
+
28
−
0
View file @
c1061498
...
...
@@ -20,4 +20,32 @@ selectively using the IndexMin and IndexMax properties.
The output workspace will be an exact copy of the input workspace except
for the changed time bins.
Usage
-----
.. testcode:: ExOffset
import numpy as np
# Create a workspace
ws = CreateSampleWorkspace()
# Offset the time bins by 1.0
wsOffset = ChangeBinOffset(ws,Offset=1.0)
# Check the offset
x1 = ws.readX(0)
x2 = wsOffset.readX(0)
# Test that all elements of arrays x2 and x1 differ by 1.0
print np.all( x2 - x1 == 1.0 )
y1 = ws.readY(0)
y2 = wsOffset.readY(0)
# Test that arrays y2 and y1 are equal
print np.all( y2 == y1 )
.. testoutput:: ExOffset
True
True
.. categories::
This diff is collapsed.
Click to expand it.
Code/Mantid/docs/source/algorithms/SplineBackground-v1.rst
+
7
−
0
View file @
c1061498
...
...
@@ -22,19 +22,26 @@ Usage
import numpy as np
# Create a workspace with some data
# Fill array x with 100 float values equally spaced in the interval [-10, 10]
x = np.linspace(-10,10,100)
# Fill array y with values of a function for each number in array x. y has the same length as x
y = 1.0 / (x**2 + 10)
# Create array e of the same length as x and fill it with ones (1.0)
e = np.ones_like(x)
# Uses the above arrays to create a workspace
ws = CreateWorkspace( x, y, e )
# Run algorithm with low number of spline coefficients
out = SplineBackground(ws, WorkspaceIndex=0, NCoeff=4)
yout = out.readY(0)
# Sum the squares of the differences of elements of arrays y and yout
print 'Fit quality is',np.sum( (y - yout)**2 )
# Increase the number of spline coefficients
out = SplineBackground(ws, WorkspaceIndex=0, NCoeff=20)
yout = out.readY(0)
# Sum the squares of the differences of elements of arrays y and yout
print 'Fit quality is',np.sum( (y - yout)**2 )
.. testoutput:: ExampleSpline
...
...
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