Skip to content

ankitgupta83/SpectralKoopman

Repository files navigation

SpectralKoopman

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.


Repository Structure

This package contains the following main files:

  1. 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.
  2. 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.
  3. main.py
    Main Python script.
    Requires both configuration JSON files as input and performs the full analysis, producing the specified plots and outputs.

  4. ReactionNetworkClass.py
    Contains the ReactionNetworkDefinition class describing a generic stochastic reaction network.

  5. 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.
  6. IteratedResolventEstimation.py
    Functions for estimating iterated resolvents and their differences.

  7. decayModeEstimator.py
    Functions for estimating decay modes from resolvents at various initial states using convex optimisation.

  8. 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.

  9. simulationRoutines.py

    • SSA simulation of stochastic reaction networks.
    • Coupled trajectories for parameter sensitivity estimation (CFD).
  10. stationaryDistributionEstimator.py
    Methods for producing a crude estimate $\hat{\pi}$ of the stationary distribution.

  11. sensitivityEstimation.py
    Functions for estimating parameter sensitivities.

  12. CSD_Estimation.py
    Functions for estimating cross-spectral densities (CSDs) using both sssKoop and SSA-DFT.

  13. plotting.py
    Plotting subroutines for:

    • Decay modes
    • Koopman trajectories
    • Parameter-sensitivity trajectories
    • Cross-spectral densities (static and movies)

Additional Components

  • lib/
    Contains C header files for stochastic simulations:
    • stochastic_simulators_cpu.h – CPU-based routines
    • stochastic_simulators_gpu.h – GPU-based routines

Command Line Usage

Example execution:

python main.py

About

Implementation of the SKA Method for Stochastic Reaction Networks (SRNs)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published