McStas logo McStas - A neutron ray-trace simulation package ILL; PSI; ESS Niels Bohr Institute DTU Physics NEXMAP


About McStas
 Conditions of use
 Project funding

 Other Downloads (share)

Mailing list

Search web/mailinglist

 Wiki (GitHub)
 McStas manual


Report bugs (GitHub)

Code-repository (GitHub)

McStas Parameter Study Tool

Written by Deon Marais (
Copyright 2015 The South African Nuclear Energy Corporation (Necsa) SOC Limited

McStasPS is a tool to facilitate the sequential stepping of instrument parameters. If it is specified to step more than one parameter, all possible combinations are automatically determined.

McStasPS was written in Python 2.7 and imports the PyQt4 library. It was only tested on Windows 7, but it *should* work with Linux distributions as well.
Only MPI execution using the perl exe script ( is currently supported.

Compile your instrument file for use with MPI as usual.
When running the script file, a very simple window with a single "Open" button appears.
When the user selects an instrument file (*.instr), a skeleton parameter study base file (*.parst) will be created from the instrument file and placed in the same directory as the instrument file.

The *.parst file contains a list of "variable instrument parameters" as well normal McStas "runtime parameters". The user should edit these to correspond with the McStas installation and instrument simulation. For each instrument parameter, at least a "Start" value is required. By adding "End" and "Number of steps" values, an equispaced grid for the parameter will be prepared. A sequence of values can also be supplied instead of using the equispaced grid. If it is specified to step more than one parameter, all possible combinations will be calculated. If the "Output_dir" is not specified, one based on the instrument name and execution start time will be created.

When opening the *.parst file with McStasPS, a file (*.cmds) containing a list of all the McStas execution commands will be created and placed in the "Output_dir", together with the instrument file and instrument executable. The commands will be run sequentially. A *.log file is created which indicates the start and end times for each execution and provides a summary linking the individual output directories with the stepped parameters.

A *.cmds file can also be opened with McStasPS should it be nessesary to rerun the commands or if (for instance) all executions did not finish for some reason.

The progress bar needs some improvement as it will only cancel the execution after the step is finished. A work-around to cancel execution immediately, is to press Ctrl-C in the console.

It is left to the user to combine the results of all the steps (if needed), which will each be in its own directory in the "Output_dir".

Last Modified: Wednesday, 12-Jan-2022 14:57:17 CET
Search website mailinglist archive GitHub repos