pass_beauty module

Define utility functions to perform a “pass beauty”.

After a LightWin optimisation, perform a second optimisation with TraceWin. As for now, the implementation is kept very simple:

  • The phase of compensating cavities can be retuned at +/- tol_phi_deg around their compensated value.

  • The amplitude of compensating cavities can be retuned at +/- tol_k_e around their compensated value.

  • We try to keep the phase dispersion between start of compensation zone, and number_of_dsize lattices after.

Warning

Performing a pass beauty will break the colors of the cavities in the output plots. They will all appear in green, as if they were nominal.

Todo

fix colors in plots after pass beauty

_cavity_settings_to_adjust(cavity_settings, dat_idx, number, tol_phi_deg=5, tol_k_e=0.05, link_index=0, phase_nature='')[source]

Create a ADJUST command with small bounds around current value.

Parameters:
  • cavity_settings (CavitySettings)

  • dat_idx (int)

  • number (int)

  • tol_phi_deg (float, default: 5)

  • tol_k_e (float, default: 0.05)

  • link_index (int, default: 0)

  • phase_nature (str, default: '')

Return type:

tuple[Adjust, Adjust] | tuple[Adjust, Adjust, Adjust]

set_of_cavity_settings_to_adjust(set_of_cavity_settings, number, tol_phi_deg=5, link_k_g=False, tol_k_e=0.05, phase_nature='phi_0_rel')[source]

Create adjust commands for every compensating cavity.

Parameters:
  • set_of_cavity_settings (SetOfCavitySettings)

  • number (int)

  • tol_phi_deg (float, default: 5)

  • link_k_g (bool, default: False)

  • tol_k_e (float, default: 0.05)

  • phase_nature (str, default: 'phi_0_rel')

Return type:

list[Adjust]

elements_to_diagnostics(fix_elts, compensating, number, number_of_dsize)[source]

Create the DSize3 commands that will be needed.

Parameters:
Return type:

list[Diagnostic]

_pass_beauty_instructions(fault_scenario, number_of_dsize, number=666333, link_k_g=True)[source]

Perform a beauty pass.

Parameters:
  • fault_scenario (FaultScenario)

  • number_of_dsize (int)

  • number (int, default: 666333)

  • link_k_g (bool, default: True)

Return type:

list[Instruction]

insert_pass_beauty_instructions(fault_scenario, beam_calculator, number_of_dsize=10, number=666333, link_k_g=True)[source]

Overwrite ListOfElements to include pass beauty instructions.

The fault_scenario.fix_acc.elts (a ListOfElements) will be overwritten.

Parameters:
Return type:

None

_is_adapted_to_pass_beauty(beam_calculator)[source]

Check if the provided beam calculator can perform beauty pass.

Parameters:

beam_calculator (BeamCalculator)

Return type:

bool