Skip to content

Commit 77cade5

Browse files
committed
Added OrbitResponseMatrixData
1 parent 4854dcc commit 77cade5

File tree

4 files changed

+39
-10
lines changed

4 files changed

+39
-10
lines changed

pyaml/tuning_tools/orbit.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from ..common.exception import PyAMLException
2121
from ..external.pySC_interface import pySCInterface
2222
from ..rf.rf_plant import RFPlant
23-
from .response_matrix_data import ResponseMatrixData
23+
from .orbit_response_matrix_data import OrbitResponseMatrixData
2424

2525
logger = logging.getLogger(__name__)
2626
logging.getLogger("pyaml.external.pySC").setLevel(logging.WARNING)
@@ -39,7 +39,7 @@ class ConfigModel(ElementConfigModel):
3939
singular_values_H: Optional[int] = None
4040
singular_values_V: Optional[int] = None
4141
virtual_target: float = 0
42-
response_matrix: Union[str, ResponseMatrixData]
42+
response_matrix: Union[str, OrbitResponseMatrixData]
4343

4444

4545
class Orbit(Element):
@@ -73,7 +73,7 @@ def __init__(self, cfg: ConfigModel):
7373
# If the configuration response matrix is a filename, load it
7474
if type(cfg.response_matrix) is str:
7575
try:
76-
cfg.response_matrix = ResponseMatrixData.load(cfg.response_matrix)
76+
cfg.response_matrix = OrbitResponseMatrixData.load(cfg.response_matrix)
7777
except Exception as e:
7878
logger.warning(f"{str(e)}")
7979
cfg.response_matrix = None
@@ -90,7 +90,7 @@ def __init__(self, cfg: ConfigModel):
9090
self._rf_plant: RFPlant = None
9191

9292
@property
93-
def reponse_matrix(self) -> ResponseMatrixData | None:
93+
def reponse_matrix(self) -> OrbitResponseMatrixData | None:
9494
return self._cfg.response_matrix
9595

9696
def correct(
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from typing import Optional
2+
3+
from .response_matrix_data import ConfigModel as ReponseMatrixDataConfigModel
4+
from .response_matrix_data import ResponseMatrixData
5+
6+
PYAMLCLASS = "OrbitResponseMatrixData"
7+
8+
9+
class ConfigModel(ReponseMatrixDataConfigModel):
10+
"""
11+
Base configuration model for response matrix
12+
13+
Parameters
14+
----------
15+
rf_response : list[float], optional
16+
RF response data
17+
input_names : list[str], optional
18+
Input plane names, basically the plane of the actuators
19+
output_names : list[str], optional
20+
Output plane names, basically the plane of measurements
21+
"""
22+
23+
rf_response: Optional[list[float]] = None
24+
input_planes: Optional[list[str]] = None
25+
output_planes: Optional[list[str]] = None
26+
27+
28+
class OrbitResponseMatrixData(ResponseMatrixData):
29+
"""
30+
Orbit response matrix loader
31+
"""
32+
33+
def __init__(self, cfg: ConfigModel):
34+
self._cfg = cfg

pyaml/tuning_tools/response_matrix_data.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,13 @@ class ConfigModel(BaseModel):
2424
Input names, basically the actuators
2525
output_names : list[str]
2626
Output names, basically the measurements
27-
rf_response : list[float], optional
28-
RF response data
2927
"""
3028

3129
model_config = ConfigDict(arbitrary_types_allowed=True, extra="forbid")
3230

3331
matrix: list[list[float]]
3432
input_names: Optional[list[str]]
3533
output_names: list[str]
36-
rf_response: Optional[list[float]] = None
37-
input_planes: Optional[list[str]] = None
38-
output_planes: Optional[list[str]] = None
3934

4035

4136
class ResponseMatrixData(object):

tests/config/ideal_orm_disp.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)