Skip to content

ajulik1997/QtSWINE

Repository files navigation

QtSWINE - PyQt GUI for SWINE

An application that uses Monte-Carlo methods to analyse the effects of varying slit widths on the average neutron flux of neutron beamline facilities. Although originally designed for use with the OffSpec reflectometer at ISIS Neutron Source, this application is now heavily customisable and can work with any compatible McStas instrument file.

Table of Contents

How It Works

This application works on the basic assumption that all neutron beamlines have three main components beyond the neutron moderator: two slits and a sample holder (any other components installed between ones already mentioned may be ignored, as long as they do not directly affect the shape or geometry of the beam).

Assuming that the slits and sample holder are not free to move along the beam, you will be asked to select the position (as understood by McStas) of where the two slits and sample are fixed, respective to the design of your instrument file. These can be changed at any point, to allow you to experiment with slit positions that satisfy the required resolution of the instrument, while possibly increasing the neutron flux at the sample.

The application then carries out Monte-Carlo simulations for every combination of slit widths that satisfy the maximum neutron footprint, using Python to calculate the allowed combinations, then using McStas to run the simulations, then finally using Python again to analyse the McStas data files, recording the neutron flux and resolution at every point.

This data is saved to a ".npz" file, that can be viewed either as a heat map of neutron flux for every slit combination, or a graph of slit 2 widths against neutron intensity for every available resolution.

Features

  • Supports McStas 2.4+
  • Installation includes default OffSpec instrument
  • Supports simulations using custom McStas instruments
  • Utilises built-in McStas GCC compiler for instrument compilation
  • Adjustable slit and sample holder positions, sample holder angle, and maximum neutron footprint
  • Adjustable pixel density and accuracy
  • Default settings provided for most input fields
  • Simulations are parallelised across all available cores
  • Supports saving/loading compressed simulation data
  • Interactive data plotting using matplotlib

Getting Started

Prerequisites

Installing

Running Simulations

Plotting Data

Customisations

Using Different Versions of McStas

Customising Parameters on Default Instrument

Using Custom McStas Instruments

McStas Instrument Compatibility Guidelines

Changing Simulation Parameters

When Things Go Wrong

Incompatible Customised McStas Installations

Issues with Compiling Instrument Files

Installing to Non-root Directories

More About the Data File (.npz) Format

Built With

Licencing

This project is licensed under the MIT License - see the LICENSE file for details

Author

Alexander Liptak - Theoretical Physics student at Royal Holloway University of London

Under the supervision of Dr Jos Cooper and Dr. Nina-Juliane Steinke

As part of a 2017 Summer Internship at ISIS Neutron & Muon Source

Acknowledgements