API Functions & Classes

Usage

Usage of the API functions available in simplex-ui are given below.

simplex.Start(**kwargs)

Launch SIMPLEX with options

Parameters:
  • kwargs (dict) – keyword argument to specify the the launch options

  • kwargs["src"] (str) – specify the location of the source files; “r” = remote (default), “l” = local

  • kwargs["browser"] (str) – specify the browser; “c” = Chrome (default), “e” = Edge, “f” = Firefox, “s” = Safari

  • kwargs["mode"] (str) – specify the operation mode; “g” = GUI, “i” = interactive, “c” = CLI

  • kwargs["file"] (str) – path to the parameter file to open (default = “”)

Returns:

None

Examples

>>> simplex.Start(src="l", file="./sample.json")
# open the source files in the local repository with the Chrome browser,
# with the parameter file "sample.json"
simplex.Open(file)

Opens a SIMPLEX parameter file.

Parameters:

file (str) – path to the parameter file

Returns:

None

Examples

>>> simplex.Open("./sample.json")
# open a parameter file "sample.json" in the current directory
simplex.LoadOutput(file)

Load an output file generated in the former calculation for post-processing.

Parameters:

file (str) – path to the output file

Returns:

None

Examples

>>> simplex.LoadOutput("./output.json") # load the output file "output.json" in the current directory
simplex.LoadPostProcessed(file)

Load an output file generated by post-processing the raw data generated in a former simulation.

Parameters:

file (str) – path to the output file

Returns:

None

Examples

>>> simplex.LoadPostProcessed("./output.json") # load the output file "output.json" in the current directory
simplex.Save(file=None)

Save the current parameters and configurations in a JSON file.

Parameters:

file (str) – path to the parameter file to save; if omitted, that specified in the former Open() command is used

Returns:

None

Examples

>>> simplex.Save("./sample2.json")
# save the parameters in a new file "sample2.json" in the current directory
>>> simplex.Save()
# save the parameters in the file specified in the former Open() command
simplex.Exit()

Finish SIMPLEX and exit

Parameters:

None

Returns:

None

simplex.CreateProcess(**kwargs)

Create a calculation process with the current parameters

Parameters:
  • kwargs (dict) – keyword argument to specify the path to the output file

  • kwargs["folder"] (str) – directory to put the output file

  • kwargs["prefix"] (str) – name of the output file

  • kwargs["serial"] (str) – serial number of the output file

Returns:

None

Examples

>>> simplex.CreateProcess(folder=".", prefix="sample", serial=1)
# create a calculation process to generate an output file "./sample-1.json"
simplex.StartSimulation(**kwargs)

Start the calculation process

Parameters:
  • kwargs (dict) – keyword argument to specify the path to the output file

  • kwargs["folder"] (str) – directory to put the output file

  • kwargs["prefix"] (str) – name of the output file

  • kwargs["serial"] (str) – serial number of the output file

Returns:

None

Examples

>>> simplex.StartSimulation(folder=".", prefix="sample", serial=1)
# start the calculation to generate an output file "./sample-1.json"

Note

If more than one calculation process is created before, this funcion simply launches the existing processes and the arguments are not functional.

simplex.Set(category, label, value)

Set a parameter or an option

Parameters:
  • category (string) – specify the category of the target parameter

  • label (string) – name of the target parameter

  • value (any) – value to be set

Returns:

None

Examples

>>> simplex.Set("ebeam", "eenergy", 6.0)
# set the electron energy to 6.0 GeV

Note

Refer to the category list for 1st argument and Parameter name (2nd argument) for the 2nd argument.

simplex.Get(category, label)

Get a value of a parameter automatically evaluated and being shown in the GUI

Parameters:
  • category (string) – specify the category of the target parameter

  • label (string) – name of the target parameter

Returns:

value of the specified parameter

Examples

>>> simplex.Get("felprm", "rho")
# Get the FEL parameter

Note

Refer to the category list for 1st argument and Parameter name (2nd argument) for the 2nd argument.

simplex.ShowParameter(categ)

Switch the tabbled panel to show the parameters in a specific category.

Parameters:

categ (str) – string to specify the parameter category: “acc”, “src” and “config”; if omitted, all categories are shown

