The simGUI interface to GPT

cd0233de41ece894598d1ce4cac98717.png

simGUI is the result of many years of development towards a user-friendly GUI to interact with GPT and other (Astra, BMAD...) simulations. Here are a few of its features.
  • Written in Matlab (location: /nfs/erl/online/ops/matlab_scripts/simGUI/simGUI.m)
  • Layout (button position, behavior, ...) is completely configurable via a set of input files.
  • With minimal work, it can be modified to run new simulations and/or make new kids of plots and data analysis.
  • Can load settings from EPICS
Most of the features of the program will not be discussed here, except when they are relevant for use for CBETA.

Turning on simGUI

From a linux terminal logged in as erpopr, type 'simGUI' at the console. This starts a terminal-based Matlab and then runs the script. The simulation will start up, and will load whatever simulation and layout was the last one used.

Loading a GPT Layout (i.e. lattice)

simGUI automatically loads the last layout that was used, but if somehow it loads the wrong one, then you can manually choose via the following steps.
  • From the File menu, choose "Select Layout Directory"
  • Choose "CBETA_MLC_Test"
  • 0295c4c8f00b6970d0ed903c9c04854f.png
  • After selecting the directory, then choose Open.

Choosing Simulation Options (Optics, GPT parameters, Initial Distribution, etc.)

The left side of the window contains all of the settings in various tabs. The tabs are determined by input files, and can vary on which layout you have loaded, but for CBETA the following tabs should exist.

Beamline Tab

93f3ac040585d53a8678e3f4b203b906.png
  • Here you can select machine sections (A1, A2, etc..), and see all of their optics settings within a table
  • Section Enable: allows you to turn off all elements in a machine section easily
    • Note: The beam will only be simulated up to the last enabled section
  • The table tells you the element name, a short description, a value, its units, and the element position
    • Value: This is the only editable column. Changing these values is how one interacts with the simulation
  • At the bottom of the screen, one can push two buttons to do the following:
    • Load (selected / all) settings to Default Values: Return the setting to the lattice default
    • Load (selected / all) settings to From EPICS: Get the current state from the machine
    • If "Selected" is chosen, then on the highlighted table lines (by clicking them) will be loaded
Cathode Tab

The cathode tab has some basic properties of the bunch that are influenced by cathode properties, such as QE and MTE.

cd80e4b643df869db6ddada47b72c2ff.png
  • Number of particles : Number of macroparticles in the GPT simulation
  • Total charge : Total bunch charge, only relevant if a space charge simulation is enabled on the GPT tab
  • MTE : Mean transverse energy of the cathode, a property of the cathode material, laser wavelength, and temperature of the cathode
  • X/Y Offset: An offset to the centroid of the initial laser position on the cathode
Laser Tab

The Laser tab lets you choose properties of the initial distribution of the beam, which is determined by the laser pulse shape

44b2d70c389e9c1e40ebdbe825fa4553.png
  • XY Shaping Type : "Truncated Gaussian", "Deformable", "2D distribution file", ...
    • Lets you choose the transverse distribution of the laser.
    • Typically, we use "truncated gaussian" for an ideal laser, or "2D distribution file" to load measured data
  • T Shaping Type : "N Crystals", "Deformable", "Gaussian", ...
    • Lets you choose the longitudinal distribution of the laser.
    • Typically, we use "4 Crystals", since that is what is used in the CBETA laser.
GPT Tab

The GPT Tab lets you choose more detailed numerical simulation properties, and other simple on/off settings (e.g. enable/disable viewscreens, etc.)

e49a93a14cc1e76763579eab183553d6.png
  • Many of the settings on the top are not commonly used, and won't be described here
  • Pass Breakpoint Time : It can be useful to stop the simulation at a given time, and then restart it after that. This allows one to change settings later in the lattice, and not have to simulate up to that point again.
    • 21.6 ns = After ICM, 0.6 ns = after Gun, 100 ns = after entire simulation
  • Position, Gamma-beta Accuracy : Number of digits of precision to expect from the Runge-Kutta calculation
  • Space Charge : Can be set to "Off", "3D PIC", "3D Tree-code"
    • Typical settings are "Off" for no space charge and "3D PIC" for the usual space charge algorithm
    • "3D Tree-code" should be used with care, as it can be tricky to choose settings properly
Plot Tab

The plot tab has settings related to how data is shown in the plot window

2d5d2fb1f3bee2f95499cb3ad6e5c10b.png
  • 2D plot type : Histogram or Scatter. Scatter can be useful because it colors the points by arrival time
  • (1D/2D) Histogram bins : How many bins to have in plots that produce 1D or 2D histograms
  • Show screen data : Whether to add points on the line plots at the locations of viewscreens
    • Note: screen data can disagree slightly with the line data because one is taken at a given position, and the other at a given time

Run Simulation Buttons

03c4d3dc400a4c451981baec79462d39.png

