nocad.io.read#

nocad.io.read(path, format=None, **kwargs)[source]#

Read a network (and a stored configuration) from a file.

Returns:
netBunch with adj, labels, n_states, node_data (attributes found in

the file), drivers and sensors (from driver/sensor attributes or from B and C, else None); MATLAB files also give A, B, C, D.

Examples

>>> import tempfile, pathlib
>>> from nocad.datasets import load_nocad_example
>>> f = pathlib.Path(tempfile.mkdtemp()) / "example.graphml"
>>> _ = write(load_nocad_example().adj, f)
>>> net = read(f)
>>> net.n_states, net.drivers.tolist(), net.sensors.tolist()
(9, [7], [0, 8])