Returns:

None

simplex.ShowPreProcessor()

Switch the tabbled panel to “Pre-Processing”.

Parameters:

None

Returns:

None

simplex.ShowPostProcessor()

Switch the tabbled panel to “Post-Processing”.

Parameters:

None

Returns:

None

simplex.DisplayParameters(*categs, **kwargs)

Display the parameters and configurations currently in memory as an HTML file in the CLI mode. Not available in the GUI and interactive modes.

Parameters:
  • categs (variable length list) – list of strings to specify the parameter category; refer to the category list

  • kwargs (dict) – keyword argument to specify the font; if omitted, “arial 12px” is used

  • kwargs["fontfamily"] (str) – family (“arial”, etc.)

  • kwargs["fontsize"] (str) – size (“12px”, etc.)

Returns:

None

Examples

>>> simplex.DisplayParameters("ebeam", "undulator")
# displays the parameters in "Electron Beam" and "Undulator" categories.
simplex.Scan(category, label, initial, final, points=11, **kwargs)

Create a parameter-scan process (1D).

Parameters:
  • category (string) – specify the category of the target parameter

  • label (string) – name of the target parameter

  • initial (number) – initial value for scanning

  • final (number) – final value for scanning

  • points (number) – number of points for scanning

  • kwargs (dict) – keyword argument to specify the path to the output file

  • kwargs["folder"] (str) – directory to put the output file

  • kwargs["prefix"] (str) – name of the output file

  • kwargs["serial"] (number) – serial number of the output file

  • kwargs["iniSN"] (number) – initial suffix number for scan

  • kwargs["interval"] (number) – step interval if the target parameter is an integer

Returns:

None

Examples

>>> simplex.Scan("ebeam", "eenergy", 6, 8, folder=".", prefix="scan")
    # scan the electron energy from 6 to 8 GeV with an interval of 0.2 GeV (11 points);
    # the output files are "./scan-1.json" etc.
simplex.ScanX(category, label, initial, final, points=11, **kwargs)

Create a parameter-scan process (1D, along x axis).

Parameters:
  • category (string) – specify the category of the target parameter, should be either of “acc” (Accelerator), “src” (Light Source) or “config” (Configurations)

  • label (string) – name of the target parameter

  • initial (number) – initial value for scanning

  • final (number) – final value for scanning

  • points (number) – number of points for scanning

  • kwargs (dict) – keyword argument to specify the path to the output file

  • kwargs["folder"] (str) – directory to put the output file

  • kwargs["prefix"] (str) – name of the output file

  • kwargs["serial"] (str) – serial number of the output file

  • kwargs["iniSN"] (number) – initial suffix number for scan

  • kwargs["interval"] (number) – step interval if the target parameter is an integer

Returns:

None

Examples

>>> simplex.ScanX("ebeam", "emitt", 0.5, 1, 6, folder=".", prefix="scanx")
    # scan the horizontal emittance from 0.5 to 1 mm.mrad with an interval of 0.1 mm.mrad (6 points);
    # the output files are "./scanx-1.json" etc.
simplex.ScanY(category, label, initial, final, points=11, **kwargs)

Create a parameter-scan process (1D, along y axis).

Parameters:
  • category (string) – specify the category of the target parameter, should be either of “acc” (Accelerator), “src” (Light Source) or “config” (Configurations)

  • label (string) – name of the target parameter

  • initial (number) – initial value for scanning

  • final (number) – final value for scanning

  • points (number) – number of points for scanning

  • kwargs (dict) – keyword argument to specify the path to the output file

  • kwargs["folder"] (str) – directory to put the output file

  • kwargs["prefix"] (str) – name of the output file

  • kwargs["serial"] (str) – serial number of the output file

  • kwargs["iniSN"] (number) – initial suffix number for scan

  • kwargs["interval"] (number) – step interval if the target parameter is an integer

Returns:

None

Examples

>>> simplex.ScanY("ebeam", "emitt", 0.5, 1, 6, folder=".", prefix="scany")
    # scan the vertical emittance from 0.5 to 1 mm.mrad with an interval of 0.1 mm.mrad (6 points);
    # the output files are "./scany-1.json" etc.
