CreateSampleShape v1

../_images/CreateSampleShape-v1_dlg.png

CreateSampleShape dialog.

Summary

Create a shape object to model the sample.

Properties

Name Direction Type Default Description
InputWorkspace Input MatrixWorkspace Mandatory The workspace with which to associate the sample
ShapeXML Input string Mandatory The XML that describes the shape

Description

Creates a shape object that defines the sample and sets the sample for the given workspace. Shapes are defined using XML descriptions that can be found here.

Usage

Example - A Sphere

ws = CreateSampleWorkspace("Histogram",BankPixelWidth=1)

shape_xml = '''<sphere id="some-sphere">
  <centre x="0.0"  y="0.0" z="0.0" />
  <radius val="1.0" />
  </sphere>'''
CreateSampleShape(ws,shape_xml)

Example - A ball with a cylinder carved out of the middle

ws = CreateSampleWorkspace("Histogram",BankPixelWidth=1)

shape_xml = '''<cylinder id="stick">
  <centre-of-bottom-base x="-0.5" y="0.0" z="0.0" />
  <axis x="1.0" y="0.0" z="0.0" />
  <radius val="0.05" />
  <height val="1.0" />
  </cylinder>
  <sphere id="some-sphere">
  <centre x="0.0"  y="0.0" z="0.0" />
  <radius val="0.5" />
  </sphere>
  <algebra val="some-sphere (# stick)" />'''
CreateSampleShape(ws,shape_xml)

Categories: Algorithms | Sample | DataHandling