Group

class simframe.frame.Group(owner, updater=None, description='')[source]

Bases: AbstractGroup

Class for grouping data. Group is a data frame that has additional functionality for updating its attributes.

Notes

When Group.update() is called the instructions of the group’s Heartbeat object will be performed. The function that is determing the update operation needs the parent Frame object as first positional argument.

Attributes:
description

Description of the instance.

toc

Complete table of contents starting from this object.

updateorder

Update order if updater was set with list of strings.

updater

Heartbeat object with update instructions.

Methods

addfield(name, value[, updater, ...])

Function to add a new Field to the object.

addgroup(name[, updater, description])

Function to add a new Group to the object.

addintegrationvariable(name, value[, ...])

Function to add a new integration variable IntVar to the object.

memory_usage([print_output, skip_hidden])

Determine memory usage of a Group

update(*args, **kwargs)

Function to update the object.

Attributes Summary

toc

Complete table of contents starting from this object.

updateorder

Update order if updater was set with list of strings.

updater

Heartbeat object with update instructions.

Methods Summary

addfield(name, value[, updater, ...])

Function to add a new Field to the object.

addgroup(name[, updater, description])

Function to add a new Group to the object.

addintegrationvariable(name, value[, ...])

Function to add a new integration variable IntVar to 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. None otherwise.

updater

Heartbeat object with update instructions.

You can either set a Heartbeat object directly, a callable functions that will be automatically transformed into a Heartbeat object, or a list of attribute names of the Group that 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 Field to 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

addgroup(name, updater=None, description='')[source]

Function to add a new Group to the object.

Parameters:
  • name (string) – Name of the group

  • updater (Heartbeat, Updater, callable or None, optional, default : None) – Updater for field update

  • description (string, optional, default : "") – Descriptive string for the group

addintegrationvariable(name, value, snapshots=[], updater=None, description='', copy=True)[source]

Function to add a new integration variable IntVar to 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

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