Table¶
- class Table(name, libmadx, *, columns='all', rows='all', _check=True)[source]¶
Bases:
_MappingMAD-X twiss table.
Loads individual columns from the MAD-X process lazily only on demand.
Attributes Summary
Get the element names (first, last) of the valid range.
Get the table summary.
Methods Summary
col_names([columns])Get list of all columns in the table.
column(column[, rows])Retrieve all specified rows in the given column of the table.
copy([columns, rows])Return a frozen table with the desired columns.
dframe([columns, rows, index])Return table as
pandas.DataFrame.get(k[,d])getmat(name, idx, *dim)items()keys()kvec(idx[, dim])Kicks.
reload(column)Reload (recache) one column from MAD-X.
rmat(idx[, dim])Sectormap.
row(index[, columns])Retrieve one row from the table.
row_names([rows])Get table row names.
Get list of column names that were selected by the user (can be empty).
Get list of row indices that were selected by the user (can be empty).
selection([columns, rows])Return a Table object that only retrieves the specified rows and columns by default.
sigmat(idx[, dim])Beam matrix.
tmat(idx[, dim])2nd order sectormap.
values()Attributes Documentation
- range¶
Get the element names (first, last) of the valid range.
- summary¶
Get the table summary.
Methods Documentation
- copy(columns=None, rows=None)[source]¶
Return a frozen table with the desired columns.
- Parameters:
columns (list) – column names or
Nonefor all columns.- Return type:
- Returns:
column data
- Raises:
ValueError – if the table name is invalid
- dframe(columns=None, rows=None, *, index=None)[source]¶
Return table as
pandas.DataFrame.- Parameters:
columns – column names or ‘all’ or ‘selected’
rows – row indices or ‘all’ or ‘selected’
index (str) – column name or sequence to be used as index, or
Nonefor using therow_names
- Returns:
column data as
pandas.DataFrame- Raises:
ValueError – if the table name is invalid
WARNING: using
index=Noneis unsafe after callingUSE. In this case, please manually specify another column to be used, e.g.index="name".
- get(k[, d]) D[k] if k in D, else d. d defaults to None.¶
- items() a set-like object providing a view on D's items¶
- keys() a set-like object providing a view on D's keys¶
- row_names(rows=None)[source]¶
Get table row names.
WARNING: using
row_namesafter callingUSE(before recomputing the table) is unsafe and may lead to segmentation faults or incorrect results.
- selection(columns='selected', rows=None)[source]¶
Return a Table object that only retrieves the specified rows and columns by default.
- Parameters:
columns – list of names or ‘all’ or ‘selected’
rows – list of indices or ‘all’ or ‘selected’
- Return type:
If only
columnsis given,rowsdefaults to ‘selected’ unlesscolumnsis set to ‘all’ in which case it also defaults to ‘all’.
- values() an object providing a view on D's values¶