Skip to content

Conversation

@Amoutardier
Copy link
Contributor

@Amoutardier Amoutardier commented Jan 16, 2026

Module to measure chromaticity using frequency shift method.

@Amoutardier Amoutardier linked an issue Jan 16, 2026 that may be closed by this pull request
2 tasks
@JeanLucPons
Copy link
Contributor

Thanks @Amoutardier for this nice job !
Few remarks:

  • All pyAML devices should be attached in post_init() to allow configuration error detection at early stage. post_init() is call after all underlying pyaml device are created.
    Move to code below to post_init().
tune = self._peer.get_betatron_tune_monitor(self._cfg.betatron_tune)
rf = self._peer.get_rf_plant(self._cfg.RFfreq)
  • Add the way to select the order and fit a polynomial rather than method=linear | quad, it you select 1 then chromaticity_monitor.chromaticity.get() should return $[[q'_x,q'_y]]$, if you select 2 $[[q'_x,q'_y] , [q''_x,q''_y]]$, etc...

  • Add the way to retreive the tune scan data to allow the plot to de done by the user

@JeanLucPons
Copy link
Contributor

JeanLucPons commented Jan 18, 2026

2 additional remarks:

  • you can simplify the code by giving up the abstract implementations and respective attachments in control system and simulator. This will just prevent to call get_chrom() from AT but the scan you do should also work on the model

  • Concerning the moment compaction factor, I would prefer to not have a default value, if None, the measurement should raise an Exception. We may add a default to at.lattice.get_mcf() if a model is defined.

@Amoutardier Amoutardier marked this pull request as ready for review January 20, 2026 16:40
@JeanLucPons
Copy link
Contributor

JeanLucPons commented Jan 22, 2026

@Amoutardier
I did the change, let me know if it is ok for you.

import time
from pyaml.accelerator import Accelerator
import numpy as np

sr = Accelerator.load("tests/config/EBS_chromaticity.yaml")
sr.design.get_lattice().disable_6d()
alphac = sr.design.get_lattice().get_mcf()
print(alphac)
chromaticity_monitor = sr.live.get_chromaticity_monitor("KSI")
chromaticity_monitor.chromaticity_measurement(do_plot=True, fit_order=1, alphac=alphac, N_tune_meas=1, N_step=5, Sleep_between_meas=0, Sleep_between_RFvar=4, E_delta=1e-3, Max_E_delta=1e-3)
ksi = np.abs(chromaticity_monitor.chromaticity.get())
print(ksi)

fit_order=2
image
fit_order=1
image

Copy link
Contributor

@gubaidulinvadim gubaidulinvadim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is good. We probably need to place this chromaticity measurement in a different place. It is different from TuneMonitor because for tune there's a direct connection to a device that gives Q_x and Q_y (we can imagine the same for Q_s too). In this case, it is a real measurement that is not done in the background transparently. We do not have any "measurement" directory and, for me, this is a measurement, not a "tuning tool".

@JeanLucPons
Copy link
Contributor

I agree.
And this kind of pyaml device should access only pyaml "low level" device. I mean by "low level" devices , devices that have direct connection to CS.

@JeanLucPons JeanLucPons merged commit be8750a into main Jan 22, 2026
3 checks passed
@JeanLucPons JeanLucPons deleted the chromaticity_measurement_Alexandre_Moutardier branch January 22, 2026 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Chromaticity correction

4 participants