pyaml.tuning_tools.chromaticity_response_matrix#
Chromaticity response-matrix measurement tools.
The ChromaticityResponseMatrix measures how sextupole-strength
changes affect horizontal and vertical chromaticity and stores the fitted
slopes as a response matrix.
Classes
|
Measure the chromaticity response matrix of a lattice. |
- class pyaml.tuning_tools.chromaticity_response_matrix.ChromaticityResponseMatrix(name, sextu_array_name, chromaticity_name, sextu_delta, n_step=1, sleep_between_step=0, n_avg_meas=1, sleep_between_meas=0)#
Bases:
MeasurementTool,DynamicValidationMeasure the chromaticity response matrix of a lattice.
This tool perturbs each sextupole in a sextupole array and measures the resulting chromaticity variation using a chromaticity monitor. The measured slopes are assembled into a response matrix with chromaticity components as the observables and sextupoles as the variables.
- Parameters:
name (str) – Name of the response matrix measurement tool.
sextu_array_name (str) – Name of the sextupole array to excite.
chromaticity_name (str) – Name of the chromaticity monitor used to measure the response.
sextu_delta (float) – Default sextupole-strength excitation applied during the measurement, in the configured sextupole strength unit (typically
m^-2).n_step (int, optional) – Default number of excitation steps used to fit the response.
sleep_between_step (float, optional) – Default delay in seconds after changing the sextupole strength.
n_avg_meas (int, optional) – Default number of chromaticity measurements to average at each step.
sleep_between_meas (float, optional) – Default delay in seconds between averaged measurements.
Methods
Measure the chromaticity response matrix.
Attributes
Sextupole array used for the measurement.
Chromaticity monitor used for the measurement.
Configuration
- type: pyaml.tuning_tools.chromaticity_response_matrix name: CHROMATICITY_RESPONSE_MATRIX sextu_array_name: SEXTUPOLES chromaticity_name: CHROMATICITY_MONITOR sextu_delta: 1e-6
- measure(sextu_delta=None, n_step=None, sleep_between_step=None, n_avg_meas=None, sleep_between_meas=None, callback=None)#
Measure the chromaticity response matrix.
latest_measurementcontains:matrix:list[list[float] # The response matrix variable_names:list[str] # Variable names observable_names:list[str] # Observables names
Example
from pyaml.accelerator import Accelerator from pyaml.common.constants import Action def callback(action: Action, data:dict): print(f"{action}, data:{data}") return True sr = Accelerator.load("tests/config/EBSOrbit.yaml") acc = sr.design if acc.crm.measure(callback=callback): acc.crm.save("ideal_crm.json") acc.crm.save("ideal_crm.yaml", with_type="yaml") acc.crm.save("ideal_crm.npz", with_type="npz")
- Parameters:
sextu_delta (float) – Sextupole-strength change in the configured sextupole unit (typically
m^-2).n_step (int, optional) – Number of step for fitting the chomaticity slope [-sextu_delta/n_step..sextu_delta/n_step] Default from config
sleep_between_step (float) – Delay in seconds after sextupole excitation. Default: from config.
n_avg_meas (int, optional) – Default number of chromaticity measurement per step used for averaging Default from config
sleep_between_meas (float) – Delay in seconds between two chromaticity measurements. Default: from config.
callback (Callable, optional) –
Callback executed after each strength setting or measurement. See
send_callback(). If the callback return false, then the scan is aborted and strength restored. callback_data dict contains:source:MeasurementTool # Tool that triggered the callback idx:int # The index in the element array being processed step:int # The current step avg_step:int # The current averaging step magnet:str # The magnet being excited strength:float # Sextupole strength, typically in m^-2 chroma:np.array # Dimensionless measured chromaticity (on Action.MEASURE) dchroma:np.array # Chromaticity change per sextupole-strength unit (on Action.RESTORE)
- Returns:
bool –
Truewhen the response matrix is measured successfully;Falsewhen the measurement is aborted by the callback.
- property chromaticity_monitor: ChromaticityMonitor#
Return the chromaticity monitor used for the measurement.
- property sextupoles: MagnetArray#
Return the sextupole array used for the measurement.