fluopy.simulation ================= .. py:module:: fluopy.simulation .. autoapi-nested-parse:: Run photophysical simulations. Classes ------- .. autoapisummary:: fluopy.simulation.Simulation Module Contents --------------- .. py:class:: Simulation(transition_set: fluopy.transitions.TransitionSet) Container of simulation-associated attributes and methods. :ivar transition_set: Collection of all relevant transitions and related attributes. :vartype transition_set: fluopy.transitions.TransitionSet :ivar time_series: 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. :vartype time_series: 1-D array_like :ivar transition_series: The simulated transitions. At index i, they correspond to time_series[i + 1]. Can be memmap if use_memmap was set. :vartype transition_series: 1-D array_like :ivar state_series: 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. :vartype state_series: np.ndarray :ivar memmap_path: The path where memmaps are stored. :vartype memmap_path: str .. py:attribute:: transition_set .. py:attribute:: time_series :value: None .. py:attribute:: transition_series :value: None .. py:attribute:: state_series :value: None .. py:attribute:: memmap_path :value: None .. py:method:: 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 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. :param 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. :param 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. :param end_time: If not None, time at which simulation ends in s. :param 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. :param seed: A seed to initialize the BitGenerator. :param use_memmap: Determines the path where memmaps shall be stored. If empty str, saved in current working directory. :param kwargs: First reaction method arguments: include_kap_sq, minimum_rate. :rtype: None .. py:method:: approximate(prediction: fluopy.prediction.Prediction, size: float, seed: fluopy.fluopy_types.RandomGeneratorSeed) -> None 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. :param prediction: Container of mathematically derived statistical attributes and methods. :param size: Maximum number of steps. Due to rounding, actual size might vary. :param seed: A seed to initialize the BitGenerator. :rtype: None .. py:method:: delete_memmaps() -> None 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 :rtype: None