Implementation of the SKA method for Stochastic Reaction Networks (SRNs).
This code accompanies the paper:
A Spectral Koopman Approximation Framework for Stochastic Reaction Networks
by Ankit Gupta and Mustafa Khammash.
The implementation is primarily in Python, with certain routines in C for faster stochastic simulations. If a GPU is available, the code automatically performs computations there; otherwise, it defaults to the CPU.
This package contains the following main files:
-
analysis_configuration.json
Configuration file specifying:- The reaction network to be analysed (must be defined in
ReactionNetworkExamples.py). - Parameters controlling the sssKoop method:
crude estimate of stationary distribution, maximum number of decay modes, Koopman estimate generation, parameter sensitivities, and cross-spectral densities (CSDs). - Parameters for comparison methods (SSA, CFD, SSA-DFT).
- Initial state of the network.
- The reaction network to be analysed (must be defined in
-
output_configuration.json
Configuration file specifying output and plotting preferences:- Which analyses/plots to generate (Koopman trajectories, SSA comparisons, sensitivities, CSDs, etc.).
- Choice of observable functions and sensitivity parameters.
- Terminal times for CSDs.
- Parameters for movies of evolving spectral densities.
-
main.py
Main Python script.
Requires both configuration JSON files as input and performs the full analysis, producing the specified plots and outputs. -
ReactionNetworkClass.py
Contains theReactionNetworkDefinitionclass describing a generic stochastic reaction network. -
ReactionNetworkExamples.py
- Defines example reaction networks by inheriting from
ReactionNetworkDefinition. - Each example specifies its output species and output functions (default: first two moments).
- Includes manuscript examples; new examples can be easily added.
- Defines example reaction networks by inheriting from
-
IteratedResolventEstimation.py
Functions for estimating iterated resolvents and their differences. -
decayModeEstimator.py
Functions for estimating decay modes from resolvents at various initial states using convex optimisation. -
KoopmanEstimator.py
Methods for estimating linear coefficients in the spectral expansion of the Koopman operator at a given initial state, and their differences across states. -
simulationRoutines.py
- SSA simulation of stochastic reaction networks.
- Coupled trajectories for parameter sensitivity estimation (CFD).
-
stationaryDistributionEstimator.py
Methods for producing a crude estimate$\hat{\pi}$ of the stationary distribution. -
sensitivityEstimation.py
Functions for estimating parameter sensitivities. -
CSD_Estimation.py
Functions for estimating cross-spectral densities (CSDs) using both sssKoop and SSA-DFT. -
plotting.py
Plotting subroutines for:- Decay modes
- Koopman trajectories
- Parameter-sensitivity trajectories
- Cross-spectral densities (static and movies)
- lib/
Contains C header files for stochastic simulations:stochastic_simulators_cpu.h– CPU-based routinesstochastic_simulators_gpu.h– GPU-based routines
Example execution:
python main.py