pyaml.tuning_tools.chromaticity_monitor#
Chromaticity and dispersion measurement tools.
The ChromaticityMonitor acquires and exposes fitted chromaticity or
dispersion data from sextupole-based measurements, including read access to
the resulting values and their associated units.
Classes
|
Class providing access to a chromaticity monitor of a physical or simulated lattice. |
|
Class providing read access to chromaticity or dispersion. |
- class pyaml.tuning_tools.chromaticity_monitor.ChromaticityMonitor(name, betatron_tune_name, rf_plant_name, bpm_array_name=None, e_delta=0.001, max_e_delta=0.004, fit_order=1, fit_disp_order=1, fit_dispersion=False, n_step=1, sleep_between_step=0, n_avg_meas=1, sleep_between_meas=0)#
Bases:
MeasurementTool,DynamicValidationClass providing access to a chromaticity monitor of a physical or simulated lattice. The monitor provides horizontal and vertical chromaticity measurements.
- Parameters:
name (str) – Name of the chromaticity monitor.
betatron_tune_name (str) – Name of the betatron tune monitor used to measure the horizontal and vertical tunes.
rf_plant_name (str) – Name of the RF plant used to vary the RF frequency.
bpm_array_name (str, optional) – Name of the BPM array used for dispersion measurements. Required only when dispersion fitting is enabled.
e_delta (float, optional) – Default relative momentum deviation,
delta = dp/p(dimensionless), used during the measurement.max_e_delta (float, optional) – Maximum permitted relative momentum deviation (dimensionless).
fit_order (int, optional) – Polynomial order used to fit the chromaticity.
fit_disp_order (int, optional) – Polynomial order used to fit the dispersion.
fit_dispersion (bool, optional) – Whether to fit the machine dispersion in addition to the chromaticity.
n_step (int, optional) – Number of RF frequency steps.
sleep_between_step (float, optional) – Delay in seconds after changing the RF frequency.
n_avg_meas (int, optional) – Number of tune (and orbit) measurements to average at each RF frequency.
sleep_between_meas (float, optional) – Delay in seconds between consecutive measurements during averaging.
Attributes
Get the chromaticity values.
Get the dispersion values.
Return the betatron tune monitor used for measurements.
Return the RF plant varied during measurements.
Return the optional BPM array used for dispersion measurements.
Methods
Set the momentum-compaction factor for frequency-step measurements.
Main function for chromaticity measurement.
Compute chromaticity (and dispersion) from input data and update
Configuration
- type: pyaml.tuning_tools.chromaticity_monitor name: CHROMATICITY_MONITOR betatron_tune_name: BETATRON_TUNE rf_plant_name: RF bpm_array_name: BPM fit_dispersion: true n_step: 5
- fit(deltas, Q, order, orbit=None, fit_disp_order=None, do_plot=False)#
Compute chromaticity (and dispersion) from input data and update
latest_measurement.- Parameters:
deltas (array of float) – Relative momentum variation steps,
delta = dp/p(dimensionless).Q (array of [Qx,Qy]) – Measured horizontal and vertical tune (dimensionless).
order (int) – Chromaticity fitting order.
orbit (array of [[x0,y0],[x1,y1],...], optional) – Horizontal and vertical orbit in metres at each energy step, used to fit the dispersion.
fit_disp_order (int, optional) – Dispersion fitting order.
do_plot (bool, optional) – If
True, plot the fit.
- measure(n_step=None, alphac=None, e_delta=None, max_e_delta=None, n_avg_meas=None, sleep_between_meas=None, sleep_between_step=None, fit_order=None, fit_disp_order=None, fit_dispersion=None, do_plot=None, callback=None)#
Main function for chromaticity measurement.
latest_measurementcontains:chromaticity:np.array # First order chromaticity, Array of [q'x,q'y] dispersion:np.array # First order dispersion, [[dx'0,..,dx'n],[dy'0,..,dy'n]] chromaticity_fit:np.array # Array of [[qx,qy],[q'x,q'y],[q''x,q''y],...] dispersionx_fit:np.array # Array of [[dx0],..,[dxn],[dx'0],..,[dx'n],...] dispersiony_fit:np.array # Array of [[dy0,..,dyn],[dy'0,..,dy'n],...]
- Parameters:
n_step (int) – Default number of RF step during chromaticity measurement [default: from config].
alphac (float | None) – Momentum-compaction factor (dimensionless) [default: from config].
e_delta (float) – Relative momentum variation
delta = dp/p(dimensionless):f0 - f0 * e_delta * alphac < f_RF < f0 + f0 * e_delta * alphac[default: from config].max_e_delta (float) – Maximum permitted relative momentum variation (dimensionless) [default: from config].
n_avg_meas (int) – Number of tune/orbit measurements per RF frequency [default: from config].
sleep_between_meas (float) – Delay in seconds between two tune measurements [default: from config].
sleep_between_step (float) – Delay in seconds after an RF-frequency variation [default: from config].
fit_order (int) – Fitting order [default: from config]
fit_disp_order (int, optional) – Dispersion fitting order [default: from config]
fit_dispersion (bool, optional) – Fit dispersion, [default: from config]
do_plot (bool) – Do you want to plot the fitting results ?
callback (Callable, optional) –
Callback is executed after each measurement or setting. If the callback return false, then the process is aborted. callback_data dict contains:
source:MeasurementTool # Tool that triggered the callback step:int # The current step avg_step:int # The current averaging step rf:float # RF frequency in Hz used for the current step tune:np.array # Dimensionless measured tune (on Action.MEASURE) orbit:np_array # Orbit in m, if fit_dispersion is True (on Action.MEASURE) dtune:np.array # Dimensionless tune variation (on Action.RESTORE)
- set_mcf(alphac)#
Set the momentum-compaction factor for frequency-step measurements.
The factor is used to convert an RF-frequency variation into the corresponding relative energy deviation when measuring chromaticity.
- Parameters:
alphac (float) – Momentum-compaction factor (dimensionless).
- property chromaticity: ReadFloatArray#
Get the chromaticity values.
- Returns:
ReadFloatArray – Chromaticity values
[q'x, q'y](dimensionless).
- property dispersion: ReadFloatArray#
Get the dispersion values.
- Returns:
ReadFloatArray – Array of dispersion values
[[dx, dy], [d'x, d'y], ...], in metres for the first-order values.
- property tune_monitor: BetatronTuneMonitor#
Return the betatron tune monitor used for measurements.
- class pyaml.tuning_tools.chromaticity_monitor.RChromaDispArray(parent, name, unit)#
Bases:
ReadFloatArrayClass providing read access to chromaticity or dispersion. Returns arrays of shape (fit_order,2) or None
- Parameters:
parent ('ChromaticityMonitor') – Monitor owning the measured values.
name (str) – Attribute of the parent monitor to read, such as chromaticity or dispersion.
unit (str) – Unit reported for the values, such as
m.
Methods
Return the latest chromaticity or dispersion values.
Return the unit of the reported values.
- get()#
Return the latest chromaticity or dispersion values.
- unit()#
Return the unit of the reported values.