simplex.ScanXY(category, label, initial, final, points=[11, 11], **kwargs)

Create a parameter-scan process (2D over x-y plane).

Parameters:
  • category (string) – specify the category of the target parameter, should be either of “acc” (Accelerator), “src” (Light Source) or “config” (Configurations)

  • label (string) – name of the target parameter

  • initial (list) – initial value for scanning

  • final (list) – final value for scanning

  • points (list) – number of points for scanning in x and y directions

  • kwargs (dict) – keyword argument to specify the path to the output file

  • kwargs["folder"] (str) – directory to put the output file

  • kwargs["prefix"] (str) – name of the output file

  • kwargs["serial"] (str) – serial number of the output file

  • kwargs["iniSN"] (number) – initial suffix number for scan

  • kwargs["interval"] (list) – step interval if the target parameter is an integer

  • kwargs["link"] (bool) – if enabled, X and Y prameters are scanned at the same time

Returns:

None

Examples

>>> simplex.ScanXY("ebeam", "emitt", [0.5, 0.5], [1, 1], [5, 5], folder=".", prefix="scanxy")
    # scan the observation position in the 2D rectangular grid points defined by
    # (0.5,0.5) and (1,1) with an interval of 0.1 mm.mrad in both directions (6x6 points);
    # the output files are "./scanxy-1-1.json" etc.
simplex.FitWindow()

Adjust the size of the browser to show the whole parameters in the Main window. Not effective when Pre-Processing or Post-Processing windows are shown.

Parameters:

None

Returns:

None

simplex.ExpandWindow(**kwargs)

Expand or shrink the size of the browser.

Parameters:
  • kwargs (dict) – keyword argument to specify how to expand/shrink

  • kwargs["width"] (kwargs["w"] or) – scaling factor in the horizontal direction

  • kwargs["height"] (kwargs["h"] or) – scaling factor in the vertical direction

Returns:

None

Examples

>>> simplex.ExpandWindow("w"=1.2, "h"=0.8)
    # expand/shrink the window size by 1.2 (horizontal) and 0.8 (vertical)
simplex.MoveWindowX(pos)

Move the browser horizontally.

Parameters:

pos (str or number) – “l” (left), “c” (center), “r” (right), or a pixel number to specify the horizontal position

Returns:

None

Examples

>>> simplex.MoveWindowX("l") # move to the left
>>> simplex.MoveWindowX(100) # move to x = 100px
simplex.MoveWindowY(pos)

Move the browser vertically.

Parameters:

pos (str or number) – “t” (top), “c” (center), “b” (bottom), or a pixel number to specify the vertical position

Returns:

None

Examples

>>> simplex.MoveWindowY("t") # move to the top
>>> simplex.MoveWindowY(100) # move to y = 100px
simplex.MoveWindowXY(x, y)

Move the browser in both directions.

Parameters:
  • x (str or number) – “l” (left), “c” (center), “r” (right), or a pixel number to specify the horizontal position

  • y (str or number) – “t” (top), “c” (center), “b” (bottom), or a pixel number to specify the vertical position

Returns:

None

Examples

>>> simplex.MoveWindowXY("l", "t") # move to the left & top
>>> simplex.MoveWindowXY(100, 100) # move to (x, y) = (100px, 100px)
class simplex.PreProcess

PreProcess class bundles various functions for the operation of pre-processor.

Note

Several functions are not available in the CLI mode. Refer to Availability for details.

static Import(item, filename)

Import a data file to customize the simulation options and configurations.

Parameters:
  • item (str) – name of the target item

  • filename (str) – name of the data file

Returns:

None

Examples

>>> simplex.PreProcess.Import("Current Profile", "./current_model.dat")
# import the data file "current_model.dat" in the current directory as the current profile

Note

Refer to Import() method for available data types.

static SetUnit(item, unit)

Select the unit of the data to be imported.

Parameters:
  • item (str) – name of the target item

  • unit (str) – “unit” of the target item

Returns:

None

Examples

>>> simplex.PreProcess.SetUnit("zpos", "mm")
# The longitudinal position is given in mm in the data file to be imported.

Note

Refer to the description of SetUnit() for the name of the unit and possible options.

static Plot(item, **kwargs)

