:mod:`ocelot.cpbd.orbit_correction` =================================== .. py:module:: ocelot.cpbd.orbit_correction Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: ocelot.cpbd.orbit_correction.OrbitSVD ocelot.cpbd.orbit_correction.MICADO ocelot.cpbd.orbit_correction.LInfinityNorm ocelot.cpbd.orbit_correction.Orbit ocelot.cpbd.orbit_correction.NewOrbit Functions ~~~~~~~~~ .. autoapisummary:: ocelot.cpbd.orbit_correction.change_corrector ocelot.cpbd.orbit_correction.restore_corrector ocelot.cpbd.orbit_correction.change_quad_position ocelot.cpbd.orbit_correction.measure_response_matrix ocelot.cpbd.orbit_correction.quad_response_matrix ocelot.cpbd.orbit_correction.elem_response_matrix .. data:: __author__ :annotation: = Sergey Tomin .. data:: logger .. py:class:: OrbitSVD(epsilon_x=0.001, epsilon_y=0.001) .. method:: apply(self, resp_matrix, orbit, weights=None) .. py:class:: MICADO(epsilon_x=0.001, epsilon_y=0.001, epsilon_ksi=1e-05) Bases: :class:`ocelot.cpbd.orbit_correction.OrbitSVD` Iterative method based on CERN-ISR-MA/73-17, 1973. Strategy: 1. each corrector is tested singly. For each corrector we have residual vector: r = b + A * x. Corrector (x_j) and column A_j (response matrix) which correspond to minimum residual are exchanged with first position. 2. Two correctors are tested. the first one which is defined from step 1 and second one iteratively is tested j = 2, ... n The iteration is stopped when the peak-to-peak amplitude of the residual vector is smaller than a fixed value given in advance. .. method:: swap_columns(m, col1, col2) :staticmethod: method to swap columns in matrix m :param m: matrix :param col1: index :param col2: index :return: .. method:: solver_svd(self, resp_matrix, orbit, weights) .. method:: solver_lstsq(self, resp_matrix, orbit, weights) .. method:: apply(self, resp_matrix, orbit, weights=None) .. py:class:: LInfinityNorm(epsilon_x=0.001, epsilon_y=0.001) Bases: :class:`ocelot.cpbd.orbit_correction.OrbitSVD` .. method:: apply(self, resp_matrix, orbit, weights=None) .. py:class:: Orbit(lattice, rm_method=None, disp_rm_method=None, empty=False) Bases: :class:`object` .. method:: setup_response_matrix(self) .. method:: setup_disp_response_matrix(self) .. method:: create_bpms(self, bpm_list=None) Search bpm in the lattice and create list of bpms :param lattice: class MagneticLattice :return: self.bpms - list of BPMs (class BPM) .. method:: create_correctors(self, cor_list=None) Search correctors (horizontal and vertical) in the lattice and create list of hcors and list of vcors :param lattice: class MagneticLattice :return: .. method:: get_ref_orbit(self) .. method:: get_orbit(self) .. method:: get_dispersion(self) .. method:: combine_matrices(self, mat1, mat2) :param mat1: :param mat2: :return: .. method:: correction(self, alpha=0, beta=0, p_init=None, print_log=True) Method to find corrector kicks using SVD. bpm weights are ignored for a moment but everything ready to immplement. :param alpha: 0 - 1, trade off between orbit and dispersion correction, 0 - only orbit, 1 - only dispersion :param epsilon_x: cut s-matrix diag for x-plane, if s[i] < s_max * epsilon: s_inv[i] = 0. else s_inv[i] = 1/s[i] :param epsilon_y: cut s-matrix diag for y-plane, if s[i] < s_max * epsilon: s_inv[i] = 0. else s_inv[i] = 1/s[i] :param beta: weight for suppress large kicks :param p_init: particle initial conditions. Removed in that version. :param print_log: :return: .. py:class:: NewOrbit(lattice, rm_method=None, disp_rm_method=None, empty=False) Bases: :class:`ocelot.cpbd.orbit_correction.Orbit` .. function:: change_corrector(corrector, lattice) .. function:: restore_corrector(corrector, lattice) .. function:: change_quad_position(quad, lattice, dx=0.0, dy=0.0) .. function:: measure_response_matrix(orbit, lattice) .. function:: quad_response_matrix(orbit, lattice) .. function:: elem_response_matrix(orbit, lattice, p_init, elem_types, remove_elem)