Skip to content

<!-- markdownlint-disable -->

<a href="../../../../../apps/utilities/pracciolini/src/jsinp.py#L0"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

<kbd>module</kbd> jsinp

JSInp (SAPHIRE solver JSON) reader and writer for pracciolini.

write() consumes PBF bytes and emits the SAPHSOLVE input structure for And/Or/AtLeast trees. It rejects Not, Xor, Nand, and Nor (returns False) and returns True on success.

read() parses a SAPHSOLVE JSInp file and returns canonical PBF bytes. A file with sequences becomes a PBM1 version-2 event tree model; a file with a single fault tree and no sequences becomes a version-1 fault tree. Each logiclist entry encodes one functional-event state: bit 31 set means success (complemented system), and the low bits minus 0x40000 give the fault tree id. A functional event absent from a sequence is bypassed. Basic events take the eventlist value directly as probability; the <TRUE>/<FALSE>/<PASS> events, the per-fault-tree placeholder events, and the initiating event never enter the node table. Gate names are namespaced per fault tree as FT<ftid>-G<gateid> because SAPHIRE reuses gate ids across fault trees. A system with no logic, which SAPHIRE writes with an empty gate list so that its top gate is never defined, has no fault tree at all: it is quantified from its placeholder event, and the functional event refers to that event directly.


<a href="../../../../../apps/utilities/pracciolini/src/jsinp.py#L57"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

<kbd>function</kbd> read

python
read(path: 'str', black_box: 'list[str] | None' = None) → bytes

Read a JSInp file and return canonical PBF bytes.

black_box names systems whose fault tree must not be expanded, so that the system is quantified from its placeholder event instead. SAPHSOLVE does this for some systems whose trees are fully present in the file, and nothing in the file marks them, so the caller has to name them.


<a href="../../../../../apps/utilities/pracciolini/src/jsinp.py#L218"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

<kbd>function</kbd> write

python
write(data: 'bytes', path: 'str', cutoff: 'float' = 1e-12) → bool