Calculate and plot the target item.

Parameters:
  • item (str) – name of the target item

  • kwargs (dict) – keyword argument to specify the configuration of the plot (not available in interactive mode)

  • kwargs["width"] (int) – set the width of the plot

  • kwargs["height"] (int) – set the height of the plot

  • kwargs["config"] (dict) – dict to specify the plot configuration; refer to Plot configurations for available keys and values

Returns:

None

Examples

>>> simplex.PreProcess.Plot("2nd Integral")
# calculate and plot the 2nd field integral (electron orbit)

Note

Refer to the available items for pre-processing.

static SetCondition(**kwargs)

Set the conditions for pre-processing

Parameters:

kwargs – keyword argument to specify the conditions for pre-processing; refer to Note below

Returns:

None

Examples

>>> simplex.PreProcess.SetCondition(filtemin=1000, filtemax=100000)
>>> simplex.PreProcess.Plot("Transmission Rate")
# plot the transmission rate between 1000 eV and 100000 eV

Note

Refer to the keyword list for available keys and values.

static ImportUndulator(filename)

Import the undulator data from a file.

Parameters:

filename (str) – name of the data file

Returns:

None

Examples

>>> simplex.PreProcess.ImportUndulator("./uerror_model.dat")
# import the undulator data file "uerror_model.dat" in the current directory
static LoadParticle(filename=None)

Load the particle data

Parameters:

filename (str) – name of the data file, load “Particle Data” path if not specified

Returns:

None

Examples

>>> simplex.PreProcess.LoadParticle("./particles.dat")
# load the particle data from "particles.dat" in the current directory
static ParticleDataFormat(**kwargs)

Set the particle data format

Parameters:

kwargs (dict) – keyword argument to specify the format; refer to the keyword list for details

Returns:

None

Examples

>>> simplex.PreProcess.ParticleDataFormat(index=[2,3,4,5,1,6], unitE="gamma")
# the particle data is arranged as t, x, x', y, y', E
# the energy is given in gamma (Lorentz factor)
static PlotSliceParameter(item, **kwargs)

Plot the slice parameter along the electron bunch

Parameters:
  • item (str) – name of the target parameter

  • kwargs (dict) – keyword argument to specify the plot size (not available in interactive mode)

  • kwargs["width"] (int) – set the width of the plot

  • kwargs["height"] (int) – set the height of the plot

Returns:

None

Examples

>>> simplex.PreProcess.PlotSliceParameter("Current Profile")
# plot the current profile of the electron bunch

Note

Refer to Visualizing the Particle Data for available slice parameters.

static PlotParticles(**kwargs)

Plot the particle distribution in a given 2D phase space

Parameters:
  • kwargs (dict) – keyword argument to specify the configuration of the plot

  • kwargs["x"] (str) – coordinate for the x axis

  • kwargs["y"] (str) – coordinate for the y axis

  • kwargs["max"] (number) – maximum particles to plot

  • kwargs["width"] (int) – set the width of the plot (not available in interactive mode)

  • kwargs["height"] (int) – set the height of the plot (not available in interactive mode)

Returns:

None

Examples

>>> simplex.PreProcess.PlotParticles(x="s (m)",y="Energy (GeV)",max=10000)
# plot E-t phase space distribution with maximum number of 10000

Note

Refer to Visualizing the Particle Data for available for available coordinate variables (“x” and “y” keywords).

static Export(dataname)

Export the pre-processed (and currently plotted) result as an ASCII file. Not available in the CLI mode.

Parameters:

dataname (str) – file name to export the pre-processed result

Returns:

None

Examples

>>> simplex.PreProcess.Export("./export.txt")
# export the data to an ASCI file "export.txt"
static PlotScale(**kwargs)

Change the axis scale of the 1D plot. Not available in the CLI mode.

Parameters:
  • kwargs (dict) – keyword argument to specify the scale (Linear/Logarithmic) of the plot

  • kwargs["xscale"] (kwargs["x"] or) – select the scale of abscissa, “linear” or “log”

  • kwargs["yscale"] (kwargs["y"] or) – select the scale of ordinate, “linear” or “log”

Returns:

None

Examples

