sisl.mixing.History

class sisl.mixing.History(history: int = 2)

Bases: object

A history class for retaining a set of history elements

A history class may contain several different variables in a collections.deque list allowing easy managing of the length of the history.

history_max

maximum number of history elements

Type:

int or tuple of int

Parameters:

history (int, optional) – number of maximum history elements stored

Methods

append(*variables)

Add variables to the history

clear([index])

Clear variables to the history

elements

Number of elements in the history

max_elements

Maximum number of elements stored in the history for each variable

__init__(history: int = 2)[source]
Parameters:

history (int)

append(*variables: Any) None[source]

Add variables to the history

Internally, the list of variables will be added to the queue, it is up to the implementation to use the appended values.

Parameters:

*variables (Any) – each variable will be added to the history of the mixer

Return type:

None

clear(index: int | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None) None[source]

Clear variables to the history

Parameters:

index (int | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None) – which indices of the history we should clear

Return type:

None

property elements: int

Number of elements in the history

property max_elements: int

Maximum number of elements stored in the history for each variable