Skip to content

Commit d96a9ba

Browse files
Update all ConfigModel classes to numpy-docstring format
Co-authored-by: gubaidulinvadim <2589030+gubaidulinvadim@users.noreply.github.com>
1 parent 6488175 commit d96a9ba

17 files changed

+255
-71
lines changed

pyaml/accelerator.py

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,41 @@
1919

2020

2121
class ConfigModel(BaseModel):
22+
"""
23+
Configuration model for Accelerator
24+
25+
Parameters
26+
----------
27+
facility : str
28+
Facility name
29+
machine : str
30+
Accelerator name
31+
energy : float
32+
Accelerator nominal energy. For ramped machine,
33+
this value can be dynamically set
34+
controls : list[ControlSystem], optional
35+
List of control system used. An accelerator
36+
can access several control systems
37+
simulators : list[Simulator], optional
38+
Simulator list
39+
data_folder : str
40+
Data folder
41+
arrays : list[ArrayConfig], optional
42+
Element family
43+
devices : list[Element]
44+
Element list
45+
"""
46+
2247
model_config = ConfigDict(arbitrary_types_allowed=True, extra="forbid")
2348

2449
facility: str
25-
"Facility name"
2650
machine: str
27-
"""Accelerator name"""
2851
energy: float
29-
"""Accelerator nominal energy, for ramped machine,
30-
this value can be dynamically set"""
3152
controls: list[ControlSystem] = None
32-
"""List of control system used, an accelerator
33-
can access several control systems"""
3453
simulators: list[Simulator] = None
35-
"""Simulator list"""
3654
data_folder: str
37-
"""Data folder"""
3855
arrays: list[ArrayConfig] = None
39-
"""Element family"""
4056
devices: list[Element]
41-
"""Element list"""
4257

4358

4459
class Accelerator(object):

pyaml/arrays/array.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111

1212
class ArrayConfigModel(BaseModel):
1313
"""
14-
Base class for array confirguration
14+
Base class for array configuration
1515
16-
Parameters:
17-
-----------
18-
name: str
16+
Parameters
17+
----------
18+
name : str
1919
Family name
20-
elements: list[str]
20+
elements : list[str]
2121
List of pyaml element names
2222
"""
2323

pyaml/bpm/bpm_simple_model.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,21 @@
1212

1313

1414
class ConfigModel(BaseModel):
15+
"""
16+
Configuration model for BPM simple model
17+
18+
Parameters
19+
----------
20+
x_pos : DeviceAccess, optional
21+
Horizontal position device
22+
y_pos : DeviceAccess, optional
23+
Vertical position device
24+
"""
25+
1526
model_config = ConfigDict(arbitrary_types_allowed=True, extra="forbid")
1627

1728
x_pos: DeviceAccess | None
18-
"""Horizontal position"""
1929
y_pos: DeviceAccess | None
20-
"""Vertical position"""
2130

2231

2332
class BPMSimpleModel(BPMModel):

pyaml/bpm/bpm_tiltoffset_model.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,30 @@
1313

1414

1515
class ConfigModel(BaseModel):
16+
"""
17+
Configuration model for BPM with tilt and offset
18+
19+
Parameters
20+
----------
21+
x_pos : DeviceAccess, optional
22+
Horizontal position device
23+
y_pos : DeviceAccess, optional
24+
Vertical position device
25+
x_offset : DeviceAccess, optional
26+
Horizontal BPM offset device
27+
y_offset : DeviceAccess, optional
28+
Vertical BPM offset device
29+
tilt : DeviceAccess, optional
30+
BPM tilt device
31+
"""
32+
1633
model_config = ConfigDict(arbitrary_types_allowed=True, extra="forbid")
1734

1835
x_pos: DeviceAccess | None
19-
"""Horizontal position"""
2036
y_pos: DeviceAccess | None
21-
"""Vertical position"""
2237
x_offset: DeviceAccess | None
23-
"""Horizontal BPM offset"""
2438
y_offset: DeviceAccess | None
25-
"""Vertical BPM offset"""
2639
tilt: DeviceAccess | None
27-
"""BPM tilt"""
2840

2941

3042
class BPMTiltOffsetModel(BPMSimpleModel):

pyaml/configuration/csvcurve.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,18 @@
1212

1313