>>> simplex.PreProcess.PlotScale(x="log",y="log")
# Switch to the log-log plot
static PlotRange(**kwargs)

Specify the plotting range of the 1D or contour plot. Not available in the CLI mode.

Parameters:
  • kwargs (dict) – keyword argument to specify the range of the plot

  • kwargs["xrange"] (kwargs["x"] or) – specify the x range

  • kwargs["yrange"] (kwargs["y"] or) – specify the y range

Returns:

None

Examples

>>> simplex.PreProcess.PlotRange(x=[1,10],y=[-1,1])
# Specify the x range as [1, 10] and y range as [-1, 1]
static LinePlot(width, size)

Switch to the line plot. Not available in the CLI mode.

Parameters:
  • width – width of lines (should be > 0)

  • size – size of symbols (if 0, simple line plot)

Returns:

None

static SymbolPlot(size)

Switch to the symbol plot. Not available in the CLI mode.

Parameters:

size – size of symbols (should be > 0)

Returns:

None

static ContourPlot()

Switch to the contour plot. Not available in the CLI mode.

Parameters:

None

Returns:

None

static SurfacePlot(**kwargs)

Switch to the surface plot. Not available in the CLI mode.

Parameters:
  • kwargs (dict) – keyword argument to specify the configuration of the surface plot

  • kwargs["type"] – select the type of the surface plot; “shade” for a shaded surface plot, “color” for a surface plot with a color map

  • kwargs["wireframe"] – if True, wireframe is drawn on the surface

Returns:

None

Examples

>>> simplex.PreProcess.SurfacePlot(type=shade, wireframe=True)
# Switch to the surface plot with "shading" and "wireframe"
static ShowColorScale(isshow=True)

Show or hide the color scale for the 2D plot. Not available in the CLI mode.

Parameters:

isshow (bool) – flag to show/hide the color scale

Returns:

None

static DuplicatePlot(*titles)

Open a new window to duplicate the current plot with the same configuration. Not available in the CLI mode.

Parameters:

titles (variable length list) – titles of the plot

Returns:

None

static OptimizeLattice(betaxy)

Optimize the Twiss parameters and focusing magnets for betatron matching.

Parameters:

betaxy (list) – average betatron functions in horizontal and vertical directions

Returns:

None

Examples

>>> simplex.PreProcess.OptimizeLattice([10, 10])
# try optimization with the average betatron functions of 10 m in both directions.
class simplex.PostProcess

PostProcess class bundles various functions for the operation of post-processor.

Note

Not available in the CLI mode. Use “PostProcessCLI” class instead.

static Import(filename)

Import the output file for post-processing (visualization).

Parameters:

filename (str) – name of the output data file

Returns:

None

Note

If successful, the imported data (“data set”) is named with the name of the output file without its directory and suffix (.json). Namely, a data name “sample1” is given to a dataset imported from an output file “/path/to/data/sample1.json”. This means that a data set is overwritten (and thus deleted) if another output file with the same name but in a different directly is imported later on.

static SelectData(dataname)

Select a data set for post-processing from those already imported.

Parameters:

dataname (str) – name of the output data to be selected

Returns:

None

static Plot(*items, **kwargs)

Plot the items in the currently selected data set.

Parameters:
  • items (variable length list) – name of the target items; refer to the output items available in SIMPLEX.

  • kwargs["harmonics"] (list) – harmonic orders to plot (optional)

Returns:

None

Examples

>>> simplex.PostProcess.Plot("Pulse Energy")
# plot the pulse energy vs. undulator length (gain curve)
static Clear()

Clear all the data sets that have been imported.

Parameters:

None

Returns:

None

static Remove(dataname)

Remove a data set from the list.

Parameters:

dataname (str) – name of the data set to be removed

Returns:

None

static Export(dataname)

Export the data in the current plot as an ASCII file.

Parameters:

dataname (str) – file name to save the data

Returns:

None

static Save(dataname)

Save the current plot as a JSON file, which can be imported later to reproduce the plot.

Parameters:

dataname (str) – file name to save the data

Returns:

None

static ComparativePlot(*datanames)

Create a comparative plot of an item currently selected; more than one data set is retrieved and plotted in the same graph for comparison

Parameters:

datanames (variable length list) – names of the output data to be plotted

