SOAPify.transitions

Simple submodule for generating trasition matrices from SOAPclassification Author: Daniele Rapetti

Functions

calculateResidenceTimes(data[, statesTracker])

Given a classification (and the state tracker) generates a ordered list of residence times per state

calculateResidenceTimesFromClassification(data)

Calculates the resindence time for each element of the classification.

calculateTransitionMatrix(data[, statesTracker])

Generates the unnormalized matrix of the transitions

normalizeMatrixByRow(transMat)

Normalizes a transition matrix by row

transitionMatrixFromSOAPClassification(data)

Generates the unnormalized matrix of the transitions

transitionMatrixFromSOAPClassificationNormalized(data)

Generates the normalized transition matrix from a classify()

SOAPify.transitions.calculateResidenceTimes(data, statesTracker=None, **algokwargs)[source]

Given a classification (and the state tracker) generates a ordered list of residence times per state

The function decides automatically if calling

calculateResidenceTimesFromClassification() or tracker.getResidenceTimesFromStateTracker()

Parameters
  • data (SOAPclassification) –

    the classified trajectory, is statesTracker is passed will be used

    for getting the legend of the states

  • statesTracker (list, optional) –

    a list of list of state trackers, organized by atoms, or a list of

    state trackers. Defaults to None.

  • algokwargs – arguments passed to the called functions

Returns

an ordered list of the residence times for each state

Return type

list[numpy.ndarray]

SOAPify.transitions.calculateResidenceTimesFromClassification(data, window=1, stride=None)[source]

Calculates the resindence time for each element of the classification.

The residence time is how much an atom stays in a determined state: this function calculates the residence time for each atom and for each state, and returns an ordered list of residence times for each state hence losing the atom identity)

When a stride is specified, the algorithm accumulates the resiedence times of up to window simulations on hte same trajectory samplet at the window rate

The first and the last residence time for each atom are saved as negative numbers to signal the user that that time has to be considered more carefully

Parameters
  • data (SOAPclassification) – the classified trajectory

  • window (int) – the dimension of the windows between each state confrontations. Defaults to 1.

  • stride (int) – the stride in frames between each state confrontation. Defaults to None.

Returns

an ordered list of the residence times for each state

Return type

list[numpy.ndarray]

SOAPify.transitions.calculateTransitionMatrix(data, statesTracker=None, **algokwargs)[source]
Generates the unnormalized matrix of the transitions

from a classify() of from a statesTracker

The matrix is organized in the following way: for each atom in each frame we increment by one the cell whose row is the state at theframe n-stride and the column is the state at the frame n If the classification includes an error with a -1 values the user should add an ‘error’ class in the legend

Parameters
  • data (SOAPclassification) – the results of the soapClassification from classify()

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

  • statesTracker (list, optional) – a list of list of state trackers, organized by atoms, or a list of state trackers. Defaults to None.

  • algokwargs – arguments passed to the called functions

Returns

the unnormalized matrix of the transitions

Return type

numpy.ndarray[float]

SOAPify.transitions.normalizeMatrixByRow(transMat)[source]

Normalizes a transition matrix by row

The matrix is normalized with the criterion that the sum of each row is 1

Parameters

numpy.ndarray[float] – the unnormalized matrix of the transitions

Returns

the normalized matrix of the transitions

Return type

numpy.ndarray[float]

SOAPify.transitions.transitionMatrixFromSOAPClassification(data, stride=1, window=None)[source]

Generates the unnormalized matrix of the transitions

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

If the user specifies windows equal to None the windows is set equal to the stride

Parameters
  • data (SOAPclassification) – the results of the soapClassification from classify() stride (int): the stride in frames between each state confrontation. Defaults to 1.

  • window (int) – the dimension of the windows between each state confrontations. Defaults to None.

Returns

the unnormalized matrix of the transitions

Return type

numpy.ndarray[float]

SOAPify.transitions.transitionMatrixFromSOAPClassificationNormalized(data, stride=1, window=None)[source]

Generates the normalized transition matrix from a classify()

The matrix is organized in the following way: for each atom in each frame we increment by one the cell whose row is the state at the frame n-stride and the column is the state at the frame n

The matrix is normalized with the criterion that the sum of each row

is 1

Parameters
  • data (SOAPclassification) – the results of the soapClassification from classify()

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

  • window (int) – the dimension of the windows between each state confrontations. Defaults to None.

Returns

the normalized matrix of the transitions

Return type

numpy.ndarray[float]

Modules

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]