quantity module

class quantity.Quantity(name='null-quantity-name', formalName='null-quantity-formal-name', formal_name='null-quantity-formal-name', value=0.0, unit='null-quantity-unit')[source]

Bases: object

todo: this probably should not have a “value” for the same reason as Species.
this needs some thinking.

well not so fast. This can be used to build a quantity with anything as a value. For instance a history of the quantity as a time series.

GetFormalName()[source]

Returns the formal name of the quantity.

Returns:formalName
Return type:str
GetUnit()[source]

Returns the units of the quantity.

Returns:unit
Return type:str
GetValue()[source]

Gets the numerical value of the quantity.

Returns:value
Return type:any type
SetFormalName(fn)[source]

Sets the formal name of the property to fn.

Parameters:fn (str) –
SetName(n)[source]

Sets the name of the quantity in question to n.

Parameters:n (str) –
SetUnit(f)[source]

Sets the units of the quantity to f (for example, density would be in units of g/cc.

Parameters:f (str) –
SetValue(v)[source]

Sets the numerical value of the quantity to v.

Parameters:v (float) –
__repr__()[source]

Used to print the data stored by the quantity class. Will print out name, formal name, the value of the quantity and its unit.

Returns:s
Return type:str
__str__()[source]

Used to print the data stored by the quantity class. Will print out name, formal name, the value of the quantity and its unit.

Returns:s
Return type:str
formalName

Returns the formal name of the quantity.

Returns:formalName
Return type:str
formal_name

Returns the formal name of the quantity.

Returns:formalName
Return type:str
get_name()[source]

Returns the name of the quantity.

Returns:name
Return type:str
name

Returns the name of the quantity.

Returns:name
Return type:str
plot(x_scaling=1, y_scaling=1, title=None, x_label='x', y_label=None, file_name=None, same_axis=True, dpi=300)[source]

This will support a few possibities for data storage in the self.__value member.

Pandas Series. If self.__value is a Pandas Series, plot against the index. However the type stored in the Series matter. Suppose it is a series of a numpy array. This must be of the same rank for every entry. This plot method assumes it is an iterable type of the same length for every entry in the series. A plot of all elements in the type against the index of the series will be made. The plot may have all elements in one axis or each element in its own axis.

unit

Returns the units of the quantity.

Returns:unit
Return type:str
value

Gets the numerical value of the quantity.

Returns:value
Return type:any type