The Accelerator class

The Accelerator class is top-level class in KENV. It contains all the accelerator data, and has the high-level method compile that performs the accelerator.

class kenv.accelerator.Accelerator(z_start: float, z_stop: float, dz: float)[source]

Initializes an accelerator.

Parameters
  • z_start (float) – The position of the start of the accelerator

  • z_stop (float) – The position of the end of the accelerator

  • dz (float) – The step of the accelerator

add_accel(name: str, center: float, max_field: float, file_name: str, *, x: float = 0.0, xp: float = 0.0, y: float = 0.0, yp: float = 0.0)None[source]

Creates an accelerating module in the accelerator.

Parameters
  • name (string) – Accel’s id

  • center (float) – Accel’s center

  • max_field (float) – Accel’s maximum field [MV/m]

  • file_name (string) – Experimental profile of the Ez field

  • x (float, optional) – Offset of the element along the x-axis

  • xp (float, optional) – Element rotation in the z-x plane

  • y (float, optional) – Offset of the element along the y-axis

  • yp (float, optional) – Element rotation in the z-y plane

add_corrector_x(name: str, center: float, max_field: float, file_name: str)None[source]

Creates a corrector x in the accelerator.

Parameters
  • name (string) – Corrector’s id

  • center (float) – Corrector’s center

  • max_field (float) – Corrector’s maximum field [T]

  • file_name (string) – Experimental profile of the By field

  • x (float, optional) – Offset of the element along the x-axis

  • xp (float, optional) – Element rotation in the z-x plane

  • y (float, optional) – Offset of the element along the y-axis

  • yp (float, optional) – Element rotation in the z-y plane

add_corrector_y(name: str, center: float, max_field: float, file_name: str)None[source]

Creates a corrector y in the accelerator.

Parameters
  • name (string) – Corrector’s id

  • center (float) – Corrector’s center

  • max_field (float) – Corrector’s maximum field [T]

  • file_name (string) – Experimental profile of the Bx field

  • x (float, optional) – Offset of the element along the x-axis

  • xp (float, optional) – Element rotation in the z-x plane

  • y (float, optional) – Offset of the element along the y-axis

  • yp (float, optional) – Element rotation in the z-y plane

add_quadrupole(name: str, center: float, max_field: float, file_name: str)None[source]

Creates a quadrupole in the accelerator.

Parameters
  • name (string) – Quad’s id

  • center (float) – Quad’s center

  • max_field (float) – Quad’s maximum field [T/m]

  • file_name (string) – Experimental profile of the Gz field

  • x (float, optional) – Offset of the element along the x-axis

  • xp (float, optional) – Element rotation in the z-x plane

  • y (float, optional) – Offset of the element along the y-axis

  • yp (float, optional) – Element rotation in the z-y plane

add_solenoid(name: str, center: float, max_field: float, file_name: str, *, x: float = 0.0, xp: float = 0.0, y: float = 0.0, yp: float = 0.0)None[source]

Creates a solenoid lenses in the accelerator.

Parameters
  • name (string) – Solenoid’s id

  • center (float) – Solenoid’s center

  • max_field (float) – Solenoid’s maximum field [T]

  • file_name (string) – Experimental profile of the Bz field

  • x (float, optional) – Offset of the element along the x-axis

  • xp (float, optional) – Element rotation in the z-x plane

  • y (float, optional) – Offset of the element along the y-axis

  • yp (float, optional) – Element rotation in the z-y plane

compile()None[source]

Compilation of the accelerator.

delete_accel(name: str = 'all')None[source]

Delete an accelerating module in the accelerator.

Parameters

name (string) – Accel`s id (If there is no name that will be removed all)

delete_corrector_x(name: str = 'all')None[source]

Delete a corrector x in the accelerator.

Parameters

name (string) – Corrector`s id (If there is no name that will be removed all)

delete_corrector_y(name: str = 'all')None[source]

Delete a corrector y in the accelerator.

Parameters

name (string) – Corrector`s id (If there is no name that will be removed all)

delete_quadrupole(name: str = 'all')None[source]

Delete a quadrupole in the accelerator.

Parameters

name (string) – Quad`s id (If there is no name that will be removed all)

delete_solenoid(name: str = 'all')None[source]

Delete a solenoid in the accelerator.

Parameters

name (string) – Solenoid`s id (If there is no name that will be removed all)