Metadata-Version: 2.4
Name: deteqt
Version: 0.1.1
Summary: Python client for DeteQT metrology and quantum-chip diagnostics on InfluxDB v2.
Keywords: influxdb,qoi,telemetry,timeseries
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.12
Requires-Dist: influxdb-client<2.0.0,>=1.50.0
Description-Content-Type: text/markdown

# deteqt

Python client for DeteQT metrology and quantum-chip diagnostics on InfluxDB v2.

## Documentation

- [Quickstart](https://deteqt-d9f77a.gitlab.io/)
- [Usage](https://deteqt-d9f77a.gitlab.io/usage/)
- [API reference](https://deteqt-d9f77a.gitlab.io/api/)

## Quick setup

If `uv` is not installed yet on your machine, install it first:

### Linux/macOS

```zsh
curl -LsSf https://astral.sh/uv/install.sh | sh
```

### Windows

```powershell
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
```

## Installing `deteqt` package

```zsh
# Create a virtual environment:
uv venv deteqt-env --python 313

# Activate virtual environment:
source deteqt-env/bin/activate  # Linux/macOS

# Or if you are on Windows:
# .\deteqt-env\Scripts\activate

# Install local editable package with all tool groups:
uv pip install -e . --group all

# Verify installation and version:
uv run --active python -c "import deteqt; print(deteqt.__version__)"
```

## Writing and querying data

To write and query data, first edit `settings.toml` at the project root
with values provided by your administrator:

```toml
url = "your-url-here"
org = "your-org-here"
bucket = "your-bucket-here"
token = "your-token-here"
```

### Write one point to InfluxDB

```python
from deteqt import write_point

write_point(qoi="frequency", value=1.01, uncertainty=0.01)
```

### Write a batch of points

```python
from deteqt import write_batch
my_data = write_batch(
    [
        {"qoi": "frequency", "value": 1.01},
        {"qoi": "phase", "value": 0.12, "uncertainty": 0.01},
    ],
)
```

### Query rows

```python
from deteqt import build_query, query_rows

query = build_query(
    bucket="your-bucket-here",
    measurement="frequency",
    start="-1h",
)

rows = query_rows(
    measurement="frequency",
    start="-1h",
)
```

### Ingest data from a folder recursively, process it, and write to InfluxDB

```python
from deteqt import ingest_data, process_data, write_batch
raw_data = ingest_data(
    folder="quantify-data",
    file_name="quantities_of_interest.json",  # or "quantities.csv"
)

processed_data = process_data(
    raw_data,
    keep_keys=("qoi", "value", "uncertainty", "run_id", "cycle_id"),
)

summary = write_batch(processed_data)
```
