\(\renewcommand\AA{\unicode{x212B}}\)

CreateSampleShape v1

../_images/ImageNotFound.png

Enable screenshots using DOCS_SCREENSHOTS in CMake

Summary

Create a shape object to model the sample.

See Also

SetSample, AbsorptionCorrection, SetSampleMaterial, CopySample

This algorithm is also known as: SetSampleShape

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.

Note

It is recommended that you use SetSample instead.

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: AlgorithmIndex | Sample

Source

C++ header: CreateSampleShape.h

C++ source: CreateSampleShape.cpp