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.
- How It Works
- Getting Started
- Customisations
- When Things Go Wrong
- Built With
- Licencing
- Author
- Acknowledgements
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.
- 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
- McStas 2.4.1 for Windows
- GCC 5.3.0 packaged with McStas
- Python 3.4.5 packaged with McStas using Miniconda3
- PyQt4 for connecting underlying processes to UI elements
- Qt4 Designer for UI design
- Matplotlib 2.2.2 for plotting data
- PyInstaller 3.3.1 for packaging final python script into a standalone executable
This project is licensed under the MIT License - see the LICENSE file for details
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
- @willend for putting up with my many McCode bug reports
- @jfkcooper for thoroughly troubleshooting and ironing out issues with my code
- Talha Shameem for reviewing my code and providing GUI design feedback
- @ukarim for providing an excellent dark theme for my favourite editor