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. |
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, 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
|
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
1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 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 | |
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'), 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', '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')
|
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
680 681 682 683 684 685 686 687 688 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 | |
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.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
1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 | |
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
1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 | |
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
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 | |
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
1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 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 1473 1474 1475 | |
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
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 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 | |
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
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 | |
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
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 | |
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.
Attributes:
| Name | Type | Description |
|---|---|---|
x |
float, default 0.0
|
The x-coordinate of the position. |
y |
float, default 0.0
|
The y-coordinate of the position. |
z |
float, default 0.0
|
The z-coordinate of the position. |
theta |
float, default 0.0
|
The rotation around the x-axis in radians. |
phi |
float, default 0.0
|
The rotation around the y-axis in radians. |
psi |
float, default 0.0
|
The rotation around the z-axis in radians. |
wmat |
list of list of float, default empty list
|
The transformation matrix representing the orientation of the element. |
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
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
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | |
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
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | |
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
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | |