LoadMcStas v1

../_images/LoadMcStas-v1_dlg.png

LoadMcStas dialog.

Summary

Loads a McStas NeXus file into an workspace.

Properties

Name Direction Type Default Description
Filename Input string Mandatory The name of the Nexus file to load. Allowed extensions: [‘.h5’, ‘.nxs’]
OutputWorkspace Output Workspace Mandatory An output workspace.
ErrorBarsSetTo1 Input boolean False When this property is set to false errors are set equal to data values, and when set to true all errors are set equal to one. This property defaults to false

Description

Reads a McStas Nexus file into a Mantid WorkspaceGroup with a user-supplied name. Data generated by McStas monitor components are stored in workspaces of type Workspace2D or Event.

For further information about Mcstas and Mantid see here.

LoadMcStas replaces LoadMcStasEventNexus. LoadMcStas can be used for reading McStas 2.1 histogram and event data. LoadMcStasNexus can be used for reading McStas 2.0 histogram data.

McStas compiling and running

McStas 2.1 event data and the corresponding IDF for Mantid are generated as follows using these commands from an xterm:

  • Compile McStas instrument code: mcstas templateSANS_Mantid.instr --trace
  • Compile c code: gcc -o templateSANS_Mantid.out templateSANS_Mantid.c -lm -DUSE_NEXUS -lNeXus
  • Generate IDF: mcdisplay templateSANS_Mantid.instr --format=Mantid -n0
  • Run simulation: ./templateSANS_Mantid.out --format=Nexus

The templateSANS_Mantid.instr file used in the above example can be found in McStas neutron suite.

McStas event data conventions

For McStas to auto generate an IDF the McStas instrument file must obey:

  • McStas instrument file name and the McStas defined name of the instrument must be the same E.g. templateSANS_Mantid.instr and "DEFINE INSTRUMENT templateSANS_Mantid(.... )"
  • In the McStas instrument file the source must be named “souceMantid” E.g. "COMPONENT sourceMantid = Source_simple(.... )"
  • In the McStas instrument file the sample must be named “sampleMantid” E.g. "COMPONENT sampleMantid = Sans_spheres(.... )"
  • In the McStas instrument file the event monitors must be named “nD_Mantid_#” E.g. "COMPONENT nD_Mantid_1 = Monitor_nD(.... )"

The McStas component monitor_nD must be called with the argument: options =”mantid square x limits=[-0.2 0.2] bins=128 y limits=[-0.2 0.2] bins=128, neutron pixel t, list all neutrons”. Number of bins and limits can be chosen freely.

Tested versions

The new features added to McStas has been tested on the following platforms:

  • Linux
  • Mac (Use either the Intel or gcc 4.8 compiler. Simulations using Nexus format and event data does not work using the Clang compiler.)

References

For more information about McStas and its general usage for simulating neutron scattering instruments and experiments visit the McStas homepage http://www.mcstas.org.

Categories: Algorithms | DataHandling

Source

C++ source: LoadMcStas.cpp

C++ header: LoadMcStas.h