mcstasscript.jb_interface.simulation_interface.SimInterface

mcstasscript.jb_interface.simulation_interface.SimInterface

class mcstasscript.jb_interface.simulation_interface.SimInterface(instrument)

Class for setting up widget that controls McStasScript instrument and plot

__init__(instrument)

Sets up widget where the user can input instrument parameters, run the simulation, see plotted results and adjust the plots.

The parameters of the instrument model are displayed with name, default value and comment. Can be adjusted with free text.

A run button starts a simulation, and basic settings can be adjusted.

A dropdown menu is available for selecting what monitor to view results from, and basic settings related to the plot can be adjusted.

Show the interface with the show_interface method.

Parameters

instrument (McStas_instr or McXtrace_instr) – instrument for which a widget should be created

Methods

__init__(instrument)

Sets up widget where the user can input instrument parameters, run the simulation, see plotted results and adjust the plots.

get_data()

Returns last data set from this interface

make_live_checkmark()

Makes widget for choosing live simulations on / off

make_mpi_field()

Creates field for mpi, links to update_mpi

make_ncount_field()

Creates field for ncount, links to update_ncount

make_parameter_widgets()

Creates widgets for parameters using dedicated class ParameterWidget

make_progress_bar()

Makes a progress bar for live simulations

make_run_button()

Creates a run button which perform the simulation

run_simulation_live(change)

Performs the simulation with current parameters and settings.

run_simulation_thread(change)

Runs simulation as thread, allowing user to update plots simultaneously

show_interface()

Builds and shows widget interface

update_mpi(change)

Updates mpi value when integer or the word 'disabled' is given

update_ncount(change)

Updates ncount variable from textbox input

get_data()

Returns last data set from this interface

make_live_checkmark()

Makes widget for choosing live simulations on / off

make_mpi_field()

Creates field for mpi, links to update_mpi

make_ncount_field()

Creates field for ncount, links to update_ncount

The field supports scientific notation

make_parameter_widgets()

Creates widgets for parameters using dedicated class ParameterWidget

returns widget including all parameters

make_progress_bar()

Makes a progress bar for live simulations

make_run_button()

Creates a run button which perform the simulation

run_simulation_live(change)

Performs the simulation with current parameters and settings.

When live mode is used, updates plot as more data is added.

Changes icon on button to hourglass while simulation is running, then returns to calculator icon.

run_simulation_thread(change)

Runs simulation as thread, allowing user to update plots simultaneously

The use of this method has caused crashes, temporarily circumvented by calling run_simulation_live on button instead. Now plots can now be updated while a simulation is running.

Parameters

change (widget change) – Not used

show_interface()

Builds and shows widget interface

update_mpi(change)

Updates mpi value when integer or the word ‘disabled’ is given

Parameters

change (widget change) – state change of widget

update_ncount(change)

Updates ncount variable from textbox input

Only updates when usable input is entered. Supports scientific notation in input through conversion to float

Parameters

change (widget change) – state change of widget