Skip to content
Snippets Groups Projects
Commit 86e7af94 authored by Sullivan, Brendan T's avatar Sullivan, Brendan T
Browse files

Re #0 add documentation

parent a42050b3
No related branches found
No related tags found
No related merge requests found
...@@ -45,10 +45,10 @@ DECLARE_ALGORITHM(SetCrystalLocation) ...@@ -45,10 +45,10 @@ DECLARE_ALGORITHM(SetCrystalLocation)
void SetCrystalLocation::init() { void SetCrystalLocation::init() {
declareProperty(make_unique<WorkspaceProperty<EventWorkspace>>( declareProperty(make_unique<WorkspaceProperty<EventWorkspace>>(
"EventWorkspace", "", Direction::Input), "InputWorkspace", "", Direction::Input),
"Original event workspace"); "Original event workspace");
declareProperty( declareProperty(
make_unique<WorkspaceProperty<EventWorkspace>>("ModifiedEventWorkspace", make_unique<WorkspaceProperty<EventWorkspace>>("OutputWorkspace",
"", Direction::Output), "", Direction::Output),
"Output event workspace with a modified sample position"); "Output event workspace with a modified sample position");
declareProperty("NewX", 0.0, "New Absolute X position of crystal."); declareProperty("NewX", 0.0, "New Absolute X position of crystal.");
...@@ -59,8 +59,8 @@ void SetCrystalLocation::init() { ...@@ -59,8 +59,8 @@ void SetCrystalLocation::init() {
// simple algorithm that changes the sample position of the input // simple algorithm that changes the sample position of the input
// event workspace. // event workspace.
void SetCrystalLocation::exec() { void SetCrystalLocation::exec() {
EventWorkspace_sptr events = getProperty("EventWorkspace"); EventWorkspace_sptr events = getProperty("InputWorkspace");
EventWorkspace_sptr outEvents = getProperty("ModifiedEventWorkspace"); EventWorkspace_sptr outEvents = getProperty("OutputWorkspace");
double newX = getProperty("NewX"); double newX = getProperty("NewX");
double newY = getProperty("NewY"); double newY = getProperty("NewY");
double newZ = getProperty("NewZ"); double newZ = getProperty("NewZ");
...@@ -73,7 +73,7 @@ void SetCrystalLocation::exec() { ...@@ -73,7 +73,7 @@ void SetCrystalLocation::exec() {
CalibrationHelpers::adjustUpSampleAndSourcePositions( CalibrationHelpers::adjustUpSampleAndSourcePositions(
componentInfo.l1(), newSamplePos, componentInfo); componentInfo.l1(), newSamplePos, componentInfo);
setProperty("ModifiedEventWorkspace", outEvents); setProperty("OutputWorkspace", outEvents);
} // exec } // exec
} // namespace Crystal } // namespace Crystal
......
.. algorithm::
.. summary::
.. relatedalgorithms::
.. properties::
Description
-----------
This algorithm changes the sample location for an events workspace. If the InputWorkspace and OutputWorkspace are the same, the position is simply changed. If the InputWorkspace and OutputWorkspace are different, the InputWorkspace is cloned then the clone's position is changed. The former is faster, especially for large workspaces.
Usage
-----
**Example:**
.. testcode:: ExSetCrystalLocation
events = Load('TOPAZ_3007_bank_37_20_sec.nxs')
sample = mtd['events'].getInstrument().getSample()
print('Sample position before SetCrystalLocation: {}'.format(sample.getPos()))
SetCrystalLocation(InputWorkspace=events, OutputWorkspace=events, NewX=0.1, NewY=0.1, NewZ=0.1)
print('Sample position after SetCrystalLocation: {}'.format(sample.getPos()))
Output:
.. testoutput:: ExSetCrystalLocation
Sample position before SetCrystalLocation: [0,0,0]
Sample position after SetCrystalLocation: [0.1,0.1,0.1]
.. categories::
.. sourcelink::
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