In the upper right corner of the simGUI window are the buttons that trigger actual GPT calculations to be done. Depending on what settings you have changed, some of the buttons will be greyed out to try to prevent the user from running the simulations in the wrong order. For example, if a cathode or laser distribution setting is changed, then the GPT simulations will be greyed out until the cathode simulation is run again.
  • Run Cathode : Run Colwyn's "distgen" distribution generator, a stand-alone C++ code that makes the initial particle distribution. It can handle many different types of distributions, from standard functions, to "deformable" distributions that can be used in optimizations, to distributions from files. In all cases, it creates a pseudorandom distribution to help convergence of the beam properties.
  • Phase GPT : GPT does not have built in cavity phasing, so this button runs our own python-based phasing script, developed by Adam and Colwyn. It tracks a single particle without space charge through the lattice, one cavity at a time, putting each cavity at the desired phase.
  • GPT : Pass 1 : Runs the lattice up to the breakpoint time set in the GPT tab
  • GPT : Pass 2 : Runs the lattice after the breakpoint time, using the previous pass 1 output as the initial distribution

Plots

On the lower right side of the simGUI window is the plot controls and outputs. Many pre-defined plots are available of two basic types: line plots over the entire lattice, and "screen" data taken at a single lattice location.

6734de2b6baf100bc8195219b48bbf0b.png
  • Plot Style : Pre-defined plots to display. At the top of the list are line plots that present average properties of the beam as a function of lattice s position. At the bottom are "Screen" plots that show particle distributions at a single s position.
  • Viewscreen selection : When a "screen" type of plot is selected, then the s position can be chosen here.
  • ed11a32b7ed4f9e3a9c309c44e32a3a5.png
  • Plot Controls : Some basic controls over the axes, title, and legend
    • 38dc326d2906e0d1793f4dcc8d9e6bd4.png
    • Displayed axis units and ranges can be chosen here.
    • Perhaps confusingly, the units are chosen by their metric prefix. So, for "millimeters" one would choose "m" = "milli".
    • "Auto" will choose both a range and a unit that will make the axes as reasonable as possible
  • File Menu
    • Select Layout Directory : Described above, this is how one selects the GPT lattice (and GUI layout) to use.
    • Load/Save Simulation : Save the simulation and all data, so that one can easily load it again later
  • Data Menu
    • Dump data into workspace : Put the currently plotted data into the Matlab workspace for external analysis
    • Output screen in BMAD format : Output the currently shown s-position particle distribution in a format that can be loaded into the CBETA BMAD lattice
    • Send to EPICS / EPICS ref : Output the data so that CBETA-V can plot it, allowing comparison to the BMAD virtual machine simulation
  • Plot Menu
    • Make New Figure : Put the currently shown plot in a new, separate figure. This allows one to more easily save the figure for papers, presentations, etc.

Topic attachments
I Attachment Action Size Date Who Comment
0295c4c8f00b6970d0ed903c9c04854f.pngpng 0295c4c8f00b6970d0ed903c9c04854f.png manage 29 K 18 Oct 2018 - 10:18 AdamBartnik Auto-attached by ImagePlugin
03c4d3dc400a4c451981baec79462d39.pngpng 03c4d3dc400a4c451981baec79462d39.png manage 2 K 18 Oct 2018 - 10:18 AdamBartnik Auto-attached by ImagePlugin
2d5d2fb1f3bee2f95499cb3ad6e5c10b.pngpng 2d5d2fb1f3bee2f95499cb3ad6e5c10b.png manage 8 K 18 Oct 2018 - 10:18 AdamBartnik Auto-attached by ImagePlugin
38dc326d2906e0d1793f4dcc8d9e6bd4.pngpng 38dc326d2906e0d1793f4dcc8d9e6bd4.png manage 3 K 18 Oct 2018 - 10:18 AdamBartnik Auto-attached by ImagePlugin
44b2d70c389e9c1e40ebdbe825fa4553.pngpng 44b2d70c389e9c1e40ebdbe825fa4553.png manage 15 K 18 Oct 2018 - 10:18 AdamBartnik Auto-attached by ImagePlugin
6734de2b6baf100bc8195219b48bbf0b.pngpng 6734de2b6baf100bc8195219b48bbf0b.png manage 19 K 18 Oct 2018 - 10:18 AdamBartnik Auto-attached by ImagePlugin
93f3ac040585d53a8678e3f4b203b906.pngpng 93f3ac040585d53a8678e3f4b203b906.png manage 19 K 18 Oct 2018 - 10:18 AdamBartnik Auto-attached by ImagePlugin
cd0233de41ece894598d1ce4cac98717.pngpng cd0233de41ece894598d1ce4cac98717.png manage 88 K 02 Oct 2018 - 10:17 AdamBartnik Auto-attached by ImagePlugin
cd80e4b643df869db6ddada47b72c2ff.pngpng cd80e4b643df869db6ddada47b72c2ff.png manage 5 K 18 Oct 2018 - 10:18 AdamBartnik Auto-attached by ImagePlugin
e49a93a14cc1e76763579eab183553d6.pngpng e49a93a14cc1e76763579eab183553d6.png manage 15 K 18 Oct 2018 - 10:18 AdamBartnik Auto-attached by ImagePlugin
ed11a32b7ed4f9e3a9c309c44e32a3a5.pngpng ed11a32b7ed4f9e3a9c309c44e32a3a5.png manage 114 K 18 Oct 2018 - 10:18 AdamBartnik Auto-attached by ImagePlugin
This topic: CBETA > SimGUI
Topic revision: 18 Oct 2018, AdamBartnik
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding CLASSE Wiki? Send feedback