From 5434fe9906056b762c907641195fdf0c72053c6f Mon Sep 17 00:00:00 2001 From: PONS Date: Mon, 24 Nov 2025 09:00:04 +0100 Subject: [PATCH 1/6] Fix sign issue for horizontal kick angle --- pyaml/lattice/abstract_impl.py | 24 +++++++++++++-------- pyaml/lattice/polynom_info.py | 3 ++- pyaml/magnet/corrector.py | 23 ++++++++++++++++++++ pyaml/magnet/hcorrector.py | 17 ++++++++++++--- pyaml/magnet/vcorrector.py | 13 +++++++++++- tests/test_arrays.py | 39 ++++++++++++++++++++++++++++++---- tests/test_ident_models.py | 10 ++++----- 7 files changed, 106 insertions(+), 23 deletions(-) create mode 100644 pyaml/magnet/corrector.py diff --git a/pyaml/lattice/abstract_impl.py b/pyaml/lattice/abstract_impl.py index b8591ef2..ec534cc9 100644 --- a/pyaml/lattice/abstract_impl.py +++ b/pyaml/lattice/abstract_impl.py @@ -28,15 +28,16 @@ def __init__( self.__model = model self.__elements = elements self.__poly = elements[0].__getattribute__(poly.attName) + self.__sign = poly.sign self.__polyIdx = poly.index def get(self) -> float: - s = self.__poly[self.__polyIdx] * self.__elements[0].Length + s = self.__poly[self.__polyIdx] * self.__sign * self.__elements[0].Length return self.__model.compute_hardware_values([s])[0] def set(self, value: float): s = self.__model.compute_strengths([value])[0] - self.__poly[self.__polyIdx] = s / self.__elements[0].Length + self.__poly[self.__polyIdx] = s / (self.__elements[0].Length * self.__sign) def set_and_wait(self, value: float): raise NotImplementedError("Not implemented yet.") @@ -59,15 +60,16 @@ def __init__( self.__model = model self.__elements = elements self.__poly = elements[0].__getattribute__(poly.attName) + self.__sign = poly.sign self.__polyIdx = poly.index # Gets the value def get(self) -> float: - return self.__poly[self.__polyIdx] * self.__elements[0].Length + return self.__poly[self.__polyIdx] * self.__sign * self.__elements[0].Length # Sets the value - def set(self, value: float): - self.__poly[self.__polyIdx] = value / self.__elements[0].Length + def set(self, value:float): + self.__poly[self.__polyIdx] = value / (self.__elements[0].Length * self.__sign) # Sets the value and wait that the read value reach the setpoint def set_and_wait(self, value: float): @@ -93,17 +95,19 @@ def __init__( self.__elements = elements self.__poly = [] self.__polyIdx = [] + self.__sign = [] self.__model = model for p in poly: self.__poly.append(elements[0].__getattribute__(p.attName)) self.__polyIdx.append(p.index) + self.__sign.append(p.sign) # Gets the value def get(self) -> np.array: nbStrength = len(self.__poly) s = np.zeros(nbStrength) for i in range(nbStrength): - s[i] = self.__poly[i][self.__polyIdx[i]] * self.__elements[0].Length + s[i] = self.__poly[i][self.__polyIdx[i]] * self.__sign[i] * self.__elements[0].Length return self.__model.compute_hardware_values(s) # Sets the value @@ -111,7 +115,7 @@ def set(self, value: np.array): nbStrength = len(self.__poly) s = self.__model.compute_strengths(value) for i in range(nbStrength): - self.__poly[i][self.__polyIdx[i]] = s[i] / self.__elements[0].Length + self.__poly[i][self.__polyIdx[i]] = s[i] / (self.__elements[0].Length * self.__sign[i]) # Sets the value and wait that the read value reach the setpoint def set_and_wait(self, value: np.array): @@ -136,17 +140,19 @@ def __init__( self.__elements = elements self.__poly = [] self.__polyIdx = [] + self.__sign = [] self.__model = model for p in poly: self.__poly.append(elements[0].__getattribute__(p.attName)) self.__polyIdx.append(p.index) + self.__sign.append(p.sign) # Gets the value def get(self) -> np.array: nbStrength = len(self.__poly) s = np.zeros(nbStrength) for i in range(nbStrength): - s[i] = self.__poly[i][self.__polyIdx[i]] * self.__elements[0].Length + s[i] = self.__poly[i][self.__polyIdx[i]] * self.__sign[i] * self.__elements[0].Length return s # Sets the value @@ -154,7 +160,7 @@ def set(self, value: np.array): nbStrength = len(self.__poly) s = np.zeros(nbStrength) for i in range(nbStrength): - self.__poly[i][self.__polyIdx[i]] = value[i] / self.__elements[0].Length + self.__poly[i][self.__polyIdx[i]] = value[i] / (self.__elements[0].Length * self.__sign[i]) # Sets the value and wait that the read value reach the setpoint def set_and_wait(self, value: np.array): diff --git a/pyaml/lattice/polynom_info.py b/pyaml/lattice/polynom_info.py index 4d4f2aeb..fe68954d 100644 --- a/pyaml/lattice/polynom_info.py +++ b/pyaml/lattice/polynom_info.py @@ -8,7 +8,7 @@ class PolynomInfo: Polynom information """ - def __init__(self, attName: str, index: int): + def __init__(self,attName:str,index:int,sign:float=1.): """ Construct a polynom information object @@ -21,3 +21,4 @@ def __init__(self, attName: str, index: int): """ self.attName = attName self.index = index + self.sign = sign diff --git a/pyaml/magnet/corrector.py b/pyaml/magnet/corrector.py new file mode 100644 index 00000000..7335ceee --- /dev/null +++ b/pyaml/magnet/corrector.py @@ -0,0 +1,23 @@ +from .magnet import Magnet +from ..common import abstract +import numpy as np + +class RWCorrectorAngle(abstract.ReadWriteFloatScalar): + """ + Set the angle of a horizontal or vertical corrector. + KickAngle sign convention is defined the accelerator level. + """ + def __init__(self, corr:Magnet): + self._mag = corr + + def get(self) -> float: + return np.arctan(self._mag.strength.get()) + + def set(self,value:float): + self._mag.strength.set( np.tan(value) ) + + def set_and_wait(self, value:float): + raise NotImplementedError("Not implemented yet.") + + def unit(self) -> str: + return "rad" diff --git a/pyaml/magnet/hcorrector.py b/pyaml/magnet/hcorrector.py index bc2910a8..56dfa1b7 100644 --- a/pyaml/magnet/hcorrector.py +++ b/pyaml/magnet/hcorrector.py @@ -1,5 +1,6 @@ from ..lattice.polynom_info import PolynomInfo -from .magnet import Magnet, MagnetConfigModel +from ..common import abstract +from .corrector import RWCorrectorAngle # Define the main class name for this module PYAMLCLASS = "HCorrector" @@ -10,8 +11,7 @@ class ConfigModel(MagnetConfigModel): ... class HCorrector(Magnet): """Horizontal Corrector class""" - - polynom = PolynomInfo("PolynomB", 0) + polynom = PolynomInfo('PolynomB',0,-1.) def __init__(self, cfg: ConfigModel): super().__init__( @@ -19,3 +19,14 @@ def __init__(self, cfg: ConfigModel): cfg.model if hasattr(cfg, "model") else None, ) self._cfg = cfg + self.__angle = RWCorrectorAngle(self) + + @property + def angle(self) -> abstract.ReadWriteFloatScalar: + """ + Set the kick angle. + """ + return self.ange + + + diff --git a/pyaml/magnet/vcorrector.py b/pyaml/magnet/vcorrector.py index 2e5334f1..3bce72e5 100644 --- a/pyaml/magnet/vcorrector.py +++ b/pyaml/magnet/vcorrector.py @@ -1,5 +1,6 @@ from ..lattice.polynom_info import PolynomInfo -from .magnet import Magnet, MagnetConfigModel +from .corrector import RWCorrectorAngle +from ..common import abstract # Define the main class name for this module PYAMLCLASS = "VCorrector" @@ -19,3 +20,13 @@ def __init__(self, cfg: ConfigModel): cfg.model if hasattr(cfg, "model") else None, ) self._cfg = cfg + self.__angle = RWCorrectorAngle(self) + + @property + def angle(self) -> abstract.ReadWriteFloatScalar: + """ + Set the kick angle. + """ + return self.ange + + diff --git a/tests/test_arrays.py b/tests/test_arrays.py index 60fd75c6..61023526 100644 --- a/tests/test_arrays.py +++ b/tests/test_arrays.py @@ -25,29 +25,53 @@ def test_arrays(install_test_package): sr.design.get_magnet("SH1A-C01-H").strength.set(0.000010) sr.design.get_magnet("SH1A-C01-V").strength.set(0.000015) +<<<<<<< HEAD o, _ = sr.design.get_lattice().find_orbit() assert np.abs(o[0] + 9.91848416e-05) < 1e-10 assert np.abs(o[1] + 3.54829761e-07) < 1e-10 assert np.abs(o[2] + 1.56246320e-06) < 1e-10 assert np.abs(o[3] + 1.75037311e-05) < 1e-10 +======= + o,_ = sr.design.get_lattice().find_orbit() + assert(np.abs(o[0] - 9.90267693e-05)<1e-10) + assert(np.abs(o[1] - 3.39661431e-07)<1e-10) + assert(np.abs(o[2] + 1.59928207e-06)<1e-10) + assert(np.abs(o[3] + 1.74771216e-05)<1e-10) +>>>>>>> Fix sign issue for horizontal kick angle sr.design.get_magnet("SH1A-C02-H").strength.set(-0.000008) sr.design.get_magnet("SH1A-C02-V").strength.set(-0.000017) +<<<<<<< HEAD o, _ = sr.design.get_lattice().find_orbit() assert np.abs(o[0] + 1.60277642e-04) < 1e-10 assert np.abs(o[1] - 2.36103795e-06) < 1e-10 assert np.abs(o[2] - 3.62843295e-05) < 1e-10 assert np.abs(o[3] + 6.06571010e-06) < 1e-10 +======= + o,_ = sr.design.get_lattice().find_orbit() + assert(np.abs(o[0] - 1.60555804e-04)<1e-10) + assert(np.abs(o[1] + 2.37234366e-06)<1e-10) + assert(np.abs(o[2] - 3.62695844e-05)<1e-10) + assert(np.abs(o[3] + 5.97692290e-06)<1e-10) +>>>>>>> Fix sign issue for horizontal kick angle sr.design.get_magnets("HCORR").strengths.set([0.000010, -0.000008]) sr.design.get_magnets("VCORR").strengths.set([0.000015, -0.000017]) +<<<<<<< HEAD o, _ = sr.design.get_lattice().find_orbit() assert np.abs(o[0] + 1.60277642e-04) < 1e-10 assert np.abs(o[1] - 2.36103795e-06) < 1e-10 assert np.abs(o[2] - 3.62843295e-05) < 1e-10 assert np.abs(o[3] + 6.06571010e-06) < 1e-10 +======= + o,_ = sr.design.get_lattice().find_orbit() + assert(np.abs(o[0] - 1.60555804e-04)<1e-10) + assert(np.abs(o[1] + 2.37234366e-06)<1e-10) + assert(np.abs(o[2] - 3.62695844e-05)<1e-10) + assert(np.abs(o[3] + 5.97692290e-06)<1e-10) +>>>>>>> Fix sign issue for horizontal kick angle # Test on control system @@ -118,10 +142,10 @@ def test_arrays(install_test_package): # Using aggregator pos = sr.design.get_bpms("BPMS").positions.get() - assert np.abs(pos[0][0] + 7.21154171490481e-05) < 1e-10 - assert np.abs(pos[0][1] - 3.3988843436571406e-05) < 1e-10 - assert np.abs(pos[1][0] - 1.1681211772781844e-04) < 1e-10 - assert np.abs(pos[1][1] - 7.072972488250373e-06) < 1e-10 + assert(np.abs(pos[0][0] - 7.22262850488348e-05)<1e-10) + assert(np.abs(pos[0][1] - 3.4291613955705856e-05)<1e-10) + assert(np.abs(pos[1][0] + 1.1696152238807462e-04)<1e-10) + assert(np.abs(pos[1][1] - 7.4265634524358045e-06)<1e-10) # Using aggregator (h and v) pos_h = sr.design.get_bpms("BPMS").h.get() @@ -136,10 +160,17 @@ def test_arrays(install_test_package): bpms = BPMArray("BPM_noagg", bpms, use_aggregator=False) pos = bpms.positions.get() +<<<<<<< HEAD assert np.abs(pos[0][0] + 7.21154171490481e-05) < 1e-10 assert np.abs(pos[0][1] - 3.3988843436571406e-05) < 1e-10 assert np.abs(pos[1][0] - 1.1681211772781844e-04) < 1e-10 assert np.abs(pos[1][1] - 7.072972488250373e-06) < 1e-10 +======= + assert(np.abs(pos[0][0] - 7.22262850488348e-05)<1e-10) + assert(np.abs(pos[0][1] - 3.4291613955705856e-05)<1e-10) + assert(np.abs(pos[1][0] + 1.1696152238807462e-04)<1e-10) + assert(np.abs(pos[1][1] - 7.4265634524358045e-06)<1e-10) +>>>>>>> Fix sign issue for horizontal kick angle # Radom array elts = sr.design.get_elemens("ElArray") diff --git a/tests/test_ident_models.py b/tests/test_ident_models.py index 4281efcb..85dc7e2b 100644 --- a/tests/test_ident_models.py +++ b/tests/test_ident_models.py @@ -39,10 +39,10 @@ def test_cfm_magnets(magnet_file, install_test_package): magnet_h_design.strength.set(0.000010) magnet_v_design.strength.set(0.000015) - o, _ = sr.design.get_lattice().find_orbit() - assert np.abs(o[0] + 9.91848416e-05) < 1e-10 - assert np.abs(o[1] + 3.54829761e-07) < 1e-10 - assert np.abs(o[2] + 1.56246320e-06) < 1e-10 - assert np.abs(o[3] + 1.75037311e-05) < 1e-10 + o,_ = sr.design.get_lattice().find_orbit() + assert(np.abs(o[0] - 9.90267693e-05)<1e-10) + assert(np.abs(o[1] - 3.39661431e-07)<1e-10) + assert(np.abs(o[2] + 1.59928207e-06)<1e-10) + assert(np.abs(o[3] + 1.74771216e-05)<1e-10) Factory.clear() From c06160e0b25290a3758e8c775fb6a0d1a6ccc3ec Mon Sep 17 00:00:00 2001 From: PONS Date: Mon, 24 Nov 2025 14:02:43 +0100 Subject: [PATCH 2/6] Configurable horizontal kick angle convention --- pyaml/magnet/corrector.py | 7 +++++-- pyaml/magnet/hcorrector.py | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pyaml/magnet/corrector.py b/pyaml/magnet/corrector.py index 7335ceee..75a3544d 100644 --- a/pyaml/magnet/corrector.py +++ b/pyaml/magnet/corrector.py @@ -5,7 +5,10 @@ class RWCorrectorAngle(abstract.ReadWriteFloatScalar): """ Set the angle of a horizontal or vertical corrector. - KickAngle sign convention is defined the accelerator level. + KickAngle sign convention is defined the a global PyAML constant (see pyaml.common.constant.HORIZONATL_KICK_SIGN). + To change the convention, you have execute the code below prior to everything: + import pyaml.common.constants + pyaml.common.constants.HORIZONATL_KICK_SIGN = -1.0 """ def __init__(self, corr:Magnet): self._mag = corr @@ -14,7 +17,7 @@ def get(self) -> float: return np.arctan(self._mag.strength.get()) def set(self,value:float): - self._mag.strength.set( np.tan(value) ) + self._mag.strength.set(np.tan(value)) def set_and_wait(self, value:float): raise NotImplementedError("Not implemented yet.") diff --git a/pyaml/magnet/hcorrector.py b/pyaml/magnet/hcorrector.py index 56dfa1b7..80712666 100644 --- a/pyaml/magnet/hcorrector.py +++ b/pyaml/magnet/hcorrector.py @@ -1,6 +1,7 @@ from ..lattice.polynom_info import PolynomInfo from ..common import abstract from .corrector import RWCorrectorAngle +from ..common.constants import HORIZONATL_KICK_SIGN # Define the main class name for this module PYAMLCLASS = "HCorrector" @@ -11,7 +12,7 @@ class ConfigModel(MagnetConfigModel): ... class HCorrector(Magnet): """Horizontal Corrector class""" - polynom = PolynomInfo('PolynomB',0,-1.) + polynom = PolynomInfo('PolynomB',0,HORIZONATL_KICK_SIGN) def __init__(self, cfg: ConfigModel): super().__init__( From 53e18b8df07b003505c8f0d8ef1738965f82b392 Mon Sep 17 00:00:00 2001 From: PONS Date: Mon, 24 Nov 2025 14:03:24 +0100 Subject: [PATCH 3/6] Added missing file --- pyaml/common/constants.py | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 pyaml/common/constants.py diff --git a/pyaml/common/constants.py b/pyaml/common/constants.py new file mode 100644 index 00000000..1c5053ae --- /dev/null +++ b/pyaml/common/constants.py @@ -0,0 +1,5 @@ +""" +PyAML global constants +""" + +HORIZONATL_KICK_SIGN:float = -1.0 From 013943f127bd8bebb4a85182cf47afe624ec7895 Mon Sep 17 00:00:00 2001 From: PONS Date: Tue, 25 Nov 2025 09:03:13 +0100 Subject: [PATCH 4/6] Fix typos, added test for kick angle --- pyaml/common/constants.py | 2 +- pyaml/magnet/corrector.py | 4 ++-- pyaml/magnet/hcorrector.py | 7 +++--- pyaml/magnet/vcorrector.py | 3 ++- tests/test_arrays.py | 45 ++++++++++++-------------------------- 5 files changed, 23 insertions(+), 38 deletions(-) diff --git a/pyaml/common/constants.py b/pyaml/common/constants.py index 1c5053ae..d6de4d3f 100644 --- a/pyaml/common/constants.py +++ b/pyaml/common/constants.py @@ -2,4 +2,4 @@ PyAML global constants """ -HORIZONATL_KICK_SIGN:float = -1.0 +HORIZONTAL_KICK_SIGN:float = -1.0 diff --git a/pyaml/magnet/corrector.py b/pyaml/magnet/corrector.py index 75a3544d..738e3ce8 100644 --- a/pyaml/magnet/corrector.py +++ b/pyaml/magnet/corrector.py @@ -8,9 +8,9 @@ class RWCorrectorAngle(abstract.ReadWriteFloatScalar): KickAngle sign convention is defined the a global PyAML constant (see pyaml.common.constant.HORIZONATL_KICK_SIGN). To change the convention, you have execute the code below prior to everything: import pyaml.common.constants - pyaml.common.constants.HORIZONATL_KICK_SIGN = -1.0 + pyaml.common.constants.HORIZONTAL_KICK_SIGN = -1.0 """ - def __init__(self, corr:Magnet): + def __init__(self, corr:Magnet): self._mag = corr def get(self) -> float: diff --git a/pyaml/magnet/hcorrector.py b/pyaml/magnet/hcorrector.py index 80712666..6e64ab15 100644 --- a/pyaml/magnet/hcorrector.py +++ b/pyaml/magnet/hcorrector.py @@ -1,7 +1,8 @@ from ..lattice.polynom_info import PolynomInfo +from .magnet import Magnet, MagnetConfigModel from ..common import abstract from .corrector import RWCorrectorAngle -from ..common.constants import HORIZONATL_KICK_SIGN +from ..common.constants import HORIZONTAL_KICK_SIGN # Define the main class name for this module PYAMLCLASS = "HCorrector" @@ -12,7 +13,7 @@ class ConfigModel(MagnetConfigModel): ... class HCorrector(Magnet): """Horizontal Corrector class""" - polynom = PolynomInfo('PolynomB',0,HORIZONATL_KICK_SIGN) + polynom = PolynomInfo('PolynomB',0,HORIZONTAL_KICK_SIGN) def __init__(self, cfg: ConfigModel): super().__init__( @@ -27,7 +28,7 @@ def angle(self) -> abstract.ReadWriteFloatScalar: """ Set the kick angle. """ - return self.ange + return self.__angle diff --git a/pyaml/magnet/vcorrector.py b/pyaml/magnet/vcorrector.py index 3bce72e5..5a685810 100644 --- a/pyaml/magnet/vcorrector.py +++ b/pyaml/magnet/vcorrector.py @@ -1,4 +1,5 @@ from ..lattice.polynom_info import PolynomInfo +from .magnet import Magnet, MagnetConfigModel from .corrector import RWCorrectorAngle from ..common import abstract @@ -27,6 +28,6 @@ def angle(self) -> abstract.ReadWriteFloatScalar: """ Set the kick angle. """ - return self.ange + return self.__angle diff --git a/tests/test_arrays.py b/tests/test_arrays.py index 61023526..4c1fea83 100644 --- a/tests/test_arrays.py +++ b/tests/test_arrays.py @@ -25,53 +25,43 @@ def test_arrays(install_test_package): sr.design.get_magnet("SH1A-C01-H").strength.set(0.000010) sr.design.get_magnet("SH1A-C01-V").strength.set(0.000015) -<<<<<<< HEAD - o, _ = sr.design.get_lattice().find_orbit() - assert np.abs(o[0] + 9.91848416e-05) < 1e-10 - assert np.abs(o[1] + 3.54829761e-07) < 1e-10 - assert np.abs(o[2] + 1.56246320e-06) < 1e-10 - assert np.abs(o[3] + 1.75037311e-05) < 1e-10 -======= o,_ = sr.design.get_lattice().find_orbit() assert(np.abs(o[0] - 9.90267693e-05)<1e-10) assert(np.abs(o[1] - 3.39661431e-07)<1e-10) assert(np.abs(o[2] + 1.59928207e-06)<1e-10) assert(np.abs(o[3] + 1.74771216e-05)<1e-10) ->>>>>>> Fix sign issue for horizontal kick angle sr.design.get_magnet("SH1A-C02-H").strength.set(-0.000008) sr.design.get_magnet("SH1A-C02-V").strength.set(-0.000017) -<<<<<<< HEAD - o, _ = sr.design.get_lattice().find_orbit() - assert np.abs(o[0] + 1.60277642e-04) < 1e-10 - assert np.abs(o[1] - 2.36103795e-06) < 1e-10 - assert np.abs(o[2] - 3.62843295e-05) < 1e-10 - assert np.abs(o[3] + 6.06571010e-06) < 1e-10 -======= o,_ = sr.design.get_lattice().find_orbit() assert(np.abs(o[0] - 1.60555804e-04)<1e-10) assert(np.abs(o[1] + 2.37234366e-06)<1e-10) assert(np.abs(o[2] - 3.62695844e-05)<1e-10) assert(np.abs(o[3] + 5.97692290e-06)<1e-10) ->>>>>>> Fix sign issue for horizontal kick angle sr.design.get_magnets("HCORR").strengths.set([0.000010, -0.000008]) sr.design.get_magnets("VCORR").strengths.set([0.000015, -0.000017]) -<<<<<<< HEAD - o, _ = sr.design.get_lattice().find_orbit() - assert np.abs(o[0] + 1.60277642e-04) < 1e-10 - assert np.abs(o[1] - 2.36103795e-06) < 1e-10 - assert np.abs(o[2] - 3.62843295e-05) < 1e-10 - assert np.abs(o[3] + 6.06571010e-06) < 1e-10 -======= o,_ = sr.design.get_lattice().find_orbit() assert(np.abs(o[0] - 1.60555804e-04)<1e-10) assert(np.abs(o[1] + 2.37234366e-06)<1e-10) assert(np.abs(o[2] - 3.62695844e-05)<1e-10) assert(np.abs(o[3] + 5.97692290e-06)<1e-10) ->>>>>>> Fix sign issue for horizontal kick angle + + p0 = o[0] + + # Test kick angle (small angle, no change from above) + sr.design.get_magnet("SH1A-C02-H").angle.set(-0.000008) + o,_ = sr.design.get_lattice().find_orbit() + assert(np.abs(o[0] - 1.60555804e-04)<1e-10) + assert(np.abs(o[1] + 2.37234366e-06)<1e-10) + assert(np.abs(o[2] - 3.62695844e-05)<1e-10) + assert(np.abs(o[3] + 5.97692290e-06)<1e-10) + + p1 = o[0] + # Diff between small angle approximation and angle + assert(np.abs(p0-p1)-1.3504822260479443e-15 < 1e-20) # Test on control system @@ -160,17 +150,10 @@ def test_arrays(install_test_package): bpms = BPMArray("BPM_noagg", bpms, use_aggregator=False) pos = bpms.positions.get() -<<<<<<< HEAD - assert np.abs(pos[0][0] + 7.21154171490481e-05) < 1e-10 - assert np.abs(pos[0][1] - 3.3988843436571406e-05) < 1e-10 - assert np.abs(pos[1][0] - 1.1681211772781844e-04) < 1e-10 - assert np.abs(pos[1][1] - 7.072972488250373e-06) < 1e-10 -======= assert(np.abs(pos[0][0] - 7.22262850488348e-05)<1e-10) assert(np.abs(pos[0][1] - 3.4291613955705856e-05)<1e-10) assert(np.abs(pos[1][0] + 1.1696152238807462e-04)<1e-10) assert(np.abs(pos[1][1] - 7.4265634524358045e-06)<1e-10) ->>>>>>> Fix sign issue for horizontal kick angle # Radom array elts = sr.design.get_elemens("ElArray") From 8f84f8db000a092f76df56b017ac8c8ac6c78f7a Mon Sep 17 00:00:00 2001 From: PONS Date: Tue, 25 Nov 2025 09:24:43 +0100 Subject: [PATCH 5/6] Fix formating --- pyaml/common/constants.py | 2 +- pyaml/lattice/abstract_impl.py | 26 +++++++++++---- pyaml/lattice/polynom_info.py | 2 +- pyaml/magnet/corrector.py | 20 +++++++----- pyaml/magnet/hcorrector.py | 12 +++---- pyaml/magnet/vcorrector.py | 6 ++-- tests/test_arrays.py | 60 +++++++++++++++++----------------- tests/test_ident_models.py | 10 +++--- 8 files changed, 75 insertions(+), 63 deletions(-) diff --git a/pyaml/common/constants.py b/pyaml/common/constants.py index d6de4d3f..b6227f5d 100644 --- a/pyaml/common/constants.py +++ b/pyaml/common/constants.py @@ -2,4 +2,4 @@ PyAML global constants """ -HORIZONTAL_KICK_SIGN:float = -1.0 +HORIZONTAL_KICK_SIGN: float = -1.0 diff --git a/pyaml/lattice/abstract_impl.py b/pyaml/lattice/abstract_impl.py index ec534cc9..6651e18d 100644 --- a/pyaml/lattice/abstract_impl.py +++ b/pyaml/lattice/abstract_impl.py @@ -68,7 +68,7 @@ def get(self) -> float: return self.__poly[self.__polyIdx] * self.__sign * self.__elements[0].Length # Sets the value - def set(self, value:float): + def set(self, value: float): self.__poly[self.__polyIdx] = value / (self.__elements[0].Length * self.__sign) # Sets the value and wait that the read value reach the setpoint @@ -107,7 +107,11 @@ def get(self) -> np.array: nbStrength = len(self.__poly) s = np.zeros(nbStrength) for i in range(nbStrength): - s[i] = self.__poly[i][self.__polyIdx[i]] * self.__sign[i] * self.__elements[0].Length + s[i] = ( + self.__poly[i][self.__polyIdx[i]] + * self.__sign[i] + * self.__elements[0].Length + ) return self.__model.compute_hardware_values(s) # Sets the value @@ -115,7 +119,9 @@ def set(self, value: np.array): nbStrength = len(self.__poly) s = self.__model.compute_strengths(value) for i in range(nbStrength): - self.__poly[i][self.__polyIdx[i]] = s[i] / (self.__elements[0].Length * self.__sign[i]) + self.__poly[i][self.__polyIdx[i]] = s[i] / ( + self.__elements[0].Length * self.__sign[i] + ) # Sets the value and wait that the read value reach the setpoint def set_and_wait(self, value: np.array): @@ -152,7 +158,11 @@ def get(self) -> np.array: nbStrength = len(self.__poly) s = np.zeros(nbStrength) for i in range(nbStrength): - s[i] = self.__poly[i][self.__polyIdx[i]] * self.__sign[i] * self.__elements[0].Length + s[i] = ( + self.__poly[i][self.__polyIdx[i]] + * self.__sign[i] + * self.__elements[0].Length + ) return s # Sets the value @@ -160,7 +170,9 @@ def set(self, value: np.array): nbStrength = len(self.__poly) s = np.zeros(nbStrength) for i in range(nbStrength): - self.__poly[i][self.__polyIdx[i]] = value[i] / (self.__elements[0].Length * self.__sign[i]) + self.__poly[i][self.__polyIdx[i]] = value[i] / ( + self.__elements[0].Length * self.__sign[i] + ) # Sets the value and wait that the read value reach the setpoint def set_and_wait(self, value: np.array): @@ -179,11 +191,11 @@ class BPMScalarAggregator(ScalarAggregator): BPM simulator aggregator """ - def __init__(self, ring:at.Lattice): + def __init__(self, ring: at.Lattice): self.lattice = ring self.refpts = [] - def add_elem(self,elem:at.Element): + def add_elem(self, elem: at.Element): self.refpts.append(self.lattice.index(elem)) def set(self, value: NDArray[np.float64]): diff --git a/pyaml/lattice/polynom_info.py b/pyaml/lattice/polynom_info.py index fe68954d..6e03a49d 100644 --- a/pyaml/lattice/polynom_info.py +++ b/pyaml/lattice/polynom_info.py @@ -8,7 +8,7 @@ class PolynomInfo: Polynom information """ - def __init__(self,attName:str,index:int,sign:float=1.): + def __init__(self, attName: str, index: int, sign: float = 1.0): """ Construct a polynom information object diff --git a/pyaml/magnet/corrector.py b/pyaml/magnet/corrector.py index 738e3ce8..606495b6 100644 --- a/pyaml/magnet/corrector.py +++ b/pyaml/magnet/corrector.py @@ -1,26 +1,30 @@ -from .magnet import Magnet -from ..common import abstract import numpy as np +from ..common import abstract +from .magnet import Magnet + + class RWCorrectorAngle(abstract.ReadWriteFloatScalar): """ Set the angle of a horizontal or vertical corrector. - KickAngle sign convention is defined the a global PyAML constant (see pyaml.common.constant.HORIZONATL_KICK_SIGN). + KickAngle sign convention is defined the a global PyAML constant + (see pyaml.common.constant.HORIZONATL_KICK_SIGN). To change the convention, you have execute the code below prior to everything: import pyaml.common.constants pyaml.common.constants.HORIZONTAL_KICK_SIGN = -1.0 """ - def __init__(self, corr:Magnet): + + def __init__(self, corr: Magnet): self._mag = corr def get(self) -> float: return np.arctan(self._mag.strength.get()) - - def set(self,value:float): + + def set(self, value: float): self._mag.strength.set(np.tan(value)) - def set_and_wait(self, value:float): + def set_and_wait(self, value: float): raise NotImplementedError("Not implemented yet.") - + def unit(self) -> str: return "rad" diff --git a/pyaml/magnet/hcorrector.py b/pyaml/magnet/hcorrector.py index 6e64ab15..eb9b670f 100644 --- a/pyaml/magnet/hcorrector.py +++ b/pyaml/magnet/hcorrector.py @@ -1,8 +1,8 @@ -from ..lattice.polynom_info import PolynomInfo -from .magnet import Magnet, MagnetConfigModel from ..common import abstract -from .corrector import RWCorrectorAngle from ..common.constants import HORIZONTAL_KICK_SIGN +from ..lattice.polynom_info import PolynomInfo +from .corrector import RWCorrectorAngle +from .magnet import Magnet, MagnetConfigModel # Define the main class name for this module PYAMLCLASS = "HCorrector" @@ -13,7 +13,8 @@ class ConfigModel(MagnetConfigModel): ... class HCorrector(Magnet): """Horizontal Corrector class""" - polynom = PolynomInfo('PolynomB',0,HORIZONTAL_KICK_SIGN) + + polynom = PolynomInfo("PolynomB", 0, HORIZONTAL_KICK_SIGN) def __init__(self, cfg: ConfigModel): super().__init__( @@ -29,6 +30,3 @@ def angle(self) -> abstract.ReadWriteFloatScalar: Set the kick angle. """ return self.__angle - - - diff --git a/pyaml/magnet/vcorrector.py b/pyaml/magnet/vcorrector.py index 5a685810..a2f3850e 100644 --- a/pyaml/magnet/vcorrector.py +++ b/pyaml/magnet/vcorrector.py @@ -1,7 +1,7 @@ +from ..common import abstract from ..lattice.polynom_info import PolynomInfo -from .magnet import Magnet, MagnetConfigModel from .corrector import RWCorrectorAngle -from ..common import abstract +from .magnet import Magnet, MagnetConfigModel # Define the main class name for this module PYAMLCLASS = "VCorrector" @@ -29,5 +29,3 @@ def angle(self) -> abstract.ReadWriteFloatScalar: Set the kick angle. """ return self.__angle - - diff --git a/tests/test_arrays.py b/tests/test_arrays.py index 4c1fea83..e26b32a3 100644 --- a/tests/test_arrays.py +++ b/tests/test_arrays.py @@ -25,43 +25,43 @@ def test_arrays(install_test_package): sr.design.get_magnet("SH1A-C01-H").strength.set(0.000010) sr.design.get_magnet("SH1A-C01-V").strength.set(0.000015) - o,_ = sr.design.get_lattice().find_orbit() - assert(np.abs(o[0] - 9.90267693e-05)<1e-10) - assert(np.abs(o[1] - 3.39661431e-07)<1e-10) - assert(np.abs(o[2] + 1.59928207e-06)<1e-10) - assert(np.abs(o[3] + 1.74771216e-05)<1e-10) + o, _ = sr.design.get_lattice().find_orbit() + assert np.abs(o[0] - 9.90267693e-05) < 1e-10 + assert np.abs(o[1] - 3.39661431e-07) < 1e-10 + assert np.abs(o[2] + 1.59928207e-06) < 1e-10 + assert np.abs(o[3] + 1.74771216e-05) < 1e-10 sr.design.get_magnet("SH1A-C02-H").strength.set(-0.000008) sr.design.get_magnet("SH1A-C02-V").strength.set(-0.000017) - o,_ = sr.design.get_lattice().find_orbit() - assert(np.abs(o[0] - 1.60555804e-04)<1e-10) - assert(np.abs(o[1] + 2.37234366e-06)<1e-10) - assert(np.abs(o[2] - 3.62695844e-05)<1e-10) - assert(np.abs(o[3] + 5.97692290e-06)<1e-10) + o, _ = sr.design.get_lattice().find_orbit() + assert np.abs(o[0] - 1.60555804e-04) < 1e-10 + assert np.abs(o[1] + 2.37234366e-06) < 1e-10 + assert np.abs(o[2] - 3.62695844e-05) < 1e-10 + assert np.abs(o[3] + 5.97692290e-06) < 1e-10 sr.design.get_magnets("HCORR").strengths.set([0.000010, -0.000008]) sr.design.get_magnets("VCORR").strengths.set([0.000015, -0.000017]) - o,_ = sr.design.get_lattice().find_orbit() - assert(np.abs(o[0] - 1.60555804e-04)<1e-10) - assert(np.abs(o[1] + 2.37234366e-06)<1e-10) - assert(np.abs(o[2] - 3.62695844e-05)<1e-10) - assert(np.abs(o[3] + 5.97692290e-06)<1e-10) + o, _ = sr.design.get_lattice().find_orbit() + assert np.abs(o[0] - 1.60555804e-04) < 1e-10 + assert np.abs(o[1] + 2.37234366e-06) < 1e-10 + assert np.abs(o[2] - 3.62695844e-05) < 1e-10 + assert np.abs(o[3] + 5.97692290e-06) < 1e-10 p0 = o[0] # Test kick angle (small angle, no change from above) sr.design.get_magnet("SH1A-C02-H").angle.set(-0.000008) - o,_ = sr.design.get_lattice().find_orbit() - assert(np.abs(o[0] - 1.60555804e-04)<1e-10) - assert(np.abs(o[1] + 2.37234366e-06)<1e-10) - assert(np.abs(o[2] - 3.62695844e-05)<1e-10) - assert(np.abs(o[3] + 5.97692290e-06)<1e-10) + o, _ = sr.design.get_lattice().find_orbit() + assert np.abs(o[0] - 1.60555804e-04) < 1e-10 + assert np.abs(o[1] + 2.37234366e-06) < 1e-10 + assert np.abs(o[2] - 3.62695844e-05) < 1e-10 + assert np.abs(o[3] + 5.97692290e-06) < 1e-10 p1 = o[0] # Diff between small angle approximation and angle - assert(np.abs(p0-p1)-1.3504822260479443e-15 < 1e-20) + assert np.abs(p0 - p1) - 1.3504822260479443e-15 < 1e-20 # Test on control system @@ -132,10 +132,10 @@ def test_arrays(install_test_package): # Using aggregator pos = sr.design.get_bpms("BPMS").positions.get() - assert(np.abs(pos[0][0] - 7.22262850488348e-05)<1e-10) - assert(np.abs(pos[0][1] - 3.4291613955705856e-05)<1e-10) - assert(np.abs(pos[1][0] + 1.1696152238807462e-04)<1e-10) - assert(np.abs(pos[1][1] - 7.4265634524358045e-06)<1e-10) + assert np.abs(pos[0][0] - 7.22262850488348e-05) < 1e-10 + assert np.abs(pos[0][1] - 3.4291613955705856e-05) < 1e-10 + assert np.abs(pos[1][0] + 1.1696152238807462e-04) < 1e-10 + assert np.abs(pos[1][1] - 7.4265634524358045e-06) < 1e-10 # Using aggregator (h and v) pos_h = sr.design.get_bpms("BPMS").h.get() @@ -150,10 +150,10 @@ def test_arrays(install_test_package): bpms = BPMArray("BPM_noagg", bpms, use_aggregator=False) pos = bpms.positions.get() - assert(np.abs(pos[0][0] - 7.22262850488348e-05)<1e-10) - assert(np.abs(pos[0][1] - 3.4291613955705856e-05)<1e-10) - assert(np.abs(pos[1][0] + 1.1696152238807462e-04)<1e-10) - assert(np.abs(pos[1][1] - 7.4265634524358045e-06)<1e-10) + assert np.abs(pos[0][0] - 7.22262850488348e-05) < 1e-10 + assert np.abs(pos[0][1] - 3.4291613955705856e-05) < 1e-10 + assert np.abs(pos[1][0] + 1.1696152238807462e-04) < 1e-10 + assert np.abs(pos[1][1] - 7.4265634524358045e-06) < 1e-10 # Radom array elts = sr.design.get_elemens("ElArray") @@ -196,7 +196,7 @@ def test_arrays(install_test_package): assert np.abs(strHVSQ[4] + 0.000017) < 1e-10 # V assert np.abs(strHVSQ[5] - 1e-6) < 1e-10 # SQ - bpmsLive = BPMArray("",sr.live.get_all_bpms()) + bpmsLive = BPMArray("", sr.live.get_all_bpms()) bpmsLive.positions.get() Factory.clear() diff --git a/tests/test_ident_models.py b/tests/test_ident_models.py index 85dc7e2b..4b0d9dcc 100644 --- a/tests/test_ident_models.py +++ b/tests/test_ident_models.py @@ -39,10 +39,10 @@ def test_cfm_magnets(magnet_file, install_test_package): magnet_h_design.strength.set(0.000010) magnet_v_design.strength.set(0.000015) - o,_ = sr.design.get_lattice().find_orbit() - assert(np.abs(o[0] - 9.90267693e-05)<1e-10) - assert(np.abs(o[1] - 3.39661431e-07)<1e-10) - assert(np.abs(o[2] + 1.59928207e-06)<1e-10) - assert(np.abs(o[3] + 1.74771216e-05)<1e-10) + o, _ = sr.design.get_lattice().find_orbit() + assert np.abs(o[0] - 9.90267693e-05) < 1e-10 + assert np.abs(o[1] - 3.39661431e-07) < 1e-10 + assert np.abs(o[2] + 1.59928207e-06) < 1e-10 + assert np.abs(o[3] + 1.74771216e-05) < 1e-10 Factory.clear() From e064bf9214a0b5dc4c80dd6ba7712bab3da9f4ac Mon Sep 17 00:00:00 2001 From: gubaidulinvadim Date: Tue, 25 Nov 2025 10:15:47 +0100 Subject: [PATCH 6/6] Fixing formatting (trailing white spaces in docs/ and tests/) --- .github/ISSUE_TEMPLATE/feature_request.md | 2 +- .../PULL_REQUEST_TEMPLATE/pull_request_template.md | 4 ++-- .github/workflows/deploy-pypi.yaml | 4 ++-- .github/workflows/documentation.yml | 11 ++++------- .gitignore | 2 +- .readthedocs.yaml | 1 - README.md | 4 ++-- docs/Makefile | 2 +- docs/api.rst | 2 +- docs/index.rst | 11 +++++------ docs/modules/bpm.rst | 2 +- docs/modules/configuration.rst | 4 ++-- docs/modules/lattice.rst | 4 +--- docs/modules/pyaml.rst | 1 - docs/modules/rf.rst | 1 - docs/requirements.txt | 2 +- tests/config/EBSOrbit.yaml | 2 +- tests/config/EBSTune.yaml | 1 - tests/config/EBS_rf.yaml | 4 ++-- tests/config/EBS_rf_multi.yaml | 2 +- tests/config/EBS_rf_notrans.yaml | 6 +++--- tests/config/bad_conf_cycles.json | 2 +- tests/config/bpms.yaml | 4 ++-- tests/config/sr-attribute-linker.yaml | 2 +- tests/config/sr-ident-cfm.yaml | 2 +- tests/config/sr/correctors/SH1AC01-ident.yaml | 4 ++-- tests/config/sr/correctors/SH1AC01.yaml | 4 ++-- tests/config/sr/correctors/SH1AC02.yaml | 4 ++-- tests/config/sr/custom_magnets/hidcorr.yaml | 2 +- tests/config/sr/magnet_models/QD2_strength.csv | 2 +- tests/config/sr/magnet_models/QF1AC01.yaml | 2 +- tests/config/sr/magnet_models/SH1AC01.yaml | 2 +- tests/config/sr/magnet_models/SH1AC02.yaml | 2 +- tests/config/sr/magnet_models/quadcurve.yaml | 2 +- tests/config/sr/magnet_models/quadcurve_data.yaml | 2 +- tests/config/sr/quadrupoles/QF1AC01-IDENT-HW.yaml | 1 - tests/config/sr/quadrupoles/QF1C01A_2.yaml | 2 +- tests/external/pyproject.toml | 2 +- 38 files changed, 51 insertions(+), 62 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index f9784d21..3a6f856b 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -17,7 +17,7 @@ A clear and concise description of what you want to happen. A clear and concise description of any alternative solutions or features you've considered. An argument for why this solution is not the preferred one. **Example** -Give a concise example of the envisioned featured. +Give a concise example of the envisioned featured. **Additional context** Add any other context or screenshots about the feature request here. diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md index 3f59e42b..dff92f81 100644 --- a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +++ b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md @@ -22,11 +22,11 @@ Describe the changes that had to be made to an existing functionality (if they w - [ ] ... ## Testing - The following tests (compatible with pytest) were added: + The following tests (compatible with pytest) were added: - [ ] first test - [ ] second test - ... - + ## Verify that your checklist complies with the project - [ ] New and existing unit tests pass locally - [ ] Tests were added to prove that all features/changes are effective diff --git a/.github/workflows/deploy-pypi.yaml b/.github/workflows/deploy-pypi.yaml index ecd56716..738987b2 100644 --- a/.github/workflows/deploy-pypi.yaml +++ b/.github/workflows/deploy-pypi.yaml @@ -8,7 +8,7 @@ on: jobs: deploy: - + runs-on: ubuntu-latest #environment: release @@ -25,7 +25,7 @@ jobs: cache-dependency-path: '**/pyproject.toml' - name: Install dependencies run: | - python -m pip install --upgrade pip + python -m pip install --upgrade pip pip install hatch - name: Build package run: hatch build diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 04c11c2b..053ecb44 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -13,14 +13,14 @@ permissions: write-all jobs: documentation: name: ${{ matrix.os }} / ${{ matrix.python-version }} - + runs-on: ${{ matrix.os }} - + strategy: matrix: # only lowest supported Python on latest ubuntu os: [ubuntu-latest] python-version: [3.14] - + permissions: issues: write pull-requests: write @@ -49,7 +49,7 @@ jobs: - name: Install dependencies run: pip install -r ./docs/requirements.txt - + - name: Build documentation run: python -m sphinx -b html docs ./docs/_build -d ./docs/_build @@ -81,6 +81,3 @@ jobs: # with: # github_token: ${{ secrets.GITHUB_TOKEN }} # publish_dir: docs/_build/html - - - \ No newline at end of file diff --git a/.gitignore b/.gitignore index 8192a5e0..616c197e 100644 --- a/.gitignore +++ b/.gitignore @@ -59,7 +59,7 @@ coverage.xml .pytest_cache/ cover/ -# DS +# DS **/.DS_Store # Translations diff --git a/.readthedocs.yaml b/.readthedocs.yaml index c23d12bf..511a6cab 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -30,4 +30,3 @@ sphinx: python: install: - requirements: docs/requirements.txt - diff --git a/README.md b/README.md index a17daaae..b20ecc39 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Documentation Status](https://readthedocs.org/projects/pyaml/badge/?version=latest)](https://pyaml.readthedocs.io/en/latest/?badge=latest) +[![Documentation Status](https://readthedocs.org/projects/pyaml/badge/?version=latest)](https://pyaml.readthedocs.io/en/latest/?badge=latest) ![Current release](https://img.shields.io/github/v/tag/python-accelerator-middle-layer/pyaml) # pyAML: Python Accelerator Middle Layer @@ -10,7 +10,7 @@ Disclaimer: the pyAML software is still under development. 1. Clone the repository 2. Create a virtual environment and activate it 3. Install the package. For editable installation: - + ``` cd pyaml pip install -e . diff --git a/docs/Makefile b/docs/Makefile index 36fdb7b5..c468f816 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -156,4 +156,4 @@ linkcheck: doctest: $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ - "results in $(BUILDDIR)/doctest/output.txt." \ No newline at end of file + "results in $(BUILDDIR)/doctest/output.txt." diff --git a/docs/api.rst b/docs/api.rst index b68bd568..9553643a 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -5,4 +5,4 @@ API :toctree: generated :recursive: - pyaml \ No newline at end of file + pyaml diff --git a/docs/index.rst b/docs/index.rst index 67e4267a..c66a1a23 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,6 +1,6 @@ pyAML documentation =================== - + Introduction ------------ @@ -14,12 +14,12 @@ With pyAML, it WILL be possible to (the software is at conceptualization stage): - **compute statistical properties for several lattice instances with errors** - **flexible complex unit conversions** - **easy and friendly configuration** -- many more features +- many more features Installation ------------ -pip support will be provided later. -for the time being: +pip support will be provided later. +for the time being: git clone https://github.com/python-accelerator-middle-layer/pyaml.git @@ -57,7 +57,7 @@ Discussion Shared documents ~~~~~~~~~~~~~~~~ -to access the shared documents please ask S.Liuzzo for access rigths. +to access the shared documents please ask S.Liuzzo for access rigths. The pyAML "software requirement specification" document is visible here: https://www.overleaf.com/read/hnrqzhfpbvpp#ef8935 @@ -76,4 +76,3 @@ Indices and tables * :ref:`genindex` * :ref:`modindex` * :ref:`search` - diff --git a/docs/modules/bpm.rst b/docs/modules/bpm.rst index f5ff7867..2dd4b5f2 100644 --- a/docs/modules/bpm.rst +++ b/docs/modules/bpm.rst @@ -11,4 +11,4 @@ BPMS :members: .. automodule:: pyaml.bpm.bpm_simple_model - :members: \ No newline at end of file + :members: diff --git a/docs/modules/configuration.rst b/docs/modules/configuration.rst index dc44a648..68c1b6cf 100644 --- a/docs/modules/configuration.rst +++ b/docs/modules/configuration.rst @@ -6,7 +6,7 @@ Configuration .. automodule:: pyaml.configuration.factory :members: - + .. automodule:: pyaml.configuration.matrix :members: @@ -18,7 +18,7 @@ Configuration .. automodule:: pyaml.configuration.matrix :members: - + .. automodule:: pyaml.configuration.csvmatrix :members: diff --git a/docs/modules/lattice.rst b/docs/modules/lattice.rst index 781c017e..cce3d9aa 100644 --- a/docs/modules/lattice.rst +++ b/docs/modules/lattice.rst @@ -6,7 +6,7 @@ lattice .. automodule:: pyaml.lattice.attribute_linker :members: - + .. automodule:: pyaml.lattice.element_holder :members: @@ -21,5 +21,3 @@ lattice .. automodule:: pyaml.lattice.simulator :members: - - diff --git a/docs/modules/pyaml.rst b/docs/modules/pyaml.rst index fd258108..ce558c7e 100644 --- a/docs/modules/pyaml.rst +++ b/docs/modules/pyaml.rst @@ -21,4 +21,3 @@ pyaml .. toctree:: :maxdepth: 2 :caption: Contents: - diff --git a/docs/modules/rf.rst b/docs/modules/rf.rst index 2d5a3b62..390a6d1e 100644 --- a/docs/modules/rf.rst +++ b/docs/modules/rf.rst @@ -6,4 +6,3 @@ RF .. automodule:: pyaml.rf.rf_transmitter :members: - diff --git a/docs/requirements.txt b/docs/requirements.txt index b624fa8e..bfadd59e 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -12,4 +12,4 @@ accelerator-toolbox==0.7.1 matplotlib==3.10.7 ipykernel==7.1.0 myst-nb==1.3.0 -pydata-sphinx-theme==0.16.1 \ No newline at end of file +pydata-sphinx-theme==0.16.1 diff --git a/tests/config/EBSOrbit.yaml b/tests/config/EBSOrbit.yaml index b5d72a8d..3e406c97 100644 --- a/tests/config/EBSOrbit.yaml +++ b/tests/config/EBSOrbit.yaml @@ -927,7 +927,7 @@ devices: tune_v: type: tango.pyaml.attribute_read_only attribute: sys/ringsimulator/ebs/Tune_v - unit: "" + unit: "" - type: pyaml.rf.rf_plant name: RF masterclock: diff --git a/tests/config/EBSTune.yaml b/tests/config/EBSTune.yaml index 41714113..e2d03d92 100644 --- a/tests/config/EBSTune.yaml +++ b/tests/config/EBSTune.yaml @@ -1885,4 +1885,3 @@ devices: type: tango.pyaml.attribute_read_only attribute: srdiag/tune/tune_v unit: mm - diff --git a/tests/config/EBS_rf.yaml b/tests/config/EBS_rf.yaml index 59aa86a5..67274c18 100644 --- a/tests/config/EBS_rf.yaml +++ b/tests/config/EBS_rf.yaml @@ -8,9 +8,9 @@ simulators: controls: - type: tango.pyaml.controlsystem tango_host: ebs-simu-3:10000 - name: live + name: live data_folder: /data/store -devices: +devices: - type: pyaml.rf.rf_plant name: RF masterclock: diff --git a/tests/config/EBS_rf_multi.yaml b/tests/config/EBS_rf_multi.yaml index e79ca5bc..4a899f02 100644 --- a/tests/config/EBS_rf_multi.yaml +++ b/tests/config/EBS_rf_multi.yaml @@ -10,7 +10,7 @@ controls: tango_host: ebs-simu-3:10000 name: live data_folder: /data/store -devices: +devices: - type: pyaml.rf.rf_plant name: RF masterclock: diff --git a/tests/config/EBS_rf_notrans.yaml b/tests/config/EBS_rf_notrans.yaml index c3a61870..2a62123b 100644 --- a/tests/config/EBS_rf_notrans.yaml +++ b/tests/config/EBS_rf_notrans.yaml @@ -8,12 +8,12 @@ simulators: controls: - type: tango.pyaml.controlsystem tango_host: ebs-simu-3:10000 - name: live + name: live data_folder: /data/store -devices: +devices: - type: pyaml.rf.rf_plant name: RF masterclock: type: tango.pyaml.attribute attribute: sy/ms/1/Frequency - unit: Hz \ No newline at end of file + unit: Hz diff --git a/tests/config/bad_conf_cycles.json b/tests/config/bad_conf_cycles.json index ee420251..587f760b 100644 --- a/tests/config/bad_conf_cycles.json +++ b/tests/config/bad_conf_cycles.json @@ -24,4 +24,4 @@ "sr/correctors/SH1AC01.yaml", "sr/correctors/SH1AC02.yaml" ] -} \ No newline at end of file +} diff --git a/tests/config/bpms.yaml b/tests/config/bpms.yaml index 50e7f168..8cbf4fd5 100644 --- a/tests/config/bpms.yaml +++ b/tests/config/bpms.yaml @@ -62,8 +62,8 @@ devices: - type: pyaml.magnet.cfm_magnet name: SH1A-C01 #Name of the element in the lattice model mapping: - # Multipole mapping for usage in families, in this example SH1-C01A-H is not - # a lattice element present in the model, it is just a name to use in + # Multipole mapping for usage in families, in this example SH1-C01A-H is not + # a lattice element present in the model, it is just a name to use in # PyAML families. When this 'virutal' element is set, it then applies # the corresponding multipole on the parent element. - [B0, SH1A-C01-H] diff --git a/tests/config/sr-attribute-linker.yaml b/tests/config/sr-attribute-linker.yaml index 106122d5..4b465a34 100644 --- a/tests/config/sr-attribute-linker.yaml +++ b/tests/config/sr-attribute-linker.yaml @@ -23,4 +23,4 @@ arrays: devices: - sr/quadrupoles/QF1AC01.yaml - sr/correctors/SH1AC01.yaml - - sr/correctors/SH1AC02.yaml \ No newline at end of file + - sr/correctors/SH1AC02.yaml diff --git a/tests/config/sr-ident-cfm.yaml b/tests/config/sr-ident-cfm.yaml index 4b384950..a3ff078e 100644 --- a/tests/config/sr-ident-cfm.yaml +++ b/tests/config/sr-ident-cfm.yaml @@ -24,4 +24,4 @@ arrays: devices: - sr/quadrupoles/QF1AC01.yaml - sr/correctors/SH1AC01-ident.yaml - - sr/correctors/SH1AC02.yaml \ No newline at end of file + - sr/correctors/SH1AC02.yaml diff --git a/tests/config/sr/correctors/SH1AC01-ident.yaml b/tests/config/sr/correctors/SH1AC01-ident.yaml index 7e9ae2ad..f5f56895 100644 --- a/tests/config/sr/correctors/SH1AC01-ident.yaml +++ b/tests/config/sr/correctors/SH1AC01-ident.yaml @@ -1,8 +1,8 @@ type: pyaml.magnet.cfm_magnet name: SH1A-C01 #Name of the element in the lattice model mapping: - # Multipole mapping for usage in families, in this example SH1-C01A-H is not - # a lattice element present in the model, it is just a name to use in + # Multipole mapping for usage in families, in this example SH1-C01A-H is not + # a lattice element present in the model, it is just a name to use in # PyAML families. When this 'virutal' element is set, it then applies # the corresponding multipole on the parent element. - [B0, SH1A-C01-H] diff --git a/tests/config/sr/correctors/SH1AC01.yaml b/tests/config/sr/correctors/SH1AC01.yaml index cb97c47c..717ad973 100644 --- a/tests/config/sr/correctors/SH1AC01.yaml +++ b/tests/config/sr/correctors/SH1AC01.yaml @@ -1,8 +1,8 @@ type: pyaml.magnet.cfm_magnet name: SH1A-C01 #Name of the element in the lattice model mapping: - # Multipole mapping for usage in families, in this example SH1-C01A-H is not - # a lattice element present in the model, it is just a name to use in + # Multipole mapping for usage in families, in this example SH1-C01A-H is not + # a lattice element present in the model, it is just a name to use in # PyAML families. When this 'virutal' element is set, it then applies # the corresponding multipole on the parent element. - [B0, SH1A-C01-H] diff --git a/tests/config/sr/correctors/SH1AC02.yaml b/tests/config/sr/correctors/SH1AC02.yaml index f7474c52..590d69b9 100644 --- a/tests/config/sr/correctors/SH1AC02.yaml +++ b/tests/config/sr/correctors/SH1AC02.yaml @@ -1,8 +1,8 @@ type: pyaml.magnet.cfm_magnet name: SH1A-C02 #Name of the element in the lattice model mapping: - # Multipole mapping for usage in families, in this example SH1-C01A-H is not - # a lattice element present in the model, it is just a name to use in + # Multipole mapping for usage in families, in this example SH1-C01A-H is not + # a lattice element present in the model, it is just a name to use in # PyAML families. When this 'virutal' element is set, it then applies # the corresponding multipole on the parent element. - [B0, SH1A-C02-H] diff --git a/tests/config/sr/custom_magnets/hidcorr.yaml b/tests/config/sr/custom_magnets/hidcorr.yaml index 178c7efc..8c55999f 100644 --- a/tests/config/sr/custom_magnets/hidcorr.yaml +++ b/tests/config/sr/custom_magnets/hidcorr.yaml @@ -12,4 +12,4 @@ model: type: pyaml.control.device setpoint: sr/id/c01-1/gap readback: sr/id/c01-1/gap - unit: A \ No newline at end of file + unit: A diff --git a/tests/config/sr/magnet_models/QD2_strength.csv b/tests/config/sr/magnet_models/QD2_strength.csv index fb5684ed..f61fae5e 100644 --- a/tests/config/sr/magnet_models/QD2_strength.csv +++ b/tests/config/sr/magnet_models/QD2_strength.csv @@ -98,4 +98,4 @@ 106.969697, -13.54414964 107.979798, -13.58201323 108.989899, -13.61912026 - 110, -13.655849 \ No newline at end of file + 110, -13.655849 diff --git a/tests/config/sr/magnet_models/QF1AC01.yaml b/tests/config/sr/magnet_models/QF1AC01.yaml index 5665f697..3670f2e6 100644 --- a/tests/config/sr/magnet_models/QF1AC01.yaml +++ b/tests/config/sr/magnet_models/QF1AC01.yaml @@ -7,4 +7,4 @@ powerconverter: type: pyaml.control.device setpoint: sr/ps-qf1/c01-a/current readback: sr/ps-qf1/c01-a/current - unit: A \ No newline at end of file + unit: A diff --git a/tests/config/sr/magnet_models/SH1AC01.yaml b/tests/config/sr/magnet_models/SH1AC01.yaml index 51094ab8..d8eb8fa4 100644 --- a/tests/config/sr/magnet_models/SH1AC01.yaml +++ b/tests/config/sr/magnet_models/SH1AC01.yaml @@ -21,4 +21,4 @@ unit: A - type: tango.pyaml.attribute attribute: srmag/ps-corr-sh1/c01-a-ch3/current - unit: A \ No newline at end of file + unit: A diff --git a/tests/config/sr/magnet_models/SH1AC02.yaml b/tests/config/sr/magnet_models/SH1AC02.yaml index a3b50465..5c0664b6 100644 --- a/tests/config/sr/magnet_models/SH1AC02.yaml +++ b/tests/config/sr/magnet_models/SH1AC02.yaml @@ -21,4 +21,4 @@ unit: A - type: tango.pyaml.attribute attribute: srmag/ps-corr-sh1/c02-a-ch3/current - unit: A \ No newline at end of file + unit: A diff --git a/tests/config/sr/magnet_models/quadcurve.yaml b/tests/config/sr/magnet_models/quadcurve.yaml index f86fb476..a536a9f6 100644 --- a/tests/config/sr/magnet_models/quadcurve.yaml +++ b/tests/config/sr/magnet_models/quadcurve.yaml @@ -1,2 +1,2 @@ type: pyaml.configuration.csvcurve -file: sr/magnet_models/QF1_strength.csv \ No newline at end of file +file: sr/magnet_models/QF1_strength.csv diff --git a/tests/config/sr/magnet_models/quadcurve_data.yaml b/tests/config/sr/magnet_models/quadcurve_data.yaml index 4b411b86..020ac047 100644 --- a/tests/config/sr/magnet_models/quadcurve_data.yaml +++ b/tests/config/sr/magnet_models/quadcurve_data.yaml @@ -1,4 +1,4 @@ -#Current , Int.Grad. +#Current , Int.Grad. #[A] , [T] - [ 0, 0] - [20.1010101, 11.70165639] diff --git a/tests/config/sr/quadrupoles/QF1AC01-IDENT-HW.yaml b/tests/config/sr/quadrupoles/QF1AC01-IDENT-HW.yaml index 0532f794..ec4e2bc8 100644 --- a/tests/config/sr/quadrupoles/QF1AC01-IDENT-HW.yaml +++ b/tests/config/sr/quadrupoles/QF1AC01-IDENT-HW.yaml @@ -8,4 +8,3 @@ model: setpoint: sr/ps-qf1/c01-a/strength readback: sr/ps-qf1/c01-a/strength unit: 1/m - diff --git a/tests/config/sr/quadrupoles/QF1C01A_2.yaml b/tests/config/sr/quadrupoles/QF1C01A_2.yaml index 09d762b0..b976a852 100644 --- a/tests/config/sr/quadrupoles/QF1C01A_2.yaml +++ b/tests/config/sr/quadrupoles/QF1C01A_2.yaml @@ -10,4 +10,4 @@ model: type: pyaml.control.device setpoint: sr/ps-qf1/c01-a/current readback: sr/ps-qf1/c01-a/current - unit: A \ No newline at end of file + unit: A diff --git a/tests/external/pyproject.toml b/tests/external/pyproject.toml index 45df2d17..0e6e9f2e 100644 --- a/tests/external/pyproject.toml +++ b/tests/external/pyproject.toml @@ -17,4 +17,4 @@ dependencies = [ "numpy>=1.21.0", "scipy>=1.7.3", "accelerator-toolbox>=0.6.1" -] \ No newline at end of file +]