1414
class ConfigModel(BaseModel):
15+
"""
16+
Configuration model for CSV curve
17+
18+
Parameters
19+
----------
20+
file : str
21+
CSV file that contains the curve (n rows, 2 columns)
22+
"""
23+
1524
model_config = ConfigDict(arbitrary_types_allowed=True, extra="forbid")
1625

1726
file: str
18-
"""CSV file that contains the curve (n rows,2 columns)"""
1927

2028

2129
class CSVCurve(Curve):

pyaml/configuration/csvmatrix.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,18 @@
1212

1313

1414
class ConfigModel(BaseModel):
15+
"""
16+
Configuration model for CSV matrix
17+
18+
Parameters
19+
----------
20+
file : str
21+
CSV file that contains the matrix
22+
"""
23+
1524
model_config = ConfigDict(arbitrary_types_allowed=True, extra="forbid")
1625

1726
file: str
18-
"""CSV file that contains the matrix"""
1927

2028

2129
class CSVMatrix(Matrix):

pyaml/configuration/inline_curve.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,18 @@
1212

1313

1414
class ConfigModel(BaseModel):
15+
"""
16+
Configuration model for inline curve
17+
18+
Parameters
19+
----------
20+
mat : list[list[float]]
21+
Curve data (n rows, 2 columns)
22+
"""
23+
1524
model_config = ConfigDict(arbitrary_types_allowed=True, extra="forbid")
1625

1726
mat: list[list[float]]
18-
"""CSV file that contains the curve (n rows,2 columns)"""
1927

2028

2129
class InlineCurve(Curve):

pyaml/configuration/inline_matrix.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,18 @@
88

99

1010
class ConfigModel(BaseModel):
11+
"""
12+
Configuration model for inline matrix
13+
14+
Parameters
15+
----------
16+
mat : list[list[float]]
17+
The matrix
18+
"""
19+
1120
model_config = ConfigDict(arbitrary_types_allowed=True, extra="forbid")
1221

1322
mat: list[list[float]]
14-
"""The matrix"""
1523

1624

1725
class InlineMatrix(Matrix):

pyaml/lattice/simulator.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,27 @@
5050

5151

5252
class ConfigModel(BaseModel):
53+
"""
54+
Configuration model for Simulator
55+
56+
Parameters
57+
----------
58+
name : str
59+
Simulator name
60+
lattice : str
61+
AT lattice file
62+
mat_key : str, optional
63+
AT lattice ring name
64+
linker : LatticeElementsLinker, optional
65+
The linker configuration model
66+
"""
67+
5368
model_config = ConfigDict(arbitrary_types_allowed=True, extra="forbid")
5469

5570
name: str
56-
"""Simulator name"""
5771
lattice: str
58-
"""AT lattice file"""
5972
mat_key: str = None
60-
"""AT lattice ring name"""
6173
linker: LatticeElementsLinker = None
62-
"""The linker configuration model"""
6374

6475

6576
class Simulator(ElementHolder):

pyaml/magnet/identity_cfm_model.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,27 @@
1111

1212

1313
class ConfigModel(BaseModel):
14+
"""
15+
Configuration model for identity combined function magnet model
16+
17+
Parameters
18+
----------
19+
multipoles : list[str]
20+
List of supported functions: A0, B0, A1, B1, etc (i.e. [B0, A1, B2])
21+
powerconverters : list[DeviceAccess], optional
22+
Power converter devices to apply current
23+
physics : list[DeviceAccess], optional
24+
Magnet devices to apply strength
25+
units : list[str]
26+
List of strength units (i.e. ['rad', 'm-1', 'm-2'])
27+
"""
28+
1429
model_config = ConfigDict(arbitrary_types_allowed=True, extra="forbid")
1530

1631
multipoles: list[str]
17-
"""List of supported functions: A0,B0,A1,B1,etc (i.e. [B0,A1,B2])"""
1832
powerconverters: list[DeviceAccess | None] | None = None
19-
"""Power converter device to apply current"""
2033
physics: list[DeviceAccess | None] | None = None
21-
"""Magnet device to apply strength"""
2234
units: list[str]
23-
"""List of strength unit (i.e. ['rad','m-1','m-2'])"""
2435

2536

2637
class IdentityCFMagnetModel(MagnetModel):

0 commit comments

Comments
 (0)