chromaticity_response_matrix#

class ConfigModel(*, name, description=None, lattice_names=None, n_step=1, sleep_between_step=0, n_avg_meas=1, sleep_between_meas=0, sextu_array_name, chromaticity_name, sextu_delta)[source]#

Bases: MeasurementToolConfigModel

Configuration model for Tune response matrix

Parameters:
  • sextu_array_name (str) – Array name of sextupole used to adjust the chromaticity

  • chromaticity_name (str) – Name of the diagnostic chromaticy monitor

  • sextu_delta (float) – Delta strength used to get the response matrix

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

chromaticity_name: str#
sextu_array_name: str#
sextu_delta: float#
class ChromaticityResponseMatrix(cfg)[source]#

Bases: MeasurementTool

measure(sextu_delta=None, n_step=None, sleep_between_step=None, n_avg_meas=None, sleep_between_meas=None, callback=None)[source]#

Measure chromaticity response matrix. latest_measurement contains:

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) – Delta strength used to get the response matrix

  • 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) – Default time sleep after sextu exitation 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) – Default time sleep between two chomaticity measurment 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 # Magnet strength
    chroma:np.array # The measured chroma (on Action.MEASURE)
    dchroma:np.array # The chroma variation (on Action.RESTORE)