> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dataerai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# QICK

> Automatically capture the provenance of quantum-control experiments — configuration, raw data, and analysis — as linked Dataerai assets.

[QICK](https://github.com/openquantumhardware/qick) (Quantum Instrumentation Control Kit) is an open-source RFSoC-based qubit controller. The **`qick_dataerai`** package — distributed in a Dataerai-enabled build of QICK — connects a QICK experiment to Dataerai: when a program runs, it uploads the experiment **configuration**, the **raw acquired IQ data**, and any **analysis** outputs as Dataerai assets, linked by typed [provenance relationships](/organize/provenance).

The result is a verifiable lineage for every measurement — *configuration → raw data → analysis* — so any result can be traced back to the exact configuration and raw data that produced it.

## How it captures provenance

Each run creates assets and links them with directed relationships (the edge points from the *derived* asset to its *origin*):

* `raw_data`  `--acquired_with-->`  `config`
* `analysis`  `--analysis_of-->`  `raw_data`

Every asset in a run also shares a `run_id` — stored in its metadata and as a `qick-run:<id>` tag — and is tagged `qick-dataerai`, so you can find one run, or every QICK run, by [searching](/discover/search) for the tag.

## Install

<Steps>
  <Step title="Install QICK with the Dataerai integration">
    Install the Dataerai-enabled build of QICK, which adds the `qick_dataerai` package on top of QICK:

    ```bash theme={null}
    pip install "qick[dataerai]"
    ```

    This pulls the [Python SDK](/sdks/python) and matplotlib alongside QICK. If your QICK build doesn't expose the `dataerai` extra, install the [Python SDK](/sdks/python) and matplotlib yourself, then add `qick_dataerai` from the Dataerai-enabled QICK distribution.
  </Step>

  <Step title="Install the Dataerai binary and sign in">
    The SDK drives the local `dataerai` daemon. Install the [CLI](/cli/overview) (which bundles the binary) and sign in:

    ```bash theme={null}
    pip install dataerai-cli
    dataerai auth login
    ```
  </Step>
</Steps>

## Capture a run

The one-call helper captures a configuration, an acquisition, and an analysis figure, wiring all the provenance edges:

<CodeGroup>
  ```python One call theme={null}
  import matplotlib.pyplot as plt
  from dataerai import DataeraiClient
  from qick_dataerai import capture_run

  prog = MySweepProgram(soccfg, config)
  expt_pts, avg_i, avg_q = prog.acquire(soc, progress=True)
  plt.plot(expt_pts, avg_i[0])

  with DataeraiClient(binary_path="/usr/local/bin/dataerai") as client:
      result = capture_run(
          client, prog.cfg, (expt_pts, avg_i, avg_q),
          owner_type="user", owner_id=client.auth_status().user_email,
          soccfg=soccfg, prog=prog,
          fig=plt.gcf(), analysis_mode="non_destructive",
      )
  print(result.run_id, result.relationship_ids)
  ```

  ```python Step by step theme={null}
  from dataerai import DataeraiClient
  from qick_dataerai import ProvenanceRun

  with DataeraiClient(binary_path="/usr/local/bin/dataerai") as client:
      with ProvenanceRun(client, owner_type="user",
                         owner_id=client.auth_status().user_email,
                         title_prefix="T1 measurement") as run:
          run.log_config(prog.cfg, soccfg=soccfg, prog=prog)

          expt_pts, avg_i, avg_q = prog.acquire(soc, progress=True)
          run.log_acquisition(prog, (expt_pts, avg_i, avg_q))

          # ... fit / plot ...
          run.log_analysis(plt.gcf(), analysis_mode="non_destructive")

      print(run.result.run_id)
  ```
</CodeGroup>

## What gets stored

| Asset        | Content      | Notes                                                                                       |
| ------------ | ------------ | ------------------------------------------------------------------------------------------- |
| **config**   | JSON         | The QICK `cfg`, the hardware `soccfg`, and the program's `dump_prog()` (ASM + pulse state). |
| **raw data** | `.npz`       | The `acquire()` / `acquire_decimated()` output, normalized to per-channel IQ arrays.        |
| **analysis** | PNG / `.npz` | A matplotlib figure and/or a dict of derived arrays.                                        |

The `analysis_mode` on an analysis link records how the measurement affected the sample (`non_destructive`, `altering`, `destructive`, `in_situ`, `ex_situ`, `invasive`, `non_invasive`).

<Note>
  Provenance capture is **best-effort** by default: if an upload or link fails, the run records the error and continues, so it never crashes your experiment. Pass `on_error="fail_fast"` to raise instead.
</Note>

## Under the hood

`qick_dataerai` is a thin layer over the [Python SDK](/sdks/python): it `upload()`s each artifact and calls [`create_relationship`](/sdks/python#provenance-relationships) to wire the edges. You can build the same provenance graphs for any other instrument or pipeline with those two calls.

## Next steps

<CardGroup cols={2}>
  <Card title="Python SDK" icon="code" href="/sdks/python">
    The `upload` and `create_relationship` methods this builds on.
  </Card>

  <Card title="Provenance & relationships" icon="share-2" href="/organize/provenance">
    The lineage model behind the links.
  </Card>
</CardGroup>
