apace.twiss
¶
Module Contents¶
Classes¶
Calculate the Twiss parameter for a given lattice. |
Attributes¶
- apace.twiss.CONST_C = 299792458¶
- apace.twiss.CONST_Q = 3.832e-13¶
- apace.twiss.CONST_ME = 9.1093837015e-31¶
- apace.twiss.CONST_E = 1.602176634e-19¶
- apace.twiss.CONST_MEV = 1.602176634e-13¶
- apace.twiss.TWO_PI¶
- class apace.twiss.Twiss(lattice, start_idx=0, **kwargs)¶
Inherits:
apace.matrixmethod.MatrixMethod
Calculate the Twiss parameter for a given lattice.
- Parameters
Attributes
- start_idx_changed¶
Gets emitted when the start index changes
- one_turn_matrix_changed¶
Gets emitted when the one turn matrix changes.
- twiss_array_changed¶
Gets emitted when the twiss functions change.
- psi_changed¶
Gets emitted when the betatron phase changes.
- tune_fractional_changed¶
Gets emitted when the fractional tune changes.
- start_idx¶
Index from which the accumulated array is calculated. This index is also used to calculated the initial twiss parameter using the periodicity condition.
- Return type
- accumulated_array¶
Contains accumulated transfer matrices.
- Return type
- one_turn_matrix¶
The transfer matrix for a full turn.
- Return type
- term_x¶
Corresponds to \(2 - m_{11}^2 - 2 m_{12} m_{21} - m_{22}^2\), where \(m\) is the one turn matrix. Can be used to calculate the initial
beta_x
value \(\beta_{x0} = |2 m_{12}| / \sqrt{term_x}\). Ifterm_x
> 0, this means that there exists a periodic solution within the horizontal plane.- Return type
- term_y¶
Corresponds to \(2 - m_{33}^2 - 2 m_{34} m_{43} - m_{44}^2\), where \(m\) is the one turn matrix. Can be used to calculate the initial
beta_y
value \(\beta_{y0} = |2 m_{12}| / \sqrt{term_y}\). Ifterm_y
> 0, this means that there exists a periodic solution within the vertical plane.- Return type
- stable_x¶
Periodicity condition
term_x
> 0 for a stable solution in the horizontal plane.- Return type
- stable¶
Periodicity condition
term_x
> 0 andterm_y
> 0 for a stable solution in both planes.- Return type
- initial_twiss¶
Array containing the initial twiss parameter.
- Return type
- twiss_array¶
Contains the twiss parameter.
- Return type
- beta_x¶
Horizontal beta function.
- Return type
- beta_y¶
Vertical beta function.
- Return type
- alpha_x¶
Horizontal alpha function.
- Return type
- alpha_y¶
Vertical alpha function.
- Return type
- gamma_x¶
Horizontal gamma function.
- Return type
- gamma_y¶
Vertical gamma function.
- Return type
- eta_x¶
Horizontal dispersion function.
- Return type
- eta_x_dds¶
Derivative of the horizontal dispersion with respect to s.
- Return type
- psi_x¶
Horizontal betatron phase.
- Return type
- psi_y¶
Vertical betatron phase.
- Return type
- tune_x¶
Horizontal tune. Corresponds to psi_x[-1] / 2 pi. Strongly depends on the selected step size.
- Return type
- tune_y¶
Vertical tune. Corresponds to psi_y[-1] / 2 pi. Strongly depends on the selected step size.
- Return type
- tune_x_fractional¶
Fractional part of the horizontal tune (Calculated from one-turn matrix).
- Return type
- tune_y_fractional¶
Fractional part of the vertical tune (Calculated from one-turn matrix).
- Return type
- element_indices¶
Contains the indices of each element within the transfer_matrices.
- Return type
Dict[apace.classes.Element, List[int]]
- step_size¶
Contains the step_size for each point. Has length of n_kicks
- Return type
- s¶
Contains the orbit position s for each point. Has length of n_kicks + 1.
- Return type
- matrices¶
Array of transfer matrices with shape (6, 6, n_kicks)
- Return type
- k0¶
Array of deflections angles with shape (n_kicks).
- Return type
- k1¶
Array of geometric quadruole strenghts with shape (n_kicks).
- Return type
- start_index¶
Start index of the one-turn matrix and the accumulated transfer matrices.
- Return type
- matrices_acc¶
The accumulated transfer matrices starting from start_index.
- Return type
Methods
- update_one_turn_matrix()¶
Manually update the one turn matrix and the accumulated array.
- _on_one_turn_matrix_changed()¶
- update_twiss_array()¶
Manually update the twiss_array.
- _on_twiss_array_changed()¶
- update_betatron_phase()¶
Manually update the betatron phase psi and the tune.
- _on_psi_changed()¶
- update_fractional_tune()¶
Manually update the fractional tune.
- _on_tune_fractional_changed()¶
- update_chromaticity()¶
Manually update the natural chromaticity.
- _on_chromaticity_changed()¶
- _on_curly_h_changed()¶
- _on_i1_changed()¶
- _on_i2_changed()¶
- _on_i3_changed()¶
- _on_i4_changed()¶
- _on_i5_changed()¶
- _on_alpha_c_changed()¶
- _on_emittance_changed()¶
- _on_element_changed(element, attribute)¶
- update_n_steps()¶
Manually update the total number of kicks.
- _on_n_steps_changed()¶
- update_element_indices()¶
Manually update the indices of each element.
- _on_element_indices_changed()¶
- update_step_size()¶
Manually update the step_size array.
- _on_step_size_changed()¶
- update_s()¶
Manually update the orbit position array s.
- _on_s_changed()¶
- update_matrices()¶
Manually update the transfer_matrices.
- update_matrices_acc()¶
- _on_matrices_accumulated_changed()¶