Goulib.units module

Goulib.units.magnitudeIn(self, unit)[source]
class Goulib.units.Row(row)[source]

Bases: object

a Raw is internally a dict of {‘colname1’:value,’colname2’,value…}


Initialize self. See help(type(self)) for accurate signature.

__setitem__(col, value)[source]
class Goulib.units.Table(name, cols, cells)[source]

Bases: object

to create a table, use the following syntax

t = Table (‘myTable’, [‘col1’, ‘col2’, ‘col3’],
[ ‘distance’, V(20,’m’), V(30,’m’), V(40,’m’),
(‘speed’,’m/s’),V(2,’m/min’), V(5,’m/s’), V(10,’inch/s’)


the row label can be a tuple of (‘label’,’unit’). in that case, all the values of the row will be converted to ‘unit’ (if possible) and the cells won’t diplay the units saving space in the future, the label could be replaced by a dictionary having more properties like {‘label’:<label>, ‘comment’:<comment>….}

internally, the rows are represented as {‘<the label>’:{‘col1’:<value>, ‘col2’:<value> ….},

‘<the next label>’
__init__(name, cols, cells)[source]

Initialize self. See help(type(self)) for accurate signature.

setCell(row, col, value)[source]
appendCol(colname, values)[source]

appends a column at the right of the table :parameter values: is a dict of {<row>:V(…),…}

appendRow(label, values, unit=None)[source]

appends a new row of data :params label: the label of the row :params values: an array of values. must be the same size as ne number of columns of the table :params unit: if specified, the unit that will be used to display the row

appendColFromObj(colname, obj, default=None)[source]

add a new column by searching in obj all properties that have the same name as the row names if a row is not found, then the default is used

class Goulib.units.View(table, rows=[], cols=[], rowUnits={}, name='')[source]

Bases: object

__init__(table, rows=[], cols=[], rowUnits={}, name='')[source]

Initialize self. See help(type(self)) for accurate signature.