Returns:

None

Examples

>>> simplex.PostProcess.PlotGainCurve("Pulse Energy") # specify "Pulse Energy" as the target item before creating a comparative plot
>>> simplex.PostProcess.ComparativePlot("sample-1", "sample-2")
# plot the simplex of flux density retrieved from two output data "sample-1" and "sample-2"
static MultiPlot(**kwargs)

Create a multiple plot; more than one data set is retrieved and plotted in the same window

Parameters:
  • kwargs (dict) – keyword argument to specify the data set and target item

  • kwargs["data"] (str or list) – name(s) of the data sets

  • kwargs["item"] (str or list) – item(s) to be plotted

Returns:

None

Examples

>>> simplex.PostProcess.Plot("Pulse Energy")
>>> simplex.PostProcess.MultiPlot(data=["sample-0"], item=["RMS Pulse Length"])
# plot the gain curve (growth of the pulse energy) and variation of the pulse length
static SetSlide(*slideno)

Set the slide number in the animation plot

Parameters:

slideno (variable length list) – slide number(s) to show

Returns:

None

Examples

>>> simplex.PostProcess.SetSlide(0) # show the 0th slide
static ComparativePlotCols(columns)

Define the number of columns for comparative plot with more than one plot area. This is effective for 2D plots or 1D plots with more than one target items.

Parameters:

columns (integer) – column number of comparative plot areas

Returns:

None

static MultiPlotCols(columns)

Define the number of columns for multiplot.

Parameters:

columns (integer) – column number of multiplot windows

Returns:

None

static PlotScale(**kwargs)

Change the axis scale of the 1D plot. Not available in the CLI mode.

Parameters:
  • kwargs (dict) – keyword argument to specify the scale (Linear/Logarithmic) of the plot

  • kwargs["xscale"] (kwargs["x"] or) – select the scale of abscissa, “linear” or “log”

  • kwargs["yscale"] (kwargs["y"] or) – select the scale of ordinate, “linear” or “log”

Returns:

None

Examples

>>> simplex.PreProcess.PlotScale(x="log",y="log")
# Switch to the log-log plot
NormalizePlot()

Specify if the plot is normalized for each slide.

Parameters:

normalize (bool) – boolean to specify the method of normalization

Returns:

None

static PlotRange(**kwargs)

Specify the plotting range of the 1D or contour plot. Not available in the CLI mode.

Parameters:
  • kwargs (dict) – keyword argument to specify the range of the plot

  • kwargs["xrange"] (kwargs["x"] or) – specify the x range

  • kwargs["yrange"] (kwargs["y"] or) – specify the y range

Returns:

None

Examples

>>> simplex.PreProcess.PlotRange(x=[1,10],y=[-1,1])
# Specify the x range as [1, 10] and y range as [-1, 1]
static LinePlot(width, size)

Switch to the line plot. Not available in the CLI mode.

Parameters:
  • width – width of lines (should be > 0)

  • size – size of symbols (if 0, simple line plot)

Returns:

None

static SymbolPlot(size)

Switch to the symbol plot. Not available in the CLI mode.

Parameters:

size – size of symbols (should be > 0)

Returns:

None

static ContourPlot()

Switch to the contour plot. Not available in the CLI mode.

Parameters:

None

Returns:

None

static SurfacePlot(**kwargs)

Switch to the surface plot. Not available in the CLI mode.

Parameters:
  • kwargs (dict) – keyword argument to specify the configuration of the surface plot

  • kwargs["type"] – select the type of the surface plot; “shade” for a shaded surface plot, “color” for a surface plot with a color map

  • kwargs["wireframe"] – if True, wireframe is drawn on the surface

Returns:

None

Examples

>>> simplex.PreProcess.SurfacePlot(type=shade, wireframe=True)
# Switch to the surface plot with "shading" and "wireframe"
static ShowColorScale(isshow=True)

Show or hide the color scale for the 2D plot. Not available in the CLI mode.

Parameters:

isshow (bool) – flag to show/hide the color scale

Returns:

None

static DuplicatePlot(*titles)

Open a new window to duplicate the current plot with the same configuration. Not available in the CLI mode.

Parameters:

