Skip to content
ComplexSystemsIntelligencePublic

About

nocad: network-based controllability and observability analysis of dynamical systems in Python (successor of the NOCAD MATLAB toolbox) with a companion book

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

nocad: network-based controllability and observability analysis in Python

nocad: network-based controllability and observability analysis in Python

tests docs DOI License: MIT

nocad analyses the controllability and observability of dynamical systems on the network of their state variables. It succeeds the NOCAD — Network-based Observability and Controllability Analysis of Dynamical systems toolbox for MATLAB (Leitold, Vathy-Fogarassy, Abonyi) and implements its three modules — network mapping, system characterisation, and the improvement of input and output configurations — together with new methods: the exact minimum of dedicated inputs, node roles and edge classes, control profiles, robustness analysis, and a visualization module whose layouts make the structural conditions of controllability visible.

Module Contents
nocad.design, nocad.matching maximum matching (Hopcroft–Karp), path finding, signal sharing, exact minimum of dedicated inputs; driver and sensor nodes; generation of B, C, D; node roles and edge classes
nocad.structural, nocad.components Lin's structural test, generic dimension of the controllable subspace (orthogonal Krylov iteration), Kalman and PBH tests, control and observe centrality; strongly connected components and condensation
nocad.distances geodesic distances, control and observation depth and regions, relative degree, placement cost
nocad.profiles, nocad.robustness driver and sensor types, control profiles; robustness against node and edge removal
nocad.connection the seven connection types, node and edge dynamics, dynamics heat maps
nocad.measures about fifty network, node, configuration and edge measures as pandas tables
nocad.placement grassroot and retrofit set covering, centrality-based retrofit, mCLASA and GDFCMSA simulated annealing (Placement estimator)
nocad.io, nocad.annotation import and export: NetworkX, igraph, pandas, state-space matrices, python-control; GraphML, GEXF (Gephi), GML, Cytoscape JSON, node-link JSON, Graphviz DOT, Pajek, edge lists, CSV, Excel, MATLAB (NOCAD toolbox), NumPy; node and edge tables with the role of every element, carried as attributes by every export and restored on import
nocad.viz SCC hierarchy layout, bipartite matching view, control cacti, block-triangular structure matrix, depth maps with network-Voronoi regions, operability plane, role and robustness maps, dashboards
nocad.datasets, nocad.plotting the networks of the NOCAD studies (Sets I–III, C. elegans frontal network), generators (random, water tanks, heat exchanger networks), drawing primitives

Installation

pip install nocad

Python ≥ 3.10; depends on numpy, scipy, networkx, pandas and matplotlib. pip install "nocad[interop]" adds python-control, igraph and openpyxl for the corresponding conversions.

Quick start

import nocad
from nocad.datasets import load_nocad_example
from nocad.viz import plot_control_cacti, plot_operability_summary

adj = load_nocad_example().adj             # network of the state variables (W = A^T)

design = nocad.InputOutputDesign(method="path_finding").fit(adj)
design.driver_nodes_, design.sensor_nodes_  # where the inputs and outputs go
A, B, C, D = design.matrices()              # structured state-space matrices
design.is_controllable(), design.is_observable()

nocad.InputOutputDesign(method="minimum").fit(adj).n_inputs_   # exact minimum

plot_control_cacti(adj)                     # Lin's cacti: why the design works
plot_operability_summary(adj)               # hierarchy, depth maps, operability plane

ann = design.annotate()                     # role of every node and edge (pandas tables)
design.write("example.gexf")                # Gephi, with role colors and positions
G = design.to_networkx()                    # annotated networkx.DiGraph
net = nocad.read_network("example.gexf")    # network and configuration come back

Estimators follow the scikit-learn conventions (fit, fitted attributes with a trailing underscore, get_params/set_params); networks are accepted as NumPy arrays, SciPy sparse matrices, NetworkX digraphs, igraph graphs or pandas DataFrames, and node names are kept in every table, file and figure.

Documentation, examples, book

  • Documentation and example gallery: https://complexsystemsintelligence.github.io/nocad. 29 runnable examples in seven sections; each generates or loads its own network, explains the method and ends with a study of its parameters. Every example is also a Jupyter notebook.
  • Book: Network-Based Controllability and Observability Analysis in Python: The nocad toolbox: read online, PDF (136 pages) and EPUB, CC BY 4.0; LaTeX source in book/, built by book/build.sh (PDF), book/epub/make_epub.py and book/web/make_web.py. Theory in one notation, algorithm boxes, propositions with proofs, and the gallery examples as case studies.
  • Migration from the MATLAB toolbox: Appendix B of the book and docs/migration.rst.

Development

git clone https://github.com/ComplexSystemsIntelligence/nocad.git && cd nocad
pip install -e ".[dev]"
pytest                                   # unit tests and doctests
ruff check src tests tools examples
python docs/build_api_pages.py && sphinx-build -b html docs docs/_build/html
book/build.sh                            # cover, figures, appendices, PDF
python book/epub/make_epub.py            # EPUB edition (tex4ebook)
python book/web/make_web.py              # web edition (make4ht) -> book/_build_web/site

DESIGN.md sets the conventions for the code, the docstrings, the examples and the book (notation, API contract, layout, templates).

Citing

Please cite the software and the original publications of the methods you use:

  • J. Abonyi, D. Leitold, Á. Vathy-Fogarassy: nocad: network-based observability and controllability analysis of dynamical systems in Python, version 1.0.1 (2026), doi:10.5281/zenodo.24646321;
  • D. Leitold, Á. Vathy-Fogarassy, J. Abonyi: Controllability and observability in complex networks – the effect of connection types. Scientific Reports 7, 151 (2017), doi:10.1038/s41598-017-00160-5;
  • D. Leitold, Á. Vathy-Fogarassy, J. Abonyi: Network-based observability and controllability analysis of dynamical systems: the NOCAD toolbox. F1000Research 8:646 (2019), doi:10.12688/f1000research.19029.2.

Every docstring and chapter lists the publications behind its methods.

About

nocad is developed by the HUN-REN–PE Complex Systems Monitoring Research Group (AbonyiLab) at the University of Pannonia, Veszprém, Hungary. The group's open textbooks and software are collected at complexsystemsintelligence.github.io. The work was supported by the National Research, Development and Innovation Office of Hungary (NKFIH) through the OTKA 143482 project.

License

Code: MIT. Book: CC BY 4.0. Authors: János Abonyi, Dániel Leitold and Ágnes Vathy-Fogarassy (University of Pannonia), who also wrote the MATLAB toolbox this project succeeds.

About

nocad: network-based controllability and observability analysis of dynamical systems in Python (successor of the NOCAD MATLAB toolbox) with a companion book

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages