Group
- class simframe.frame.Group(owner, updater=None, description='')[source]
Bases:
AbstractGroupClass for grouping data.
Groupis a data frame that has additional functionality for updating its attributes.Notes
When
Group.update()is called the instructions of the group’sHeartbeatobject will be performed. The function that is determing the update operation needs the parentFrameobject as first positional argument.- Attributes:
descriptionDescription of the instance.
tocComplete table of contents starting from this object.
updateorderUpdate order if updater was set with list of strings.
updaterHeartbeatobject with update instructions.
Methods
addfield(name, value[, updater, ...])Function to add a new
Fieldto the object.addgroup(name[, updater, description])Function to add a new
Groupto the object.addintegrationvariable(name, value[, ...])Function to add a new integration variable
IntVarto the object.memory_usage([print_output, skip_hidden])Determine memory usage of a Group
update(*args, **kwargs)Function to update the object.
Attributes Summary
Complete table of contents starting from this object.
Update order if updater was set with list of strings.
Heartbeatobject with update instructions.Methods Summary
addfield(name, value[, updater, ...])Function to add a new
Fieldto the object.addgroup(name[, updater, description])Function to add a new
Groupto the object.addintegrationvariable(name, value[, ...])Function to add a new integration variable
IntVarto the object.memory_usage([print_output, skip_hidden])Determine memory usage of a Group
Attributes Documentation
- toc
Complete table of contents starting from this object.
- updateorder
Update order if updater was set with list of strings.
Noneotherwise.
- updater
Heartbeatobject with update instructions.You can either set a
Heartbeatobject directly, a callable functions that will be automatically transformed into aHeartbeatobject, or a list of attribute names of theGroupthat will be updated in that order.
Methods Documentation
- addfield(name, value, updater=None, differentiator=None, description='', constant=False, save=True, copy=True)[source]
Function to add a new
Fieldto the object.- Parameters:
name (string) – Name of the field
value (number, array, string) – Initial value of the field. Needs to have already the correct type and shape
updater (Heartbeat, Updater, callable or None, optional, default : None) – Updater for field update
differentiator (Heartbeat, Updater, callable or None, optional, default : None) – Differentiator if the field has a derivative
description (string, optional, default : "") – Descriptive string for the field
constant (boolean, optional, default : False) – True if the field is immutable
save (boolean, optional, default : True) – If True field will be stored in output files
copy (boolean, optional, default : True) – If True <value> will be copied, not referenced
- Returns:
field – Returns the field for convenience
- Return type:
- addgroup(name, updater=None, description='')[source]
Function to add a new
Groupto the object.- Parameters:
- Returns:
group – Returns the group for convenience
- Return type:
- addintegrationvariable(name, value, snapshots=[], updater=None, description='', copy=True)[source]
Function to add a new integration variable
IntVarto the object.- Parameters:
name (string) – Name of the field
value (number, array, string) – Initial value of the field. Needs to have already the correct type and shape
updater (Heartbeat, Updater, callable or None, optional, default : None) – Updater for field update
snapshots (list, ndarray, optional, default : []) – List of snapshots at which an output file should be written
description (string, optional, default : "") – Descriptive string for the field
copy (boolean, optional, default : True) – If True <value> will be copied, not referenced
- Returns:
field – Returns the integration variable for convenience
- Return type:
- memory_usage(print_output=False, skip_hidden=False)[source]
Determine memory usage of a Group
Will only return the correct data size of Fields and Groups of Fields. Other data types might deviate from the true memory usage.
- Parameters:
print_output (bool, optional, default : False) – if True, print results on screen
skip_hidden (bool, optional, default : False) – if True, hidden attributes will be ignored
- Returns:
total memory usage of group in bytes
- Return type:
float