Metadata-Version: 2.4
Name: dyber
Version: 0.1.0
Summary: Dyber SDK: interact with the H-cat photonic quantum computer (simulator now, QPU later)
Author: Dyber, Inc.
License: Apache-2.0
Project-URL: Homepage, https://quantaforge.dyber.org
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Physics
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Provides-Extra: physics
Requires-Dist: dyberforge; extra == "physics"
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Dynamic: license-file

# Dyber SDK

Interact with the H-cat photonic quantum computer. Write a circuit once and run it on the
local simulator today and on the H-cat QPU later, with no change to your code. This is the
control interface, designed so that when the hardware exists, only the backend transport
changes.

## Install

```bash
pip install numpy
pip install -e .            # from sdk/
# optional: physics-grade resource and noise models
pip install -e ../forge/sdk    # dyberforge
```

## Hello, H-cat

```python
from dyber import Dyber, Circuit

dy = Dyber()
print(dy.backends())                 # local_simulator (online), hcat_qpu (offline)

c = Circuit(2, "bell")
c.h(0); c.cx(0, 1); c.measure_all()

job = dy.backend("local_simulator").run(c, shots=1000)
res = job.result()
print(res.counts())                  # {'00': ~500, '11': ~500}
print(res.resources)                 # distance, cats per logical, hw modes per logical
print(res.noise)                     # physics-informed noise summary (if enabled)
```

## Run it over the network (the real QPU path)

```bash
python -m dyber.server               # reference control plane on 127.0.0.1:8787
```
```python
backend = dy.backend("remote", url="http://127.0.0.1:8787")
job = backend.run(c, shots=1000)     # same protocol the hardware will use
```

The `hcat_qpu` backend points at the production control plane and is offline until the
hardware exists. The moment it is online, `dy.backend("hcat_qpu").run(c)` runs on silicon.

## How it is layered

| Layer | Module | Role |
|---|---|---|
| Circuit | `circuit.py` | gate-model program you write |
| Lowering | `native.py` | maps gates to native H-cat ops (cat prep, hybrid fusion, parity readout); the real lowering is OpenForge |
| Simulator | `simulator.py` | exact statevector run, plus physics-informed noise from the resource model |
| Backends | `backend.py` | local simulator, remote (HTTP), and the hcat_qpu hardware backend, one interface |
| Protocol | `protocol.py` | the JSON job format shared by SDK and control plane |
| Control plane | `server.py` | reference server: today runs the simulator, later fronts the FPGA control system |

## Notes

- The simulator is exact for up to 14 qubits. Noise is a planning-grade estimate calibrated
  to the validated H-cat loss and resource models, not a full physical simulation.
- Resource estimates use the v2 calibration (June 2026 circuit-level validation campaign):
  corrected loss threshold 0.79 percent per cycle (0.898 percent uncorrected option), spec
  operating point 0.5 percent per cycle (d=53, 5,617 cats per logical at 1e-9, 239.5
  attempts per cat). At or above the threshold the resource report honestly returns the
  above-threshold regime (no fault-tolerant distance) with a NISQ fallback estimate.
- Proprietary components (the OpenForge compiler passes, calibration, foundry recipes) are
  not part of this SDK. The native lowering here is illustrative.
- Style: no em-dashes; commas, colons, periods, and hyphens for ranges.
