ocelot.cpbd.magnetic_lattice

Module Contents

Classes

MagneticLattice

sequence - list of the elements,

EndElements

EdgeUtil

CouplerKickUtil

Functions

lattice_format_converter(elements)

param elements

lattice in the format: [[elem1, center_pos1], [elem2, center_pos2], [elem3, center_pos3], … ]

merger(lat, remaining_types=[], remaining_elems=[], init_energy=0.0)

Function to compress the lattice excluding elements by type or by individual elements

merge_drifts(cell)

Merge neighboring Drifts in one Drift

exclude_zero_length_element(cell, elem_type=[UnknownElement, Marker], except_elems=[])

Exclude zero length elements some types in elem_type

ocelot.cpbd.magnetic_lattice._logger
ocelot.cpbd.magnetic_lattice.lattice_format_converter(elements)
Parameters

elements – lattice in the format: [[elem1, center_pos1], [elem2, center_pos2], [elem3, center_pos3], … ]

Returns

lattice in the format: [elem1, drift1, elem2, drift2, elem3, drift3, …]

ocelot.cpbd.magnetic_lattice.merger(lat, remaining_types=[], remaining_elems=[], init_energy=0.0)

Function to compress the lattice excluding elements by type or by individual elements

Parameters
  • lat – MagneticLattice

  • remaining_types – list, the type of the elements which needed to be untouched others will be “compress” to Matrix element e.g. [Monitor, Quadrupole, Bend, Hcor]

  • remaining_elems – list of elements (ids (str) or object)

  • init_energy – initial energy

Returns

New MagneticLattice

ocelot.cpbd.magnetic_lattice.flatten
class ocelot.cpbd.magnetic_lattice.MagneticLattice(sequence, start=None, stop=None, method=MethodTM())

sequence - list of the elements, start - first element of lattice. If None, then lattice starts from first element of sequence, stop - last element of lattice. If None, then lattice stops by last element of sequence, method = MethodTM() - method of the tracking.

get_sequence_part(self, start, stop)
__getitem__(self, el)
update_transfer_maps(self)
update_endings(self, lat_index, element, body_elements, element_util)
__str__(self)

Return str(self).

find_indices(self, element)
class ocelot.cpbd.magnetic_lattice.EndElements
suffix_1 = _1
suffix_2 = _2
static check(lattice)
static add(lattice)
static update_first(end_element, body)
static update_last(end_element, body)
class ocelot.cpbd.magnetic_lattice.EdgeUtil

Bases: ocelot.cpbd.magnetic_lattice.EndElements

suffix_1 = _e1
suffix_2 = _e2
static name_suffix_1()
static name_suffix_2()
static check(lattice)

if there are edges on the ends of dipoles return True, else False

static add(lattice)
static update_first(edge, bend)
static update_last(edge, bend)
class ocelot.cpbd.magnetic_lattice.CouplerKickUtil

Bases: ocelot.cpbd.magnetic_lattice.EndElements

suffix_1 = _ck1
suffix_2 = _ck2
static check(lattice)

if there are CouplerKicks on the ends of Cavities return True, else False

static add(lattice)
static update_first(ckick, cavity)
static update_last(ckick, cavity)
ocelot.cpbd.magnetic_lattice.merge_drifts(cell)

Merge neighboring Drifts in one Drift

Parameters

cell – list of element

Returns

new list of elements

ocelot.cpbd.magnetic_lattice.exclude_zero_length_element(cell, elem_type=[UnknownElement, Marker], except_elems=[])

Exclude zero length elements some types in elem_type

Parameters
  • cell – list, sequence of elements

  • elem_type – list, types of Elements which should be excluded

  • except_elems – list, except elements

Returns

list, new sequence of elements