fluopy.transitions

Define and handle photophysical transitions.

Classes

SingleState

Assigns a unique identifier (value) to each possible photophysical state.

PairedState

Assigns a combination of SingleState to each energy transfer related paired state.

Transition

Contains constant and variable attributes of photophysical transitions.

TransitionSet

Collection of all relevant transitions and related attributes. Allows optional

Module Contents

class fluopy.transitions.SingleState(*args, **kwds)[source]

Bases: enum.Enum

Assigns a unique identifier (value) to each possible photophysical state.

S0 = 0
S1 = 1
S2 = 2
T1 = 3
T2 = 4
B = 5
cis = 6
OFF = 7
OFF2 = 8
R = 9
class fluopy.transitions.PairedState(*args, **kwds)[source]

Bases: enum.Enum

Assigns a combination of SingleState to each energy transfer related paired state. E.g., the classical Förster resonance energy transfer needs one fluorophore to be in S1 and another fluorophore closeby to be in S0. After the transition, the first fluorophore will be in S0 and the other in S1.

S1_S0
S0_S1
S1_T1
S1_Cis
S0_Cis
S1_OFF
S0_S0
S0_T2
S1_S1
S0_T1
S0_OFF2
S0_OFF
S0_B
S1_R
S0_R
property single_state_values: tuple[int, int]

Returns a tuple of SingleState values.

property acceptor: SingleState

Returns the acceptor (second value).

property donor: SingleState

Returns the donor (first value).

class fluopy.transitions.Transition[source]

Contains constant and variable attributes of photophysical transitions.

Variables:
  • identity (int) – The id of the transition. Not None if transition is part of a TransitionSet.

  • transition_type (TransitionType) – The photophysical type of the transitions with its constant attributes.

  • abbreviation (str) – The abbreviation of the transition.

  • initial_state (SingleState | PairedState) – The initial state of the transition.

  • final_state (SingleState | PairedState) – The final state of the transition.

  • rate (float) – The rate of the transition.

  • photon (bool) – Whether the transition emits a photon.

  • fluorophore_ids (list[int] | list[tuple[int, int]]) – Contains the identities of relevant fluorophores. If energy transfer, tuples of fluorophore pairs, where the first is the donor and the second is the acceptor.

identity: int
transition_type: TransitionType
abbreviation: str
initial_state: SingleState | PairedState
final_state: SingleState | PairedState
rate: float
photon: bool
fluorophore_ids: list[int] | list[tuple[int, int]]
__post_init__() None[source]
class fluopy.transitions.TransitionSet(transitions: dict[str, list[Transition]], fluorophore_system: fluopy.fluorophores.FluorophoreSystem, keep_zero_rates: bool = False)[source]

Collection of all relevant transitions and related attributes. Allows optional post-init-modification and (subsequent) finalization.

Variables:
  • transitions (dict[str, list[Transition]]) – Contains lists of transitions of type Transition with non-zero rate as values and fluorophores or fluorophore-combinations as keys.

  • fluorophore_system (fluopy.fluorophores.FluorophoreSystem) – Container for attributes of multiple, interrelated fluorophores.

  • combined_state_transitions_df (pd.DataFrame) – Contains realizable combined_state_transitions with their id as index and their other attributes as columns.

  • row_sums (np.ndarray) – Contains the sum of each row of non-normalized transition rates, i.e., the sum of rates of all possible combined_state_transitions.

  • single_states (dict[str, npt.NDArray[np.int64]]) – Contains the values of all relevant SingleStates as values. Name of fluorophores as keys.

  • transition_df (pd.DataFrame) – Dataframe of all given transitions with non-zero rate containing their id as second level index and their other attributes as columns. Name of fluorophores as first level index.

  • transition_matrix (np.ndarray) – Contains the normalized rate constants (i.e., point probabilities) for each possible combined_state_transition at the corresponding index pair.

transitions
fluorophore_system
transition_df
single_states
property combined_state_transitions_df: pandas.DataFrame
property row_sums: numpy.typing.NDArray[numpy.float64]
property transition_matrix: numpy.typing.NDArray[numpy.float64]
filter_by_identity(remove_list: collections.abc.Collection = None, keep_zero_rates: bool = False) TransitionSet[source]

Returns another TransitionSet with transitions removed by their identity.

Parameters:
  • remove_list – Contains identities of type int.

  • keep_zero_rates – Whether to keep transitions with rate 0.

Returns:

filtered – Re-initialization of the object with the modified transition collection.

Return type:

TransitionSet

adjust_rates(change_dict: dict[int, float] = None, keep_zero_rates: bool = False) TransitionSet[source]

Returns another TransitionSet with transition rates modified.

Parameters:
  • change_dict – Contains identities of transitions as key and rates as values.

  • keep_zero_rates – Whether to keep transitions with rate 0.

Returns:

adjusted – Re-initialization of the object with the modified transition collection.

Return type:

TransitionSet

remove_zero_rates() TransitionSet[source]

Returns another TransitionSet with all transitions removed that have a rate constant of zero.

Returns:

Re-initialization of the object with the modified transition collection.

Return type:

TransitionSet

remove_absorbing_states(keep_zero_rates: bool = False) TransitionSet[source]

Returns another TransitionSet that contains no Markovian absorbing states.

Parameters:

keep_zero_rates – Whether to keep transitions with rate 0.

Returns:

no_abs – Re-initialization of the object with the modified transition collection.

Return type:

TransitionSet

remove_energy_transfers(keep_zero_rates: bool = False) TransitionSet[source]

Return another TransitionSet that contains no transitions that are energy transfers.

Parameters:

keep_zero_rates – Whether to keep transitions with rate 0.

Returns:

no_ets – Re-initialization of the object with the modified transition collection.

Return type:

TransitionSet

finalize() Self[source]

Construct combined_state_transitions_df, transition_matrix and row_sums.

Return type:

self

plot(graph_type: str = 'shell', colors: collections.abc.Collection | None = None, scale: float = 1, axes: collections.abc.Iterable[matplotlib.axes.Axes] | None = None) list[matplotlib.axes.Axes][source]

Plot photophysical system as network/graph.

Parameters:
  • graph_type – Specifies network layout. One of ‘shell’, ‘circular’, ‘planar’ or ‘kamada’.

  • colors – Contains two colors as Hex values of type str.

  • scale – Factor to scale the figure.

  • axes – Axes elements to plot graphs on.

Returns:

Axes objects with the plots.

Return type:

list[matplotlib.axes.Axes]