This module defines the class for TABLE entries in BDP’s
Defines the basic table structure used in ADMIT
The Table class is a container for holding data in tabluar format. The table can hold data in column-row format and also in plane-column-row format. Data can be added in instantiation, by columns, by rows, or by entire planes.
Parameters: | keyval : any valid attributes can be specified to the constructor |
---|
Attributes
columns | (List containing the column headers, optional) (defaults to an empty list) |
units | (List containing the units of each column, optional) (defaults to an empty list) |
planes | (List containing labels for each plane, optional) (defaults to an empty list) |
data | (A numpy array containing the data, can be 1D, 2D, or 3D, optional) (defaults to an empty array) |
desc | (A string for a description/caption of the table, optional) (defaults to an empty string)columns : List containing the column headers |
Methods
addColumn(data[, col]) | Add a column to the table |
addPlane(data[, plane]) | Add a plane to the table |
addRow(row) | Add a row to the table |
exportTable(fileName[, plane]) | Method to export a table to ascii text |
getColumn(col) | Get a column by its index |
getColumnByName(name) | Get a column by its name |
getHeader() | |
getPlane(pln) | |
getRow(row) | |
histogram(x[, title, figname, xlab, hrange, ...]) | simple histogram of one or more columns |
isequal(table) | Determine if two Tables are identical |
plotter(x, y[, title, figname, xlab, ylab]) | simple plotter of multiple columns against one column |
setData(data) | Set the data of the table all at once |
setkey([name, value]) | set keys, two styles are possible: |
write(root, name) | Method to write an xml entry for a Admit_table Any modifications to this method could break the I/O system. |
Add a column to the table
Adds the given column to the table and recomputes the minimum and maximum. The column must have the same length as the other columns or numpy will throw an exception.
Parameters: | data : list or numpy array
col : str, optional
|
---|---|
Returns: | None |
Add a plane to the table
Adds the given plane to the table and recomputes the minimum and maximum. The plane must have the same dimmensions as the other planes or numpy will throw an exception.
Parameters: | data : list or numpy array
plane : str, optional
|
---|---|
Returns: | None |
Add a row to the table
Adds the given row to the table and recomputes the minimum and maximum.
Parameters: | row : list or numpy array
|
---|---|
Returns: | None |
Method to export a table to ascii text
Parameters: | fileName : str
plane : int, optional
|
---|---|
Returns: | None |
Get a column by its index
Parameters: | name : int
|
---|---|
Returns: | The data from the column as a numpy array, or None if the column index does not exist. |
Get a column by its name
Parameters: | name : str
|
---|---|
Returns: | The data from the column as a numpy array, or None if the column name does not exist. |
simple histogram of one or more columns
Determine if two Tables are identical
Parameters: | table : Table
|
---|---|
Returns: | Boolean
|
Notes
This is a useful method for testing but not intended for production. Experimental.
simple plotter of multiple columns against one column
Set the data of the table all at once
Parameters: | data : list or numpy array
|
---|---|
Returns: | None |
set keys, two styles are possible:
This method checks the type of the keyword value, as it must remain the same. Also new keywords cannot be added.
Parameters: | name : dictionary or string
value : any
|
---|---|
Returns: | None |
Method to write an xml entry for a Admit_table Any modifications to this method could break the I/O system. Please test thoroughly before checking in the changes.
Parameters: | root : A reference to the parent ElementTree name : str
|
---|---|
Returns: | A reference to the SubElement that was created and populated |