fluopy.simulation¶
Run photophysical simulations.
Classes¶
Container of simulation-associated attributes and methods. |
Module Contents¶
- class fluopy.simulation.Simulation(transition_set: fluopy.transitions.TransitionSet)[source]¶
Container of simulation-associated attributes and methods.
- Variables:
transition_set (fluopy.transitions.TransitionSet) – Collection of all relevant transitions and related attributes.
time_series (1-D array_like) – The simulated time points. At index i, they correspond to state_series[i] and transition_series[i - 1]. If end_time was not None, includes end_time at index -1 that does not correspond to any of state_series or transition_series. Can be memmap if use_memmap was set.
transition_series (1-D array_like) – The simulated transitions. At index i, they correspond to time_series[i + 1]. Can be memmap if use_memmap was set.
state_series (np.ndarray) – Contains 1-D array_like for each fluorophore representing its state at index i corresponding to time_series[i]. Can be memmap if use_memmap was set.
memmap_path (str) – The path where memmaps are stored.
- transition_set¶
- time_series = None¶
- transition_series = None¶
- state_series = None¶
- memmap_path = None¶
- run(start_at: tuple[int, Ellipsis] | None = None, size: int = 100000.0, end_time: float | None = None, kap_sq_var: bool = False, seed: fluopy.fluopy_types.RandomGeneratorSeed = None, use_memmap: str | pathlib.Path | None = None, **kwargs: Any) None[source]¶
Runs a simulation based on the direct method of the gillespie algorithm (i.e., stochastic simulation algorithm). Can either be based on maximum number of steps or maximum total time.
- Parameters:
start_at – If None, tuple of as many zeros as number of fluorophores. Can be any combination (size of number of fluorophores) of possible SingleState values. See transition_set.single_states.
size – If end_time is None, serves as maximum number of simulation steps. If end_time is not None, serves as size of random_numbers drawn at once.
end_time – If not None, time at which simulation ends in s.
kap_sq_var – If True, the first reaction method is used to simulate the data. This takes much longer but allows to vary the dipole orientation factor for different S1 states. If False, the direct method is used.
seed – A seed to initialize the BitGenerator.
use_memmap – Determines the path where memmaps shall be stored. If empty str, saved in current working directory.
kwargs – First reaction method arguments: include_kap_sq, minimum_rate.
- Return type:
None
- approximate(prediction: fluopy.prediction.Prediction, size: float, seed: fluopy.fluopy_types.RandomGeneratorSeed) None[source]¶
Approximates stochastic data based on the limiting distribution of a Markov chain. Only suitable for single fluorophore systems. Absorbing states are not considered. Each simple cycle should contain the most occurring state.
- Parameters:
prediction – Container of mathematically derived statistical attributes and methods.
size – Maximum number of steps. Due to rounding, actual size might vary.
seed – A seed to initialize the BitGenerator.
- Return type:
None
- delete_memmaps() None[source]¶
Delete the memmap variables and files. Note: if the memmaps are attempted to be accessed after deletion, python crashes. Source: https://stackoverflow.com/questions/39953501/i-cant-remove-file-created- by-memmap
- Return type:
None