titles (variable length list) – titles of the plot

Returns:

None

static StartAnimation()

Start an animation with the current plot (if available).

Parameters:

None

Returns:

None

static PlotProcessedData(serial, items)

Plot the results of “Raw Data Processing”

Parameters:
  • serial (number) – serial number of the processing

  • items (list) – items to be plotted

Returns:

None

static SetDataProcessing(label, value)

Set a parameter or an option for “Raw Data Processing”

Parameters:
  • label (string) – name of the target parameter/option

  • value (any) – value to be set

Returns:

None

Examples

>>> simplex.PostProcess.SetDataProcessing("item", "Radiation Power")
# specify "Radiation Power" as a target item for data processing

Note

Refer to the available parameters/options for the target parameter/option.

static RunDataProcessing()

Run “Raw Data Processing”

Parameters:

None

Returns:

None

class simplex.PostProcessCLI

PostProcessCLI class bundles various functions to plot the calculation results in the CLI mode.

Note

Not available except for the CLI mode. Use “PostProcess” class instead for other modes.

static Import(filename)

Import the output file for post-processing (visualization).

Parameters:

filename (str) – name of the output data file

Returns:

None

Note

If successful, the imported data (“data set”) is named with the name of the output file without its directory and suffix (.json). Namely, a data name “sample1” is given to a dataset imported from an output file “/path/to/data/sample1.json”. This means that a data set is overwritten (and thus deleted) if another output file with the same name but in a different directly is imported later on.

static Plot(**kwargs)

Plot the items in the selected data sets.

Parameters:
  • kwargs – keyword argument to specify the data set and method to plot

  • kwargs["data"] (str or list) – select the data set(s)

  • kwargs["item"] (str or list) – select the item(s); refer to the output items available in SIMPLEX.

  • kwargs["harmonics"] (list) – harmonic orders to plot

  • kwargs["width"] (int) – set the width of the plot

  • kwargs["height"] (int) – set the height of the plot

  • kwargs["config"] (dict) – dict to specify the plot configuration; refer to Plot configurations for available keys and values

Returns:

None

Examples

>>> simplex.PostProcess.Plot(data="sample1", item="Pulse Energy")
# plot the gain curve (growth of the radiation pulse energy) saved in "sample1"
>>> simplex.PostProcess.Plot(data=["sample1", "sample2"], item=["Pulse Energy", "Bunch Factor"])
# plot the gain curves (pulse energy and bunch factor) saved in "sample1" and "sample2

Note

When kwargs[“data”] and kwargs[“item”] are omitted, their values are automatically set.

static Clear()

Clear all the data sets from the post-processor to release the allocated memory.

Parameters:

None

Returns:

None

static Remove(*dataname)

Remove the data sets from the post-processor to release the allocated memory.

Parameters:

dataname (variable length list) – list of data names to remove

Returns:

None

Examples

>>> spectra.PostProcessCLI.Remove("sample1", "sample2")
# remove the data sets "sample1" and "sample2"
static RunDataProcessing(**kwargs)

Run “Raw Data Processing” and plot the result

Parameters:
  • kwargs – keyword argument to configure the data processing

  • kwargs["data"] (str) – select the data set

  • others – refer to the available options for raw data processing

Returns:

None

Examples

>>> simplex.PostProcess.RunDataProcessing(data="sample1", item="Radiation Power", spatrange="Whole", overxy=True)
# retrieve the radiation power at the whole transverse grid points and integrate over them

Note

Refer to the available options for raw data processing.

Availability

The availability of a number of functions and classes in simplex-ui depend on the operation modes, which are summarized below.

Functions and classes whose availability depends on the operation mode. Those that are not listed here are available/effective in any modes.

Class/Scope

Functions/Methods

GUI/Interactive Mode

CLI Mode

global

DisplayParameters()

✕

◯

ShowPreProcessor()

◯

✕

ShowPostProcessor()

FitWindow()

ExpandWindow()

MoveWindowX()

MoveWindowY()

MoveWindowXY()

PreProcess

Export()

PlotScale()

PlotRange()

LinePlot()

SymbolPlot()

ContourPlot()

SurfacePlot()

DuplicatePlot()

PostProcessCLI

all methods

✕

◯