:mod:`ocelot.cpbd.magnetic_lattice` =================================== .. py:module:: ocelot.cpbd.magnetic_lattice Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: ocelot.cpbd.magnetic_lattice.MagneticLattice ocelot.cpbd.magnetic_lattice.EndElements ocelot.cpbd.magnetic_lattice.EdgeUtil ocelot.cpbd.magnetic_lattice.CouplerKickUtil Functions ~~~~~~~~~ .. autoapisummary:: ocelot.cpbd.magnetic_lattice.lattice_format_converter ocelot.cpbd.magnetic_lattice.merger ocelot.cpbd.magnetic_lattice.merge_drifts ocelot.cpbd.magnetic_lattice.exclude_zero_length_element .. data:: _logger .. function:: lattice_format_converter(elements) :param elements: lattice in the format: [[elem1, center_pos1], [elem2, center_pos2], [elem3, center_pos3], ... ] :return: lattice in the format: [elem1, drift1, elem2, drift2, elem3, drift3, ...] .. function:: merger(lat, remaining_types=[], remaining_elems=[], init_energy=0.0) Function to compress the lattice excluding elements by type or by individual elements :param lat: MagneticLattice :param 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] :param remaining_elems: list of elements (ids (str) or object) :param init_energy: initial energy :return: New MagneticLattice .. data:: flatten .. py:class:: 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. .. method:: get_sequence_part(self, start, stop) .. method:: __getitem__(self, el) .. method:: update_transfer_maps(self) .. method:: update_endings(self, lat_index, element, body_elements, element_util) .. method:: __str__(self) Return str(self). .. method:: find_indices(self, element) .. py:class:: EndElements .. attribute:: suffix_1 :annotation: = _1 .. attribute:: suffix_2 :annotation: = _2 .. method:: check(lattice) :staticmethod: .. method:: add(lattice) :staticmethod: .. method:: update_first(end_element, body) :staticmethod: .. method:: update_last(end_element, body) :staticmethod: .. py:class:: EdgeUtil Bases: :class:`ocelot.cpbd.magnetic_lattice.EndElements` .. attribute:: suffix_1 :annotation: = _e1 .. attribute:: suffix_2 :annotation: = _e2 .. method:: name_suffix_1() :staticmethod: .. method:: name_suffix_2() :staticmethod: .. method:: check(lattice) :staticmethod: if there are edges on the ends of dipoles return True, else False .. method:: add(lattice) :staticmethod: .. method:: update_first(edge, bend) :staticmethod: .. method:: update_last(edge, bend) :staticmethod: .. py:class:: CouplerKickUtil Bases: :class:`ocelot.cpbd.magnetic_lattice.EndElements` .. attribute:: suffix_1 :annotation: = _ck1 .. attribute:: suffix_2 :annotation: = _ck2 .. method:: check(lattice) :staticmethod: if there are CouplerKicks on the ends of Cavities return True, else False .. method:: add(lattice) :staticmethod: .. method:: update_first(ckick, cavity) :staticmethod: .. method:: update_last(ckick, cavity) :staticmethod: .. function:: merge_drifts(cell) Merge neighboring Drifts in one Drift :param cell: list of element :return: new list of elements .. function:: exclude_zero_length_element(cell, elem_type=[UnknownElement, Marker], except_elems=[]) Exclude zero length elements some types in elem_type :param cell: list, sequence of elements :param elem_type: list, types of Elements which should be excluded :param except_elems: list, except elements :return: list, new sequence of elements