Skip to content

Commit

Permalink
Merge pull request #512 from mantidproject/11436_doc_test_SCDCalibrat…
Browse files Browse the repository at this point in the history
…ePanels

Added doc test for SCDCalibratePanels
  • Loading branch information
FedeMPouzols committed Apr 2, 2015
2 parents 631df69 + 35e34a9 commit adb1cbf
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 12 deletions.
1 change: 1 addition & 0 deletions Code/Mantid/Testing/Data/DocTest/MANDI_801.peaks.md5
@@ -0,0 +1 @@
eca8af9c1ce4bd2b534f00ee50ab8ae7
46 changes: 34 additions & 12 deletions Code/Mantid/docs/source/algorithms/SCDCalibratePanels-v1.rst
Expand Up @@ -96,16 +96,38 @@ the InputWorkspace and the workspace you want to copy the calibration
to, the OutputWorkspace.

Usage
------

**Example - SCDCalibratePanels:**

LoadIsawPeaks(Filename='MANDI_801.peaks', OutputWorkspace='peaks')
SCDCalibratePanels(PeakWorkspace='peaks',DetCalFilename='mandi_801.DetCal',XmlFilename='mandi_801.xml',a=74,b=74.5,c=99.9,alpha=90,beta=90,gamma=60)
Load(Filename='MANDI_801_event.nxs', OutputWorkspace='MANDI_801_event')
CloneWorkspace(InputWorkspace='MANDI_801_event', OutputWorkspace='MANDI_801_event_xml')
LoadParameterFile(Workspace='MANDI_801_event_xml', Filename='mandi_801.xml')
RenameWorkspace(InputWorkspace='MANDI_801_event_xml', OutputWorkspace='MANDI_801_event_DetCal')
LoadIsawDetCal(InputWorkspace='MANDI_801_event_DetCal', Filename='mandi_801.DetCal')

-----

.. testcode:: SCDCalibratePanels

#Calibrate peaks file and load to workspace
LoadIsawPeaks(Filename='MANDI_801.peaks', OutputWorkspace='peaks')
#TimeOffset is not stored in xml file, so use DetCal output if you need TimeOffset
SCDCalibratePanels(PeakWorkspace='peaks',DetCalFilename='mandi_801.DetCal',XmlFilename='mandi_801.xml',a=74,b=74.5,c=99.9,alpha=90,beta=90,gamma=60,usetimeOffset=False)
LoadEmptyInstrument(Filename='MANDI_Definition_2013_08_01.xml', OutputWorkspace='MANDI_801_event_DetCal')
CloneWorkspace(InputWorkspace='MANDI_801_event_DetCal', OutputWorkspace='MANDI_801_event_xml')
LoadParameterFile(Workspace='MANDI_801_event_xml', Filename='mandi_801.xml')
LoadIsawDetCal(InputWorkspace='MANDI_801_event_DetCal', Filename='mandi_801.DetCal')
det1 = mtd['MANDI_801_event_DetCal'].getInstrument().getDetector(327680)
det2 = mtd['MANDI_801_event_xml'].getInstrument().getDetector(327680)
if det1.getPos() == det2.getPos():
print "matches"

.. testcleanup:: SCDCalibratePanels

DeleteWorkspace('peaks')
DeleteWorkspace('MANDI_801_event_xml')
DeleteWorkspace('MANDI_801_event_DetCal')
import os,mantid
filename=mantid.config.getString("defaultsave.directory")+"mandi_801.xml"
os.remove(filename)
filename=mantid.config.getString("defaultsave.directory")+"mandi_801.DetCal"
os.remove(filename)

Output:

.. testoutput:: SCDCalibratePanels

matches

.. categories::

0 comments on commit adb1cbf

Please sign in to comment.