Element and Lattice
Element
An Element aggregates all data for a single lattice element: head metadata,
general attributes, Twiss parameters, orbit, transfer matrix, floor
coordinates, multipoles, wake fields, chamber walls, and more.
Data is loaded on-demand via from_tao() or fill(), controlled by
defaults and per-field boolean flags. The class-level DEFAULTS set
determines which fields are loaded when defaults=True.
pytao.model.Element
Bases: TaoBaseModel
Represents a Tao element with various attributes used in simulations.
Each attribute marked with a default value may be filled in or updated on-demand.
Attributes:
| Name | Type | Description |
|---|---|---|
ele_id |
str
|
The element name or identifier. |
which |
"base", "model", or "design"
|
|
head |
ElementHead
|
The head data of the element. |
ac_kicker |
ElementAcKickerAmpVsTime, ElementAcKickerFrequencies, or None
|
AC kicker settings, in one of two representations. |
attrs |
GeneralAttributes or None
|
General attributes associated with the element. The information held
differs depending on the element's key (i.e., |
cartesian_map |
list[ElementCartesianMap] or None
|
List of cartesian field maps. |
chamber_walls |
list[ElementChamberWall] or None
|
List of chamber walls. |
control_vars |
dict[str, float] or None
|
Dictionary of control variables with their corresponding current values. |
cylindrical_map |
list[ElementCylindricalMap] or None
|
List of cylindrical field maps. |
elec_multipoles |
ElementElecMultipoles or None
|
Electric multipole attributes. |
floor |
ElementFloorAll or None
|
Floor positions. |
gen_gradients |
list[ElementGenGradients] or None
|
List of generalized gradient maps. |
grid_field |
list[ElementGridField] or None
|
List of grid field data. |
lord_slave |
list[ElementLordSlave] or None
|
List of lord-slave relationships. |
mat6 |
ElementMat6 or None
|
Mat6 (linear transfer map) information. |
methods |
ElementMethods or None
|
Tracking and calculation method settings. |
multipoles |
AnyElementMultipoles or None
|
Multipoleattributes. |
orbit |
ElementOrbit or None
|
Orbit attributes. |
photon |
ElementPhoton or None
|
Photon attributes. |
shapes |
ElementShapes or None
|
Shapes Tao uses to draw the element in lat_layout and floor_plan graphs. |
spin_taylor |
ElementSpinTaylor or None
|
Spin Taylor map. |
taylor |
ElementTaylor or None
|
Taylor map. |
twiss |
ElementTwiss or None
|
Twiss parameters. |
wake |
ElementWake or None
|
Wake attributes. |
wall3d |
list[ElementWall3D] or None
|
List of 3D walls. |
Attributes
pytao.model.Element.attribs
property
attribs
General attributes - name to value dictionary.
pytao.model.Element.id
property
id
The fully-qualified ElementID, including universe/branch/key.
pytao.model.Element.symplectic_error
property
symplectic_error
Symplectic error.
pytao.model.Element.vec0
property
vec0
0th order transport vector.
Methods:
pytao.model.Element.fill
fill(tao, *, head=True, ac_kicker=True, attrs=True, bunch_params=True, cartesian_map=True, cartesian_map_terms=False, comb=False, control_vars=True, cylindrical_map=True, cylindrical_map_terms=False, elec_multipoles=True, floor=True, gen_gradients=True, gen_gradient_curves=False, lord_slave=True, methods=True, photon=True, orbit=True, shapes=True, spin_taylor=True, taylor=True, twiss=True, grid_field=True, grid_field_points=False, mat6=True, chamber_walls=True, wall3d=True, wall3d_table=False, multipoles=True, wake=True, comb_data=None, use_cache=True)
Fills various attributes of the Tao object based on the provided flags.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tao
|
Tao
|
The Tao instance to retrieve information from. |
required |
head
|
bool
|
Update the head attribute. |
True
|
ac_kicker
|
bool
|
Fill AC kicker settings. |
True
|
attrs
|
bool
|
Fill attribute data. |
True
|
bunch_params
|
bool
|
Fill bunch parameters. |
True
|
cartesian_map
|
bool
|
Fill cartesian map data. |
True
|
cartesian_map_terms
|
bool
|
Fill cartesian map per-term data. |
False
|
cylindrical_map
|
bool
|
Fill cylindrical map data. |
True
|
cylindrical_map_terms
|
bool
|
Fill cylindrical map per-term data. |
False
|
elec_multipoles
|
bool
|
Fill electric multipole data. |
True
|
gen_gradients
|
bool
|
Fill generalized gradient map data. |
True
|
gen_gradient_curves
|
bool
|
Fill generalized gradient per-curve derivative tables. |
False
|
methods
|
bool
|
Fill tracking/calculation method settings. |
True
|
shapes
|
bool
|
Fill lat_layout/floor_plan drawing shapes. |
True
|
spin_taylor
|
bool
|
Fill spin Taylor map data. |
True
|
taylor
|
bool
|
Fill Taylor map data. |
True
|
comb
|
bool or None
|
Fill comb data. If available, pass in |
False
|
comb_data
|
Comb or None
|
Only relevant if |
None
|
control_vars
|
bool
|
Fill control variables. |
True
|
floor
|
bool
|
Fill the floor attribute. |
True
|
lord_slave
|
bool
|
Fill lord-slave relationships. |
True
|
photon
|
bool
|
Fill the photon attribute. |
True
|
orbit
|
bool
|
Fill orbit data. |
True
|
twiss
|
bool
|
Fill Twiss parameters. |
True
|
grid_field
|
bool
|
Fill grid field data. |
True
|
grid_field_points
|
bool
|
Fill grid field points data. Default is False. |
False
|
mat6
|
bool
|
Fill MAT6 data. |
True
|
chamber_walls
|
bool
|
Fill chamber wall data. |
True
|
wall3d
|
bool
|
Fill 3D wall data. |
True
|
wall3d_table
|
bool
|
Fill 3D wall table data. Default is False. |
False
|
multipoles
|
bool
|
Fill multipole data. |
True
|
wake
|
bool
|
Fill wake data. |
True
|
use_cache
|
bool
|
use cached data if available. Will not overwrite already-fetched data. |
True
|
Source code in pytao/model/ele/ele.py
1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 | |
pytao.model.Element.from_tao
classmethod
from_tao(tao, ele, *, which='model', defaults=True, ac_kicker=FillDefault('ac_kicker'), attrs=FillDefault('attrs'), bunch_params=FillDefault('bunch_params'), cartesian_map=FillDefault('cartesian_map'), cartesian_map_terms=FillDefault('cartesian_map_terms'), chamber_walls=FillDefault('chamber_walls'), comb=FillDefault('comb'), control_vars=FillDefault('control_vars'), cylindrical_map=FillDefault('cylindrical_map'), cylindrical_map_terms=FillDefault('cylindrical_map_terms'), elec_multipoles=FillDefault('elec_multipoles'), floor=FillDefault('floor'), gen_gradients=FillDefault('gen_gradients'), gen_gradient_curves=FillDefault('gen_gradient_curves'), grid_field=FillDefault('grid_field'), grid_field_points=FillDefault('grid_field_points'), lord_slave=FillDefault('lord_slave'), mat6=FillDefault('mat6'), methods=FillDefault('methods'), multipoles=FillDefault('multipoles'), orbit=FillDefault('orbit'), photon=FillDefault('photon'), shapes=FillDefault('shapes'), spin_taylor=FillDefault('spin_taylor'), taylor=FillDefault('taylor'), twiss=FillDefault('twiss'), wake=FillDefault('wake'), wall3d=FillDefault('wall3d'), wall3d_table=FillDefault('wall3d_table'), comb_data=None)
Create an Element by querying Tao.
Use defaults to fill the most commonly-used element information.
To disregard the defaults, individual items may be excluded by passing
False, or included by passing True.
Notes
Defaults for the data to query are set as follows:
from pytao.model import Element print(Element.DEFAULTS) {'ac_kicker', 'attrs', 'bunch_params', 'cartesian_map', 'chamber_walls', 'control_vars', 'cylindrical_map', 'elec_multipoles', 'floor', 'gen_gradients', 'grid_field', 'lord_slave', 'mat6', 'methods', 'multipoles', 'orbit', 'photon', 'shapes', 'spin_taylor', 'taylor', 'twiss', 'wake', 'wall3d'}
With the following, the default will change to only query attrs:
Element.DEFAULTS = {"attrs"}
Examples:
Get an Element with the defaults (loads attrs, twiss, orbit, etc.):
>>> ele = Element.from_tao(tao, "1")
Get an Element but skip orbit calculations:
>>> ele = Element.from_tao(tao, "1", orbit=False)
Get an Element AND add comb data (usually off):
>>> ele = Element.from_tao(tao, "1", comb=True)
Get a minimal Element (disable everything explicit):
>>> ele = Element.from_tao(tao, "1", defaults=False)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tao
|
Tao
|
The Tao instance. |
required |
ele
|
int, str, or ElementID
|
The element identifier. |
required |
which
|
"base", "model", or "design"
|
Specifies which Tao lattice to use, by default "model". |
'model'
|
defaults
|
bool
|
Fill default items. Defaults are set by name in |
True
|
ac_kicker
|
bool
|
Fill AC kicker settings. |
FillDefault('ac_kicker')
|
attrs
|
bool
|
Fill general attributes. |
FillDefault('attrs')
|
bunch_params
|
bool
|
Fill bunch parameters. |
FillDefault('bunch_params')
|
cartesian_map
|
bool
|
Fill cartesian map data. |
FillDefault('cartesian_map')
|
cartesian_map_terms
|
bool
|
Fill cartesian map per-term data. |
False
|
chamber_walls
|
bool
|
Fill chamber wall data. |
FillDefault('chamber_walls')
|
cylindrical_map
|
bool
|
Fill cylindrical map data. |
FillDefault('cylindrical_map')
|
cylindrical_map_terms
|
bool
|
Fill cylindrical map per-term data. |
False
|
elec_multipoles
|
bool
|
Fill electric multipole data. |
FillDefault('elec_multipoles')
|
comb
|
bool
|
Fill comb data. If available, pass in |
False
|
comb_data
|
Comb or None
|
Only relevant if |
None
|
control_vars
|
bool
|
Fill control variables. |
FillDefault('control_vars')
|
floor
|
bool
|
Fill floor data. |
FillDefault('floor')
|
gen_gradients
|
bool
|
Fill generalized gradient map data. |
FillDefault('gen_gradients')
|
gen_gradient_curves
|
bool
|
Fill generalized gradient per-curve derivative tables. |
False
|
grid_field
|
bool
|
Fill grid field data. |
FillDefault('grid_field')
|
grid_field_points
|
bool
|
Fill grid field points data. |
False
|
lord_slave
|
bool
|
Fill lord-slave relationships. |
FillDefault('lord_slave')
|
mat6
|
bool
|
Fill mat6 data. |
FillDefault('mat6')
|
methods
|
bool
|
Fill tracking/calculation method settings. |
FillDefault('methods')
|
multipoles
|
bool
|
Fill multipole data. |
FillDefault('multipoles')
|
orbit
|
bool
|
Fill orbit data. |
FillDefault('orbit')
|
photon
|
bool
|
Fill photon data. |
FillDefault('photon')
|
shapes
|
bool
|
Fill lat_layout/floor_plan drawing shapes. |
FillDefault('shapes')
|
spin_taylor
|
bool
|
Fill spin Taylor map data. |
FillDefault('spin_taylor')
|
taylor
|
bool
|
Fill Taylor map data. |
FillDefault('taylor')
|
twiss
|
bool
|
Fill twiss parameters. |
FillDefault('twiss')
|
wake
|
bool
|
Fill wake data. |
FillDefault('wake')
|
wall3d
|
bool
|
Fill 3D wall data. |
FillDefault('wall3d')
|
wall3d_table
|
bool
|
Fill 3D wall table data. |
FillDefault('wall3d_table')
|
Source code in pytao/model/ele/ele.py
689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 | |
pytao.model.Element.particles_to_floor
particles_to_floor(P)
Convert particles in this element from local to floor coordinates.
All particles are taken to be in this element. Each is placed by its
location record (-1 upstream end, 1 downstream end, 0 inside at its
s), defaulting to the downstream end. See
FloorTable.particles_to_floor for details.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
P
|
ParticleGroup
|
|
required |
Returns:
| Type | Description |
|---|---|
ParticleGroup
|
A new group in floor coordinates. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in pytao/model/ele/ele.py
1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 | |
Lattice
A Lattice is a tuple of Element objects with lookup dictionaries
by name, key (element type), and index.
pytao.model.Lattice
Bases: TaoBaseModel
A Bmad Lattice, or more commonly a single branch of a full lattice.
Attributes:
| Name | Type | Description |
|---|---|---|
which |
"base", "model", or "design"
|
|
elements |
tuple of Element
|
A tuple containing elements that make up the lattice. |
Attributes
pytao.model.Lattice.by_element_index
property
by_element_index
A dictionary of element index to Element.
pytao.model.Lattice.by_element_key
property
by_element_key
A dictionary of element key to list of Elements with that key.
pytao.model.Lattice.by_element_name
property
by_element_name
A dictionary of element name to Element.
Methods:
pytao.model.Lattice.floor_table
floor_table()
The FloorTable of this lattice's elements.
Elements need floor filled, and bends attrs as well. For a lattice
holding only what this needs, use
Lattice.from_tao_eles(tao, eles, defaults=False, floor=True, attrs=True, methods=True).
Source code in pytao/model/ele/ele.py
1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 | |
pytao.model.Lattice.from_file
classmethod
from_file(filename, *, format=None)
Load Tao model data from a previously-written file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str or Path
|
|
required |
Returns:
| Type | Description |
|---|---|
Lattice
|
|
Source code in pytao/model/ele/ele.py
1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 | |
pytao.model.Lattice.from_tao_eles
classmethod
from_tao_eles(tao, eles, *, which='model', comb_data=None, comb=False, **kwargs)
Create a Lattice object from a list of element names, indices, or IDs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tao
|
Tao
|
|
required |
eles
|
list of int, str, or ElementID
|
Element names, indices, or identifiers. |
required |
which
|
"base", "model", or "design"
|
|
"model"
|
**kwargs
|
dict
|
Additional keyword arguments passed to |
{}
|
Returns:
| Type | Description |
|---|---|
Lattice
|
|
Source code in pytao/model/ele/ele.py
1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 | |
pytao.model.Lattice.from_tao_tracking
classmethod
from_tao_tracking(tao, *, track_start=None, track_end=None, which='model', orbit=True, twiss=True, ix_branch='', ix_uni='', **kwargs)
Create a Lattice object from tracking elements of the lattice.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tao
|
Tao
|
|
required |
which
|
"base", "model", or "design"
|
|
"model"
|
track_start
|
str
|
The first element to get information from (inclusive). Defaults to element 0. |
None
|
track_end
|
str
|
The last element to get information from (inclusive). Defaults to the last element in the lattice. |
None
|
orbit
|
bool
|
Orbit information is included by default. |
True
|
twiss
|
bool
|
Twiss information is included by default. |
True
|
ix_branch
|
str
|
Branch index, by default "" |
''
|
ix_uni
|
str
|
Universe index, by default "" |
''
|
**kwargs
|
dict
|
Additional keyword arguments passed to |
{}
|
Returns:
| Type | Description |
|---|---|
Lattice
|
|
Source code in pytao/model/ele/ele.py
1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 | |
pytao.model.Lattice.from_tao_unique
classmethod
from_tao_unique(tao, *, which='model', track_start=None, track_end=None, ix_branch='', ix_uni='', **kwargs)
Create a Lattice object from unique elements of the lattice.
When track_start or track_end are specified, unique elements
associated with elements in that range are returned.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tao
|
Tao
|
|
required |
which
|
"base", "model", or "design"
|
|
"model"
|
track_start
|
str
|
The first element to get information from (inclusive). Defaults to element 0. This does not need to be a unique element itself. |
None
|
track_end
|
str
|
The last element to get information from (inclusive). Defaults to the last element in the lattice. This does not need to be a unique element itself. |
None
|
ix_branch
|
str
|
Branch index, by default "" |
''
|
ix_uni
|
str
|
Universe index, by default "" |
''
|
**kwargs
|
dict
|
Additional keyword arguments passed to |
{}
|
Returns:
| Type | Description |
|---|---|
Lattice
|
|
Source code in pytao/model/ele/ele.py
1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 | |
FloorTable
Per-element floor geometry for converting particles from element-local to
floor coordinates, with or without a running Tao. Build one with
Tao.floor_table() or Lattice.floor_table().
pytao.model.FloorTable
Bases: TaoBaseModel
Per-element floor geometry for converting particles to floor coordinates.
One entry per tracking element: the floor pose at the element's entrance
(beginning) and exit (end), and for bends the curvature and reference
tilt. That is enough to place a particle anywhere in a straight element or
bend, and at either end of any element, without Tao.
| Field | Unit | Description |
|---|---|---|
ix_branch, ix_ele |
Branch and element index | |
name, key |
Element name and key, e.g. SBend |
|
s |
m | Exit s-position |
g, ref_tilt |
1/m, rad | Bend curvature and tilt; 0 for non-bends |
orientation |
1, or -1 for a reversed element | |
beginning, end |
m, rad | Entrance and exit floor poses, shape (n, 6) |
Each pose is (x, y, z, theta, phi, psi), as in ElementFloorPosition.
ref_tilt is Bmad's ref_tilt_tot, which includes any offset girder's tilt.
Build one with FloorTable.from_tao (or Tao.floor_table) or
FloorTable.from_elements (or Lattice.floor_table), save it with write
(json, yaml, msgpack), and load it later with from_file.
Reversed elements (orientation -1) are listed but cannot be converted:
particles or points in one raise NotImplementedError.
Methods:
pytao.model.FloorTable.from_elements
classmethod
from_elements(elements, *, which='model')
Build a table from pytao Elements with floor filled.
Elements also need methods filled for their orientation, and bends
attrs for their curvature and tilt. Lords with slaves, which have no
floor pose of their own, are skipped since particles are never in them.
Raises:
| Type | Description |
|---|---|
ValueError
|
If an element's |
Source code in pytao/model/floor.py
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | |
pytao.model.FloorTable.from_tao
classmethod
from_tao(tao, *, ix_branch=None, ix_uni='', which='model')
Fetch the floor table of one or more lattice branches from Tao.
Uses a fixed number of lat_list calls per branch. Each element's
entrance pose is the exit pose of the element before it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tao
|
Tao
|
|
required |
ix_branch
|
int or sequence of int
|
Branch or branches to include. Default is every branch of the universe. |
None
|
ix_uni
|
str or int
|
Universe index. Default is the current universe. |
''
|
which
|
"base", "model", or "design"
|
Default is "model". |
'model'
|
Returns:
| Type | Description |
|---|---|
FloorTable
|
|
Source code in pytao/model/floor.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | |
pytao.model.FloorTable.particles_to_floor
particles_to_floor(P, *, magnification=1.0)
Convert particles from element-local to floor coordinates.
Each particle is placed using its element (ix_branch, ix_ele) and
its location in that element: -1 upstream end, 1 downstream end, or 0
inside at longitudinal position s. Without a location record,
particles are taken to be at the downstream end, where Bmad saves bunches.
P.z is a straight offset along the local z axis; it is 0 for Bmad bunch
data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
P
|
ParticleGroup
|
Particles with an |
required |
magnification
|
float
|
Scale the local |
1.0
|
Returns:
| Type | Description |
|---|---|
ParticleGroup
|
A new group with |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotImplementedError
|
For a particle inside an element with no simple interior geometry, such as a patch, or for a particle in a reversed element. |
Notes
Input momenta. P.px, P.py and P.pz must be the real-space
components of the momentum vector in the local frame. They are rotated
as a vector, so normalized or canonical phase-space momenta give wrong
results.
Bmad's own phase-space vector \((x, p_x, y, p_y, z, p_z)\) is not suitable as it stands. Elements 2 and 4 are the transverse momenta scaled by the reference momentum \(P_0\), and element 6 is the scaled deviation of the momentum magnitude \(P\), not a component:
Convert it to Bmad's time coordinates, as defined in the Bmad manual, whose momenta are the vector components this method needs:
Tao.particles and Tao.bunch_data already do this, so a
ParticleGroup from either can be passed in directly.
Frames. A floor pose \((X, Y, Z, \theta, \phi, \psi)\) gives an
origin \(\mathbf{R} = (X, Y, Z)\) and an orientation matrix
\(\mathbf{W}(\theta, \phi, \psi)\) whose columns are the local axes in
the floor frame (see w_matrix_from_angles). The table holds one pose
at each element's entrance and one at its exit.
At an end (location -1 or 1), with \(\mathbf{R}_0\) and
\(\mathbf{W}_0\) the pose at that end, a particle at local position
\(\mathbf{r} = (m x, m y, z)\) with momentum
\(\mathbf{P} = (P_x, P_y, P_z)\) maps to
where \(m\) is magnification.
Inside an element (location 0), the particle is first expressed
in the element's exit frame, a distance \(\Delta s = s_\mathrm{exit} - s\)
downstream. With curvature \(g\), bend angle \(\alpha = g \, \Delta s\) and
reference tilt \(\tau\),
with \(\operatorname{sinc} u = \sin u / u\) and
Then, with \(\mathbf{R}_\mathrm{exit}\) and \(\mathbf{W}_\mathrm{exit}\) the exit pose,
For a straight element \(g = 0\), so \(\mathbf{S}\) is the identity and
\(\mathbf{L} = (0, 0, -\Delta s)\): a shift back along the local \(z\) axis.
For a bend, \(\mathbf{L}\) is the chord of the arc,
\(\mathbf{R}_z(\tau) \, \big( (\cos\alpha - 1) / g, \; 0, \; -\sin\alpha / g \big)\).
This is Bmad's bend_shift; writing it with sinc covers both cases
without dividing by \(g\).
The rotations preserve the magnitude of the momentum. Positions are
where each particle is at its own time t; nothing is drifted to a
common time.
Source code in pytao/model/floor.py
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 | |
pytao.model.FloorTable.points_to_floor
points_to_floor(s, x=0.0, y=0.0, *, ix_branch=None, magnification=1.0)
Convert points along a branch from local to floor coordinates.
Each point is placed inside the element that contains its s position.
Use this for anything known as a function of s, such as an orbit or
a beam envelope.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
s
|
ndarray
|
Shape |
required |
x
|
ndarray or float
|
Local offsets (m) from the reference orbit at each |
0.0
|
y
|
ndarray or float
|
Local offsets (m) from the reference orbit at each |
0.0
|
ix_branch
|
int
|
Branch the points are in. May be omitted when the table holds a single branch. |
None
|
magnification
|
float
|
Scale |
1.0
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Shape |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
NotImplementedError
|
For a point inside an element with no simple interior geometry, such as a patch, or for a point in a reversed element. |
Notes
The table holds each element's exit position \(s_i\). A point at \(s\) belongs to the first element \(i\) of the branch with \(s_i \ge s\), and lies a distance
upstream of that element's exit. It is then converted as a particle
inside the element is in particles_to_floor, with local position
\(\mathbf{r} = (m x, m y, 0)\) where \(m\) is magnification:
\(\mathbf{R}_\mathrm{exit}\) and \(\mathbf{W}_\mathrm{exit}\) are the
element's exit pose, and \(\mathbf{S}\) and \(\mathbf{L}\) are the rotation
and shift along the element over \(\Delta s\), given in
particles_to_floor. With \(x = y = 0\) the result is the reference
orbit, \(\mathbf{R}_\mathrm{exit} + \mathbf{W}_\mathrm{exit} \, \mathbf{L}\).
A point exactly at a boundary, \(s = s_i\), uses the upstream element, for which \(\Delta s = 0\). The table does not hold where the first element starts, so a point before it is extrapolated upstream.
Source code in pytao/model/floor.py
459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 | |
w_matrix_from_angles
pytao.model.w_matrix_from_angles
w_matrix_from_angles(theta, phi, psi)
Bmad orientation matrix W from the floor angles.
A port of Bmad's floor_angles_to_w_mat. The columns of W are the local
x, y and z axes expressed in the global frame, so that
global = R + W @ local.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
theta
|
float or array_like
|
Azimuth (yaw) angle (rad), in the global (X, Z) plane. |
required |
phi
|
float or array_like
|
Pitch (elevation) angle (rad). |
required |
psi
|
float or array_like
|
Roll angle (rad) about the local z axis. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Shape |
Source code in pytao/model/ele/sections.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | |
ElementID
Parses and represents Tao's element identifier syntax, including universe, branch, key, name, match number, and offset.
pytao.model.ElementID
Bases: BaseModel
An element identifier, which breaks apart a Tao element identifier into its components.
An element "name" (which can match to multiple elements) in Tao can be of the form
{~}{uni@}{branch>>}{key::}ele_id{##N}{+/-offset}
where
| Syntax | Description |
|---|---|
~ |
Negation character. See below. |
key |
Optional key name ("quadrupole", "sbend", etc.) |
uni |
Index of universe. |
branch |
Name or index of branch. May contain the wild cards * and %. |
ele_id |
Name or index of element. May contain the wild cards * and %. |
| If a name and no branch is given, all branches are searched. | |
| If an index and no branch is given, branch 0 is assumed. | |
##N |
N = integer. N^th instance of ele_id in the branch. |
+/-offset |
Element offset. For example, Q1+1 is the element after Q1 and Q1-2 is the second element |
before Q1. Modulo arithmetic is used so the offset wraps around the ends of the lattice. |
|
EG: BEGINNING-1 gives the END element and END+1 gives the BEGINNING element. |
Note: An old syntax that is still supported is:
{key::}{branch>>}ele_id{##N}
An element range is of the form:
{key::}ele1:ele2
Where the range includes ele1 and ele2, and:
| Parameter | Description |
|---|---|
key |
Optional key name ("quadrupole", "sbend", etc.). Also key may be "type", "alias", or "descrip" |
| in which case the %type, %alias, or %descrip field is matched to instead of the element name. | |
ele1 |
Starting element of the range. |
ele2 |
Ending element of the range. |
Attributes
pytao.model.ElementID.tao_string
property
tao_string
This element represented in Tao command-line interface string form.
pytao.model.ElementID.without_universe
property
without_universe
This element ID, excluding the universe number.
Some Tao commands such as 'show lat' do not accept a universe number.
Returns:
| Type | Description |
|---|---|
ElementID
|
|
Methods:
pytao.model.ElementID.from_tao
classmethod
from_tao(value)
Construct an ElementID from the Tao string representation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str
|
|
required |
Returns:
| Type | Description |
|---|---|
ElementID
|
|
Source code in pytao/model/ele/ele.py
391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 | |
pytao.model.ElementID.from_tao_any
classmethod
from_tao_any(value, *, split_range=False)
Create the most appropriate instance of an Element class for the given Tao element string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str
|
A string representing an element identifier, a list of elements, or an intersection of elements. |
required |
Returns:
| Type | Description |
|---|---|
ElementID, ElementList, or ElementIntersection
|
|
Source code in pytao/model/ele/ele.py
491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 | |
pytao.model.ElementID.from_tao_old_syntax
classmethod
from_tao_old_syntax(value)
Convert a Tao old syntax Element identifier.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str
|
|
required |
Returns:
| Type | Description |
|---|---|
ElementID
|
|
Source code in pytao/model/ele/ele.py
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | |
GeneralAttributes
Dynamic container for element-type-specific attributes (e.g., L, K1,
angle). Supports case-insensitive access. Each attribute is an Attr
with name, data, units, type, and a settable flag.
pytao.model.GeneralAttributes
Bases: TaoModel
Element Sub-Models
These are the data classes that populate the fields of Element.
ElementHead
pytao.model.ElementHead
Bases: TaoModel
Structure which corresponds to Tao pipe ele:head 1, for example.
Attributes:
| Name | Type | Description |
|---|---|---|
alias |
str
|
Another name. |
descrip |
str
|
Description string. |
has_ab_multipoles |
bool
|
|
has_ac_kick |
bool
|
|
has_control |
bool
|
|
has_floor |
bool
|
|
has_kt_multipoles |
bool
|
|
has_lord_slave |
bool
|
|
has_mat6 |
bool
|
|
has_methods |
bool
|
|
has_multipoles_elec |
bool
|
|
has_photon |
bool
|
|
has_spin_taylor |
bool
|
|
has_taylor |
bool
|
|
has_twiss |
bool
|
|
has_wake |
bool
|
|
has_wall3d |
int
|
|
is_on |
bool
|
For turning element on/off. |
ix_branch |
int
|
Index in lat%branch(:) array. Note: lat%ele => lat%branch(0). |
ix_ele |
int
|
Index in branch ele(0:) array. Set to ix_slice_slave$ = -2 for |
slice_slave$ elements. |
|
|
key |
str
|
Element class (quadrupole, etc.). |
name |
str
|
name of element. |
num_cartesian_map |
int
|
|
num_cylindrical_map |
int
|
|
num_gen_gradients |
int
|
|
num_grid_field |
int
|
|
ref_time |
float
|
Time ref particle passes exit end. |
s |
float
|
longitudinal ref position at the exit end. |
s_start |
float
|
longitudinal ref position at entrance_end |
type |
str
|
type name. |
universe |
int
|
|
ElementTwiss
pytao.model.ElementTwiss
Bases: TaoModel
Structure which corresponds to Tao pipe ele:twiss 1, for example.
Attributes:
| Name | Type | Description |
|---|---|---|
alpha_a |
float
|
|
alpha_b |
float
|
|
beta_a |
float
|
|
beta_b |
float
|
|
dalpha_dpz_a |
float
|
|
dalpha_dpz_b |
float
|
|
dbeta_dpz_a |
float
|
|
dbeta_dpz_b |
float
|
|
deta_dpz_a |
float
|
|
deta_dpz_b |
float
|
|
deta_dpz_x |
float
|
|
deta_dpz_y |
float
|
|
deta_ds_a |
float
|
|
deta_ds_b |
float
|
|
deta_dsx |
float
|
|
deta_dsy |
float
|
|
detap_dpz_a |
float
|
|
detap_dpz_b |
float
|
|
detap_dpz_x |
float
|
|
detap_dpz_y |
float
|
|
eta_a |
float
|
|
eta_b |
float
|
|
eta_x |
float
|
|
eta_y |
float
|
|
etap_a |
float
|
|
etap_b |
float
|
|
etap_x |
float
|
|
etap_y |
float
|
|
gamma_a |
float
|
|
gamma_b |
float
|
|
mode_flip |
bool
|
|
phi_a |
float
|
|
phi_b |
float
|
|
ElementOrbit
pytao.model.ElementOrbit
Bases: TaoModel
Structure which corresponds to Tao pipe ele:orbit 1, for example.
Attributes:
| Name | Type | Description |
|---|---|---|
beta |
float
|
Velocity / c_light. |
charge |
float
|
Macroparticle weight (which is different from particle species |
charge). For some space charge calcs the weight is in Coulombs. |
|
|
direction |
int
|
+1 or -1. Sign of longitudinal direction of motion (ds/dt). This is |
independent of the element orientation. |
|
|
dt_ref |
float
|
Used in: * time tracking for computing z. * by coherent photons = |
path_length/c_light. |
|
|
field |
sequence of floats
|
Photon E-field intensity (x,y). |
ix_ele |
int
|
Index of the lattice element the particle is in. May be -1 if element |
is not associated with a lattice. |
|
|
location |
str
|
upstream_end\(, inside\), or downstream_end$ |
p0c |
float
|
For non-photons: Reference momentum. For photons: Photon momentum (not |
reference). |
|
|
phase |
sequence of floats
|
Photon E-field phase (x,y). For charged particles, phase(1) is RF |
phase. |
|
|
px |
float
|
|
py |
float
|
|
pz |
float
|
|
s |
float
|
Longitudinal position |
species |
str
|
positron\(, proton\), etc. |
spin |
sequence of floats
|
Spin. |
state |
str
|
alive\(, lost\), lost_neg_x_aperture\(, lost_pz\), etc. |
t |
float
|
Absolute time (not relative to reference). Note: Quad precision! |
x |
float
|
|
y |
float
|
|
z |
float
|
|
ElementMat6
pytao.model.ElementMat6
Bases: TaoModel
Linear transfer map (mat6) data.
Attributes:
| Name | Type | Description |
|---|---|---|
mat6 |
NDArray of shape (6, 6)
|
|
vec0 |
NDArray
|
|
symplectic_error |
float
|
|
ElementFloorAll
pytao.model.ElementFloorAll
Bases: TaoBaseModel
Element floor positions based on optical trajectory - at its beginning, center, or end.
Attributes:
| Name | Type | Description |
|---|---|---|
which |
"base", "model", or "design"
|
|
beginning |
ElementFloor
|
The element position at the beginning. |
center |
ElementFloor
|
The element position at its center. |
end |
ElementFloor
|
The element position at its end. |
ElementFloor
pytao.model.ElementFloor
Bases: TaoBaseModel
Represents the floor position of an element.
Attributes:
| Name | Type | Description |
|---|---|---|
which |
"base", "model", or "design"
|
|
where |
"beginning", "center", or "end"
|
The location or placement of the element on the floor. |
actual |
(ElementFloorPosition, optional)
|
The actual position of the element on the floor. |
reference |
(ElementFloorPosition, optional)
|
The reference position of the element on the floor. |
slaves |
dict[int, ElementFloorItem]
|
A mapping of integer slave numbers to ElementFloorItem instances. |
ElementFloorPosition
pytao.model.ElementFloorPosition
Bases: TaoBaseModel
Represents the position and orientation of an element on the floor in a 3D space.
A point with element-local coordinates local is at
[x, y, z] + wmat @ local in the global floor frame.
Attributes:
| Name | Type | Description |
|---|---|---|
x |
float, default 0.0
|
The global X position (m). |
y |
float, default 0.0
|
The global Y (vertical) position (m). |
z |
float, default 0.0
|
The global Z position (m). |
theta |
float, default 0.0
|
Azimuth (yaw) angle (rad), in the horizontal (X, Z) plane. |
phi |
float, default 0.0
|
Pitch (elevation) angle (rad). |
psi |
float, default 0.0
|
Roll angle (rad) about the local z axis. |
wmat |
ndarray
|
The 3x3 orientation matrix W. Its columns are the local x, y and z axes in the global frame. |
ElementBunchParams
pytao.model.ElementBunchParams
Bases: TaoModel
Structure which corresponds to Tao pipe bunch_params 1, for example.
Attributes:
| Name | Type | Description |
|---|---|---|
beam_saved |
bool
|
|
centroid_beta |
float
|
|
centroid_p0c |
float
|
|
centroid_t |
float
|
|
centroid_vec_1 |
float
|
|
centroid_vec_2 |
float
|
|
centroid_vec_3 |
float
|
|
centroid_vec_4 |
float
|
|
centroid_vec_5 |
float
|
|
centroid_vec_6 |
float
|
|
charge_live |
float
|
Charge of all non-lost particle |
direction |
int
|
|
ix_ele |
int
|
Lattice element where params evaluated at. |
location |
str
|
Location in element: upstream_end\(, inside\), or downstream_end$ |
n_particle_live |
int
|
Number of non-lost particles |
n_particle_lost_in_ele |
int
|
Number lost in element (not calculated by Bmad) |
n_particle_tot |
int
|
Total number of particles |
rel_max_1 |
float
|
|
rel_max_2 |
float
|
|
rel_max_3 |
float
|
|
rel_max_4 |
float
|
|
rel_max_5 |
float
|
|
rel_max_6 |
float
|
|
rel_min_1 |
float
|
|
rel_min_2 |
float
|
|
rel_min_3 |
float
|
|
rel_min_4 |
float
|
|
rel_min_5 |
float
|
|
rel_min_6 |
float
|
|
s |
float
|
Longitudinal position. |
sigma_11 |
float
|
|
sigma_12 |
float
|
|
sigma_13 |
float
|
|
sigma_14 |
float
|
|
sigma_15 |
float
|
|
sigma_16 |
float
|
|
sigma_21 |
float
|
|
sigma_22 |
float
|
|
sigma_23 |
float
|
|
sigma_24 |
float
|
|
sigma_25 |
float
|
|
sigma_26 |
float
|
|
sigma_31 |
float
|
|
sigma_32 |
float
|
|
sigma_33 |
float
|
|
sigma_34 |
float
|
|
sigma_35 |
float
|
|
sigma_36 |
float
|
|
sigma_41 |
float
|
|
sigma_42 |
float
|
|
sigma_43 |
float
|
|
sigma_44 |
float
|
|
sigma_45 |
float
|
|
sigma_46 |
float
|
|
sigma_51 |
float
|
|
sigma_52 |
float
|
|
sigma_53 |
float
|
|
sigma_54 |
float
|
|
sigma_55 |
float
|
|
sigma_56 |
float
|
|
sigma_61 |
float
|
|
sigma_62 |
float
|
|
sigma_63 |
float
|
|
sigma_64 |
float
|
|
sigma_65 |
float
|
|
sigma_66 |
float
|
|
sigma_t |
float
|
RMS of time spread. |
species |
str
|
|
t |
float
|
Time. |
twiss_alpha_a |
float
|
|
twiss_alpha_b |
float
|
|
twiss_alpha_c |
float
|
|
twiss_alpha_x |
float
|
|
twiss_alpha_y |
float
|
|
twiss_alpha_z |
float
|
|
twiss_beta_a |
float
|
|
twiss_beta_b |
float
|
|
twiss_beta_c |
float
|
|
twiss_beta_x |
float
|
|
twiss_beta_y |
float
|
|
twiss_beta_z |
float
|
|
twiss_dalpha_dpz_a |
float
|
|
twiss_dalpha_dpz_b |
float
|
|
twiss_dalpha_dpz_c |
float
|
|
twiss_dalpha_dpz_x |
float
|
|
twiss_dalpha_dpz_y |
float
|
|
twiss_dalpha_dpz_z |
float
|
|
twiss_dbeta_dpz_a |
float
|
|
twiss_dbeta_dpz_b |
float
|
|
twiss_dbeta_dpz_c |
float
|
|
twiss_dbeta_dpz_x |
float
|
|
twiss_dbeta_dpz_y |
float
|
|
twiss_dbeta_dpz_z |
float
|
|
twiss_deta_dpz_a |
float
|
|
twiss_deta_dpz_b |
float
|
|
twiss_deta_dpz_c |
float
|
|
twiss_deta_dpz_x |
float
|
|
twiss_deta_dpz_y |
float
|
|
twiss_deta_dpz_z |
float
|
|
twiss_deta_ds_a |
float
|
|
twiss_deta_ds_b |
float
|
|
twiss_deta_ds_c |
float
|
|
twiss_deta_ds_x |
float
|
|
twiss_deta_ds_y |
float
|
|
twiss_deta_ds_z |
float
|
|
twiss_detap_dpz_a |
float
|
|
twiss_detap_dpz_b |
float
|
|
twiss_detap_dpz_c |
float
|
|
twiss_detap_dpz_x |
float
|
|
twiss_detap_dpz_y |
float
|
|
twiss_detap_dpz_z |
float
|
|
twiss_emit_a |
float
|
|
twiss_emit_b |
float
|
|
twiss_emit_c |
float
|
|
twiss_emit_x |
float
|
|
twiss_emit_y |
float
|
|
twiss_emit_z |
float
|
|
twiss_eta_a |
float
|
|
twiss_eta_b |
float
|
|
twiss_eta_c |
float
|
|
twiss_eta_x |
float
|
|
twiss_eta_y |
float
|
|
twiss_eta_z |
float
|
|
twiss_etap_a |
float
|
|
twiss_etap_b |
float
|
|
twiss_etap_c |
float
|
|
twiss_etap_x |
float
|
|
twiss_etap_y |
float
|
|
twiss_etap_z |
float
|
|
twiss_gamma_a |
float
|
|
twiss_gamma_b |
float
|
|
twiss_gamma_c |
float
|
|
twiss_gamma_x |
float
|
|
twiss_gamma_y |
float
|
|
twiss_gamma_z |
float
|
|
twiss_norm_emit_a |
float
|
|
twiss_norm_emit_b |
float
|
|
twiss_norm_emit_c |
float
|
|
twiss_norm_emit_x |
float
|
|
twiss_norm_emit_y |
float
|
|
twiss_norm_emit_z |
float
|
|
twiss_phi_a |
float
|
|
twiss_phi_b |
float
|
|
twiss_phi_c |
float
|
|
twiss_phi_x |
float
|
|
twiss_phi_y |
float
|
|
twiss_phi_z |
float
|
|
twiss_sigma_a |
float
|
|
twiss_sigma_b |
float
|
|
twiss_sigma_c |
float
|
|
twiss_sigma_p_a |
float
|
|
twiss_sigma_p_b |
float
|
|
twiss_sigma_p_c |
float
|
|
twiss_sigma_p_x |
float
|
|
twiss_sigma_p_y |
float
|
|
twiss_sigma_p_z |
float
|
|
twiss_sigma_x |
float
|
|
twiss_sigma_y |
float
|
|
twiss_sigma_z |
float
|
|
ElementMultipoles
pytao.model.ElementMultipoles
Bases: TaoModel
Structure which corresponds to Tao pipe ele:multipoles 13, for example.
Attributes:
| Name | Type | Description |
|---|---|---|
data |
ElementMultipoles_Data
|
Structure which corresponds to Tao |
example. |
|
|
multipoles_on |
bool
|
For turning multipoles on/off |
scale_multipoles |
bool or None
|
Are ab_multipoles within other elements (EG: quads, etc.) scaled by |
the strength of the element? |
|
ElementPhoton
pytao.model.ElementPhoton
Bases: ElementPhotonBase
Class representing a element's photon details.
Attributes:
| Name | Type | Description |
|---|---|---|
which |
"base", "model", or "design"
|
|
has_material |
bool
|
Whether |
has_pixel |
bool
|
Whether |
curvature |
ElementPhotonCurvature
|
Curvature of the photon element. |
material |
ElementPhotonMaterial
|
Material properties of the photon element. |
ElementWake
pytao.model.ElementWake
Bases: ElementWakeBase
Element wake settings and short/long-range wake data.
ElementSrWakeData
pytao.model.ElementSrWakeData
Bases: TaoModel
Per-element short-range wake data - may be longitudinal or transverse.
Attributes:
| Name | Type | Description |
|---|---|---|
z_ref |
float
|
|
ElementSrZLongWakeData
pytao.model.ElementSrZLongWakeData
Bases: TaoModel
Per-element tabulated short-range longitudinal (z_long) wake.
Attributes:
| Name | Type | Description |
|---|---|---|
dz |
float
|
Distance between table points. |
z0 |
float
|
Wake extent is [-z0, z0]. |
smoothing_sigma |
float
|
0 => no smoothing. |
position_dependence |
str
|
Longitudinal position dependence ( |
time_based |
bool
|
Was the input time-based? |
n_pt |
int
|
Number of table points. |
table |
NDArray
|
|
Attributes
pytao.model.ElementSrZLongWakeData.w
property
w
Table wake values W(z).
pytao.model.ElementSrZLongWakeData.z
property
z
Table positions z [m].
ElementWall3D
pytao.model.ElementWall3D
Bases: ElementWall3DBase
ElementWall3D class representing a 3D wall element in a lattice.
Attributes:
| Name | Type | Description |
|---|---|---|
which |
"base", "model", or "design"
|
|
index |
int
|
The index of the wall element. |
table |
list of ElementWall3DTable or None, optional
|
A table containing wall element details. |
ElementChamberWall
pytao.model.ElementChamberWall
Bases: TaoBaseModel
Represents a chamber wall element in the lattice.
Attributes:
| Name | Type | Description |
|---|---|---|
which |
"base", "model", or "design"
|
|
index |
int
|
The index of the chamber wall of the element. |
x |
list of ElementChamberWall
|
A list of ElementChamberWall objects along the x-axis. |
y |
list of ElementChamberWall
|
A list of ElementChamberWall objects along the y-axis. |
ElementLordSlave
pytao.model.ElementLordSlave
Bases: TaoModel, FromTaoListMixin
Structure which corresponds to Tao pipe ele:lord_slave 1 1 x, for example.
Attributes:
| Name | Type | Description |
|---|---|---|
key |
str
|
|
location_name |
str
|
|
name |
str
|
|
status |
str
|
|
type |
str
|
|
ElementGridField
pytao.model.ElementGridField
Bases: ElementGridField
Comb
Cumulative bunch moment data across the lattice.
pytao.model.Comb
Bases: TaoModel
Methods:
pytao.model.Comb.from_tao
classmethod
from_tao(tao, *, check_ds_save=True, ix_branch=0, **kwargs)
Create a Comb instance from Tao.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tao
|
Tao
|
|
required |
ix_branch
|
int
|
|
0
|
**kwargs
|
dict
|
Additional keyword arguments to pass to |
{}
|
Returns:
| Type | Description |
|---|---|
Comb
|
|
Source code in pytao/model/ele/comb.py
302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 | |
pytao.model.Comb.slice_by_s
slice_by_s(s_start, s_end, *, inclusive=True)
Slice the Comb data by 's' position between specified start and end values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
s_start
|
float
|
The starting s value of the slice. |
required |
s_end
|
float
|
The ending s value of the slice. |
required |
inclusive
|
bool
|
If True, the slice includes |
True
|
Returns:
| Type | Description |
|---|---|
Comb
|
A new instance of the Comb class with the sliced data. |
Source code in pytao/model/ele/comb.py
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | |
pytao.model.Comb.sort_by_s
sort_by_s()
Sort array data by s position.
Source code in pytao/model/ele/comb.py
291 292 293 294 295 296 297 298 299 300 | |
Helper Types
ElementRange
pytao.model.ElementRange
Bases: BaseModel
Multiple Tao elements.
Attributes
pytao.model.ElementRange.tao_string
property
tao_string
This element list represented in Tao command-line interface string form.
Methods:
pytao.model.ElementRange.from_tao
classmethod
from_tao(value)
Convert a Tao representation of comma-delimited elements to an ElementList.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str
|
|
required |
Returns:
| Type | Description |
|---|---|
ElementList or ElementRange
|
|
Source code in pytao/model/ele/ele.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |
ElementList
pytao.model.ElementList
Bases: BaseModel
Multiple Tao elements.
Attributes
pytao.model.ElementList.tao_string
property
tao_string
This element list represented in Tao command-line interface string form.
Methods:
pytao.model.ElementList.from_tao
classmethod
from_tao(value)
Convert a Tao representation of comma-delimited elements to an ElementList.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str
|
|
required |
Returns:
| Type | Description |
|---|---|
ElementList
|
|
Source code in pytao/model/ele/ele.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | |
ElementIntersection
pytao.model.ElementIntersection
Bases: BaseModel
An intersection of multiple Tao elements.
Attributes
pytao.model.ElementIntersection.tao_string
property
tao_string
This element intersection represented in Tao command-line interface string form.
Methods:
pytao.model.ElementIntersection.from_tao
classmethod
from_tao(value)
Create an ElementIntersection instance from a Tao format, ampersand-delimited string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str
|
|
required |
Returns:
| Type | Description |
|---|---|
ElementIntersection
|
|
Source code in pytao/model/ele/ele.py
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | |