ocelot.gui

Package Contents

Functions

plot_lattice(lat, axis, alpha=1.0, params={'kmax': 2.0, 'ang_max': 0.005}, s_start=0.0)

plot_opt_func(lat, tws, top_plot=['Dx'], legend=True, fig_name=None, grid=True, font_size=12, excld_legend=None)

function for plotting: lattice (bottom section), vertical and horizontal beta-functions (middle section),

show_da(out_da, x_array, y_array, title='')

show_mu(contour_da, mux, muy, x_array, y_array, zones=None)

show_density(x, y, ax=None, nbins_x=250, nbins_y=250, interpolation='bilinear', xlabel=None, ylabel=None, nfig=50, title=None, figsize=None, grid=True, show_xtick_label=True, limits=None)

Function shows density

show_e_beam(p_array, nparts_in_slice=5000, smooth_param=0.05, nbins_x=200, nbins_y=200, interpolation='bilinear', inverse_tau=False, show_moments=False, nfig=40, title=None, figsize=None, grid=True, filename=None, headtail=True, filter_base=2, filter_iter=2, tau_units='mm')

Shows e-beam slice parameters (current, emittances, energy spread)

show_flux(screen, show='Total', xlim=(0, 0), ylim=(0, 0), file_name=None, unit='mm', title=None, nfig=1, grid=True, xlog=False, ylog=False)

Function to plot radiation flux density 1D and 3D

ocelot.gui.plot_lattice(lat, axis, alpha=1.0, params={'kmax': 2.0, 'ang_max': 0.005}, s_start=0.0)
ocelot.gui.plot_opt_func(lat, tws, top_plot=['Dx'], legend=True, fig_name=None, grid=True, font_size=12, excld_legend=None)

function for plotting: lattice (bottom section), vertical and horizontal beta-functions (middle section), other parameters (top section) such as “Dx”, “Dy”, “E”, “mux”, “muy”, “alpha_x”, “alpha_y”, “gamma_x”, “gamma_y”

Parameters
  • lat – MagneticLattice,

  • tws – list if Twiss objects,

  • top_plot – [“Dx”] - parameters which displayed in top section. Can be any attribute of Twiss class, e.g. top_plot=[“Dx”, “Dy”, “alpha_x”]

  • legend – True - displaying legend of element types in bottom section,

  • fig_name – None - name of figure,

  • grid – True - grid

  • font_size – 16 - font size for any element of plot

  • excld_legend – None, exclude type of element from the legend, e.g. excld_legend=[Hcor, Vcor]

Returns

ocelot.gui.show_da(out_da, x_array, y_array, title='')
ocelot.gui.show_mu(contour_da, mux, muy, x_array, y_array, zones=None)
ocelot.gui.show_density(x, y, ax=None, nbins_x=250, nbins_y=250, interpolation='bilinear', xlabel=None, ylabel=None, nfig=50, title=None, figsize=None, grid=True, show_xtick_label=True, limits=None)

Function shows density

Parameters
  • x – np.array

  • y – np.array

  • ax – None, subplot axis, if None creates standalone plot.

  • nbins_x – 250, number of bins for 2D hist. in horz. plane

  • nbins_y – 250, number of bins for 2D hist. in vertical plane

  • interpolation – “bilinear”. Acceptable values are ‘none’, ‘nearest’, ‘bilinear’, ‘bicubic’, ‘spline16’, ‘spline36’, ‘hanning’, ‘hamming’, ‘hermite’, ‘kaiser’, ‘quadric’, ‘catrom’, ‘gaussian’, ‘bessel’

  • xlabel – None, otherwise “string”

  • ylabel – None, otherwise “string”

  • nfig – number of the figure

  • title – title of the figure

  • figsize – None or e.g. (8, 6)

  • grid – True, show grid

  • show_xtick_label – True

:param label, None or string. :param limits, None or [[xmin, xmax], [ymin, ymax]] :return:

ocelot.gui.show_e_beam(p_array, nparts_in_slice=5000, smooth_param=0.05, nbins_x=200, nbins_y=200, interpolation='bilinear', inverse_tau=False, show_moments=False, nfig=40, title=None, figsize=None, grid=True, filename=None, headtail=True, filter_base=2, filter_iter=2, tau_units='mm')

Shows e-beam slice parameters (current, emittances, energy spread) and beam distributions (dE/(p0 c), X, Y) against long. coordinate (S) Note: beam head is on the left side

Parameters
  • p_array – ParticleArray

  • nparts_in_slice – number of particles per slice

  • smoth_param – 0.05, smoothing parameters to calculate the beam current: sigma = smoth_param * np.std(p_array.tau())

  • nbins_x – number of bins for 2D hist. in horz. plane

  • nbins_y – number of bins for 2D hist. in vertical plane

  • interpolation – “bilinear”, and acceptable values are ‘none’, ‘nearest’, ‘bilinear’, ‘bicubic’, ‘spline16’, ‘spline36’, ‘hanning’, ‘hamming’, ‘hermite’, ‘kaiser’, ‘quadric’, ‘catrom’, ‘gaussian’, ‘bessel’

  • inverse_tau – False, inverse tau - head will be on the right side of figure

  • show_moments – False, show moments (X_mean_slice and Y_mean_slice) in the density distribution

  • nfig – number of the figure

  • title – None or string - title of the figure

  • figsize – None or e.g. (8, 6)

  • grid – True, show grid

  • filename – None or str, filename to save picture in the file

  • headtail – True, shows where is the beam head is.

  • filter_base – support of rectangle filter is 2*p+1

  • filter_iter – the number of the filter iterations

Returns

ocelot.gui.show_flux(screen, show='Total', xlim=0, 0, ylim=0, 0, file_name=None, unit='mm', title=None, nfig=1, grid=True, xlog=False, ylog=False)

Function to plot radiation flux density 1D and 3D

Parameters
  • screen – Screen class

  • show – str, show polarization component, can be “Total”, “Sigma” or “Pi”

  • xlim – (0,0), xlimits, ignored if (0,0)

  • ylim – (0,0), ylimits, ignored if (0,0)

  • file_name – str, if None flux will be shown otherwise save to file

  • unit – str, units for spatial axis, can be “mm” or “mrad”,

  • title – figure title

  • nfig – figure number

  • grid – True, if False not show the grid

  • xlog – False, log scale for x-axis

  • ylog – False, log scale for y-axis

Returns