SOAPify.transitions.tracker

This submodule contains the function to build and work with the ‘state trackers’: a state tracker is a list of 4-element arrays whose components represent an ‘event’: [previous state ID, current state ID, next state ID, the duration of the event]

In the module there is some logic to help to the user to understand if the event is a ‘first one’ or a ‘last one’ (aka the first/las seen in the simulation for each atom): a first one will have previous state ID = current state ID and a last one will have next state ID = current state ID

Module Attributes

TRACK_PREVSTATE

the index of the component of the statetracker with the previous state

TRACK_CURSTATE

the index of the component of the statetracker with the current state

TRACK_ENDSTATE

the index of the component of the statetracker with the next state

TRACK_EVENTTIME

the index of the component of the statetracker with the duration of the state, in frames

Functions

getResidenceTimesFromStateTracker(...)

Calculates the resindence times from the events.

removeAtomIdentityFromEventTracker(statesTracker)

Merge all of the list of stateTracker into a single lists, by removing the information of what atom did a given event.

trackStates(classification[, window, stride])

Creates an ordered list of events for each atom in the classified trajectory

transitionMatrixFromStateTracker(...)

Generates the unnormalized matrix of the transitions

Classes

StateTracker(nat, window, stride)

A contained for the state trackers

class SOAPify.transitions.tracker.StateTracker(nat, window, stride)[source]

Bases: object

A contained for the state trackers

__init__(nat, window, stride)[source]

_summary_

Parameters
  • nat (int) – _description_

  • window (int) – _description_

  • stride (int) – _description_

property stride: int

_summary_

Returns

_description_

Return type

int

property window: int

_summary_

Returns

_description_

Return type

int

SOAPify.transitions.tracker.TRACK_CURSTATE = 1

the index of the component of the statetracker with the current state

SOAPify.transitions.tracker.TRACK_ENDSTATE = 2

the index of the component of the statetracker with the next state

SOAPify.transitions.tracker.TRACK_EVENTTIME = 3

the index of the component of the statetracker with the duration of the state, in frames

SOAPify.transitions.tracker.TRACK_PREVSTATE = 0

the index of the component of the statetracker with the previous state

SOAPify.transitions.tracker.getResidenceTimesFromStateTracker(statesTracker, legend)[source]

Calculates the resindence times from the events.

Given a state tracker and the list of the states returns the list of residence times per state

Parameters
  • statesTracker (list) – a list of list of state trackers, organized by atoms, or a list of state trackers

  • legend (list) – the list of states

Returns

an ordered list of the residence times for each state

Return type

list[numpy.ndarray]

SOAPify.transitions.tracker.removeAtomIdentityFromEventTracker(statesTracker)[source]

Merge all of the list of stateTracker into a single lists, by removing the information of what atom did a given event.

Parameters
  • statesTracker (list) – a list of list of state trackers, organized by atoms

  • statesTracker – a list of list of state trackers, organized by atoms

Returns

a state tracker

Return type

StateTracker

SOAPify.transitions.tracker.trackStates(classification, window=1, stride=None)[source]

Creates an ordered list of events for each atom in the classified trajectory

each tracker is composed of events, each events is and array of foir components: [start state, state, end state,time]:

  • if PREVSTATE == CURSTATE is the first event for the atom

  • if ENDSTATE == CURSTATE is the last event for the atom

Parameters
  • classification (SOAPclassification) – the classified trajectory

  • stride (int) – the stride in frames between each window. Defaults to 1.

Returns

ordered list of events for each atom in the classified trajectory

Return type

StateTracker

SOAPify.transitions.tracker.transitionMatrixFromStateTracker(statesTracker, legend)[source]

Generates the unnormalized matrix of the transitions

see calculateTransitionMatrix() for a detailed description of an unnormalized transition matrix

Parameters
  • statesTracker (StateTracker) – a StateTracker

  • legend (list) – the list of the name of the states

Returns

the unnormalized matrix of the transitions

Return type

numpy.ndarray[float]