georges.vis package#

Submodules#

georges.vis.matplotlib module#

Matplotlib plotting module for Manzoni.

TODO

exception georges.vis.matplotlib.BeamPlottingException(m)[source]#

Bases: Exception

Exception raised for errors in the beam plotting module.

exception georges.vis.matplotlib.StatisticException(m)[source]#

Bases: Exception

Exception raised for errors in the beam plotting module.

class georges.vis.matplotlib.ManzoniMatplotlibArtist(tracks_color: str = 'b', **kwargs)[source]#

Bases: MatplotlibArtist

A matplotlib implementation of a Matplotlib artist.

Parameters:
  • ax (param) – the matplotlib ax used for plotting. If None it will be created with init_plot (kwargs are

  • forwarded).

  • tracks_color – color for the plotting of tracks

  • kwargs – forwarded to MatplotlibPlot and to init_plot.

property tracks_color#

The color for the rendering of the tracks.

Returns:

color as a string

static histogram_fit(data, bounds_binning=50, verbose=False, model=<class 'lmfit.models.GaussianModel'>)[source]#

All models are available on https://lmfit.github.io/lmfit-py/builtin_models.html#lmfit.models

static ellipse(ra, rb, angle, x0, y0, **kwargs)[source]#

Create an ellipse from beam parameters. :param ra: semi-major axis :param rb: semi-minor axis :param angle: oritentation angle :param x0: center X coordinate :param y0: center Y coordinate :return: matplotlib.patches.Ellipse object

static rotation_angle(e_val, evec)[source]#
tracking(observer: Observer | None = None, plane: str = 'X', fill_between: bool = False, mean: bool = True, std: bool = False, halo: bool = True, **kwargs)[source]#

Plot the beam envelopes from tracking data.

Parameters:
  • observer – Observer used for the tracking

  • plane

  • fill_between

  • mean

  • std

  • halo

  • **kwargs

Returns:

losses(observer: LossesObserver | None = None, log_scale: bool = False, **kwargs)[source]#

Plot the losses along the beamline

Parameters:
  • observer – Observer used for the tracking

  • log_scale – Log scale for transmission

symmetry(observer: LossesObserver | None = None, **kwargs)[source]#

Plot the symmetry of the beam along the beamline

Parameters:

observer – Observer used for the tracking

static compute_halo(data, percentile)[source]#

Return a dataframe containing the 1st, 5th, 95th and 99th percentiles of each dimensions.

static filled_plot(ax, x, y0, y, c, fill=False, **kwargs)[source]#
twiss(observer: TwissObserver | None = None, with_beta: bool = True, with_alpha: bool = False, with_dispersion: bool = False, tfs_data: DataFrame | Table | None = None, relativistic_beta: float = 1.0, **kwargs)[source]#

Plot the Twiss function along the beamline

Parameters:
  • observer – Observer used for the tracking

  • with_beta – plot the beta

  • with_alpha – plot the alpha

  • with_dispersion – plot the dispersion

  • tfs_data – if provided, plot the data from MAD-X.

  • relativistic_beta (float) – Relativistic beta value to scale the dispersion. Default to 1.

phase_space(observer: BeamObserver | None = None, element: str | None = None, location: str = 'OUT', dim=None, nbins=None, draw_ellipse: bool = True)[source]#
Parameters:
  • observer

  • element

  • location

  • dim

  • nbins

  • draw_ellipse

Returns:

draw_ellipse(x, y)[source]#
draw_table(x, y, dim, unit_col_0, unit_col_1, element)[source]#
five_spot_map(bl_track0, bl_track1, bl_track2, bl_track3, bl_track4)[source]#

georges.vis.plotly module#

Plotly plotting module for Manzoni.

exception georges.vis.plotly.BeamPlottingException(m)[source]#

Bases: Exception

Exception raised for errors in the beam plotting module.

class georges.vis.plotly.ManzoniPlotlyArtist(tracks_color: str = 'b', **kwargs)[source]#

Bases: PlotlyArtist

A plotly implementation of a Plotly artist.

Parameters:
  • ax (param) – the matplotlib ax used for plotting. If None it will be created with init_plot (kwargs are

  • forwarded).

  • tracks_color – color for the plotting of tracks

  • kwargs – forwarded to ZgoubiPlot and to init_plot.

tracking(observer: Observer | None = None, plane: str = 'X', fill_between: bool = False, mean: bool = True, std: bool = False, halo: bool = True, **kwargs)[source]#

Plot the beam envelopes from tracking data.

Parameters:
  • observer (_Observer, optional) – Observer used for the tracking. Defaults to None.

  • plane (str, optional) – Plane to draw. Defaults to “X”.

  • fill_between (bool, optional) – Fill the gap between the lines in transparency. Defaults to False.

  • mean (bool, optional) – Add the mean to the plot. Defaults to True.

  • std (bool, optional) – Add the std to the plot. Defaults to False.

  • halo (bool, optional) – Add a halo to the plot. Defaults to True.

losses(observer: LossesObserver | None = None, log_scale: bool = False, **kwargs)[source]#

Plot the losses along the beamline :param observer: Observer used for the tracking :param log_scale: Log scale for transmission

static compute_halo(data, percentile)[source]#

Return a dataframe containing the 1st, 5th, 95th and 99th percentiles of each dimensions.

static filled_plot(ax, x, y0, y, c, fill=False, **kwargs)[source]#
twiss(observer: TwissObserver | None = None, with_beta: bool = True, with_alpha: bool = False, with_dispersion: bool = False, tfs_data: DataFrame | Table | None = None, relativistic_beta: float = 1.0, **kwargs)[source]#

Plot the Twiss function along the beamline

Parameters:
  • observer (_TwissObserver, optional) – TwissObserver. Defaults to None.

  • with_beta (bool, optional) – Add beta function to the plot. Defaults to True.

  • with_alpha (bool, optional) – Add the alpha function ot the plot. Defaults to False.

  • with_dispersion (bool, optional) – Add the dispersion to the plot. Defaults to False.

  • tfs_data (Union[_pd.DataFrame, cpymad.madx.Table], optional) – tfs file from MAD. Defaults to None.

  • relativistic_beta (float) – Relativistic beta value to scale the dispersion. Default to 1.

phase_space(observer: BeamObserver | None = None, element: str | None = None, location: str = 'OUT', dim=None, nbins=None, draw_ellipse: bool = True)[source]#

Module contents#