BeamInputDistribution

class zgoubidoo.commands.beam.BeamInputDistribution(label1: str = '', label2: str = '', *params, **kwargs)[source]

Bases: zgoubidoo.commands.beam.Beam

A beam using an explicit beam distribution.

Command attributes

LABEL1=''

Primary label for the Zgoubi command (default: auto-generated hash).

Type

str

LABEL2=''

Secondary label for the Zgoubi command.

Type

str

SLICE='0'

Active slice identifier. Note: this is not the number of slices, but the active slice number.

Type

int

REFERENCE='0'

Setting to 1 will produce a beam with only the reference particle (the distribution is not lost

Type

int

Default initializer for all Commands.

Attributes Summary

PARAMETERS

Parameters of the command, with their default value, their description and optinally an index used by other commands (e.g.

active_slice

The index of the active (current) slice.

distribution

The beam distribution.

mappings

TODO

slices

Number of slices.

Methods Summary

add(distribution, **kwargs)

param distribution

clear()

Returns:

create_reference_statistics([n])

param n

from_5d_sigma_matrix(n, **kwargs)

Initialize a beam with a 5D particle distribution from a Sigma matrix.

from_file(file[, n, path])

param file

from_sequence(sequence, **kwargs)

param sequence

from_twiss_parameters(n, **kwargs)

Initialize a beam with a 5D particle distribution from Twiss parameters.

generate_from_5d_sigma_matrix(n[, x, px, y, …])

param n

generate_from_file(file[, path, n])

Read a beam distribution from file.

generate_object()

TODO

initialize_distribution([distribution])

Try setting the internal pandas.DataFrame with a distribution.

post_init([objet_type, distribution, slices])

param objet_type

Attributes Documentation

PARAMETERS: dict = {'LABEL1': ('', 'Primary label for the Zgoubi command (default: auto-generated hash).'), 'LABEL2': ('', 'Secondary label for the Zgoubi command.'), 'REFERENCE': (0, 'Setting to 1 will produce a beam with only the reference particle (the distribution is not lost'), 'SLICE': (0, 'Active slice identifier. Note: this is not the number of slices, but the active slice number.')}

Parameters of the command, with their default value, their description and optinally an index used by other commands (e.g. fit).

active_slice

The index of the active (current) slice.

distribution

The beam distribution.

mappings

TODO

slices

Number of slices.

Methods Documentation

add(distribution: Union[pandas.core.frame.DataFrame, numpy.ndarray, str], **kwargs)[source]
Parameters

distribution

Returns:

clear()zgoubidoo.commands.beam.Beam[source]

Returns:

create_reference_statistics(n: int = 1)[source]
Parameters

n

Returns:

from_5d_sigma_matrix(n, **kwargs)zgoubidoo.commands.beam.Beam[source]

Initialize a beam with a 5D particle distribution from a Sigma matrix.

Parameters
  • n

  • **kwargs

Returns:

from_file(file: str, n: Optional[int] = None, path: str = '.')zgoubidoo.commands.beam.Beam[source]
Parameters
  • file

  • n

  • path

Returns:

classmethod from_sequence(sequence: _Sequence, **kwargs)[source]
Parameters
  • sequence

  • kwargs

Returns:

from_twiss_parameters(n, **kwargs)zgoubidoo.commands.beam.Beam[source]

Initialize a beam with a 5D particle distribution from Twiss parameters.

Parameters
  • n

  • **kwargs

Returns:

static generate_from_5d_sigma_matrix(n: int, x: float = 0, px: float = 0, y: float = 0, py: float = 0, dpp: float = 0, s11: float = 0, s12: float = 0, s13: float = 0, s14: float = 0, s15: float = 0, s22: float = 0, s23: float = 0, s24: float = 0, s25: float = 0, s33: float = 0, s34: float = 0, s35: float = 0, s44: float = 0, s45: float = 0, dpprms: float = 0, matrix=None)[source]
Parameters
  • n

  • x

  • px

  • y

  • py

  • dpp

  • s11

  • s12

  • s13

  • s14

  • s15

  • s22

  • s23

  • s24

  • s25

  • s33

  • s34

  • s35

  • s44

  • s45

  • dpprms

  • matrix

Returns:

static generate_from_file(file: str, path: str = '.', n: Optional[int] = None) → pandas.core.frame.DataFrame[source]

Read a beam distribution from file.

Parameters
  • file

  • path

  • n

Returns:

generate_object()[source]

TODO

Return:

initialize_distribution(distribution: Union[pandas.core.frame.DataFrame, numpy.ndarray, str, None] = None, **kwargs)[source]

Try setting the internal pandas.DataFrame with a distribution.

Parameters

distribution

post_init(objet_type: zgoubidoo.commands.objet.ObjetType = <class 'zgoubidoo.commands.objet.Objet2'>, distribution: Union[pandas.core.frame.DataFrame, numpy.array, str, None] = None, slices: int = 1, *args, **kwargs)[source]
Parameters
  • objet_type

  • kinematics

  • particle

  • distribution

  • slices

  • *args

  • **kwargs

Returns: