Skip to content

Commit

Permalink
QART->QREF rename
Browse files Browse the repository at this point in the history
  • Loading branch information
mstechly committed Apr 23, 2024
1 parent 3240e66 commit 6fb5d37
Show file tree
Hide file tree
Showing 14 changed files with 79 additions and 79 deletions.
42 changes: 21 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
# QART
Quantum Algorithms Represented Topologically (QART) is an open format for representing
# QREF
Quantum Resource Estimation Format (QREF) is an open format for representing
quantum algorithms, optimized for usage in quantum resource estimation (QRE).

QART comprises:
QREF comprises:

- Definition of data format, formalized as a JSON schema.
- A Python library for validation of quantum programs written in QART format using [Pydantic](https://docs.pydantic.dev/).
- Rudimentary visualization tool `qart-render`.
- A Python library for validation of quantum programs written in QREF format using [Pydantic](https://docs.pydantic.dev/).
- Rudimentary visualization tool `qref-render`.

## Installation

Using QART data format does not require installation - you can easily write quantum
Using QREF data format does not require installation - you can easily write quantum
programs in YAML or JSON.

To install QART Python package, clone this repository and install it as usual with `pip`:
To install QREF Python package, clone this repository and install it as usual with `pip`:

```bash
# Clone QART repo (you can use HTTP link as well)
git clone [email protected]:PsiQ/qart.git
cd qart
# Clone QREF repo (you can use HTTP link as well)
git clone [email protected]:PsiQ/qref.git
cd qref
pip install .
```

## QART format
## QREF format

QART format represents quantum programs as a hierarchical directed acyclic graphs (DAGs).
QREF format represents quantum programs as a hierarchical directed acyclic graphs (DAGs).
That's a mouthful, so let us unpack what it means:

- *hierarchical*: each node can contain subgraphs, i.e. routines can be nested inside
Expand All @@ -36,7 +36,7 @@ Consider the following hierarchical DAG of a hypothetical quantum program:

![program example](example_routine.svg)

It can be succinctly written in QART format as:
It can be succinctly written in QREF format as:


```yaml
Expand Down Expand Up @@ -103,18 +103,18 @@ program:
```
For full description of QART format, check our [docs](https://example.com).
For full description of QREF format, check our [docs](https://example.com).
## Using QART package
## Using QREF package
### Using JSON schema for validating data in QART format
### Using JSON schema for validating data in QREF format
JSON schema for QART format can be obtained by calling `generate_program_schema` function.
JSON schema for QREF format can be obtained by calling `generate_program_schema` function.
Such schema can be then used for validating user's input, e.g. using `jsonschema` package:

```python
from jsonschema import validate
from qart import generate_program_schema
from qref import generate_program_schema
# Hypothetical function loading your data as native Python dictionary.
data = load_some_program()
Expand All @@ -126,12 +126,12 @@ validate(schema, data)

### Validation using Pydantic models

If you are familiar with Pydantic, you might find it easier to work with QART Pydantic
If you are familiar with Pydantic, you might find it easier to work with QREF Pydantic
models instead of interacting with JSON schema directly. In the example below, we create
an instance of `SchemaV1` model from validated data stored in QART format:
an instance of `SchemaV1` model from validated data stored in QREF format:

```python
from qart import SchemaV1
from qref import SchemaV1
data = load_some_program()
Expand Down
4 changes: 2 additions & 2 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Setting up development environment

QART uses [Poetry](https://python-poetry.org/) for managing dependencies.
QREF uses [Poetry](https://python-poetry.org/) for managing dependencies.
Therefore, we recommend you use Poetry to setup your environment. However,
if you insist on not using Poetry, the more traditional way of using
editable install with `pip` is still avaiable.
Expand Down Expand Up @@ -31,7 +31,7 @@ pip install -e .

!!! Warning

If you are planning to add/modify dependencies of QART, we
If you are planning to add/modify dependencies of QREF, we
highly recommend you use Poetry instead of pip editable install.
Without Poetry, you will need to edit dependencies manually,
which is very error-prone.
18 changes: 9 additions & 9 deletions docs/format.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Data format

## Introduction
QART format is a domain-specific language (DSL) for describing quantum algorithms
QREF format is a domain-specific language (DSL) for describing quantum algorithms
built on top of JSON for the purpose of resource estimation.

In QART, the algorithms are described as programs comprising hierarchical, directed
In QREF, the algorithms are described as programs comprising hierarchical, directed
acyclic graph (henceforth hierarchical DAGs) of subroutines. Let's break down
what this means:

Expand All @@ -14,7 +14,7 @@ what this means:
- *Acyclic* means that traversing the graph along its edges (respecting their direction)
will never lead to visiting the same node twice.

Besides specifying the connectivity between routines in the algorithms, the QART format
Besides specifying the connectivity between routines in the algorithms, the QREF format
also specifies how to store information relevant to resource estimation, such as
known and unknown resources, parameters that might affect them and how the parameters
propagate in the algorithm's graph.
Expand All @@ -23,8 +23,8 @@ Before describing the format in detail, let us first exemplify its usage on a si

## Basic example

In QART, the quantum programs are represented as graphs. If you are not used to
representing computations as graph, don't worry! Before describing QART format,
In QREF, the quantum programs are represented as graphs. If you are not used to
representing computations as graph, don't worry! Before describing QREF format,
we'll demostrate how a simple circuit can be represented as a graph.

Consider a hypothetical quantum program as depicted in the following circuit.
Expand All @@ -48,8 +48,8 @@ As we can see, the graph contains both subroutines form the original circuit,
and an artificially introduced `merge` operation used to combine outputs
from the subprograms into one final outputs.

Now that we have our graph, let's see how it can be represented in QART format.
As already mentioned, QART format is built on top of JSON, so we can write QART
Now that we have our graph, let's see how it can be represented in QREF format.
As already mentioned, QREF format is built on top of JSON, so we can write QREF
files in either JSON or YAML. For our examples, those might look as follows:

=== "YAML"
Expand Down Expand Up @@ -84,10 +84,10 @@ Let us first take a look at ports, like the first input port of our program:
{direction: input, name: in_0, size: 1}
```

Ports, like most other components in QART, have names, which should be distinct
Ports, like most other components in QREF, have names, which should be distinct
among all ports of any given program (or subroutine). Each port also has
direction, which can be either `input` or `output`. Finally, each port has size.
In our simple scenario, all sizes are positive integers. However, QART
In our simple scenario, all sizes are positive integers. However, QREF
is not limited to them, and size of a port can be either:

- A positive integer.
Expand Down
16 changes: 8 additions & 8 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# QART
# QREF

Quantum Algorithms Represented Topologically (QART) is an open format for representing
Quantum Resource Estimation Format (QREF) is an open format for representing
quantum algorithms, optimized for usage in quantum resource estimation (QRE).

<div class="grid cards" markdown>
Expand All @@ -9,7 +9,7 @@ quantum algorithms, optimized for usage in quantum resource estimation (QRE).

---

QART's data format is built on top of JSON, which makes it easy to
QREF's data format is built on top of JSON, which makes it easy to
write and read.

[:octicons-arrow-right-24: Learn more](format)
Expand All @@ -18,14 +18,14 @@ quantum algorithms, optimized for usage in quantum resource estimation (QRE).

---

QART's JSON schema can be used for data validation in any language.
QREF's JSON schema can be used for data validation in any language.

- :material-language-python:{ .lg .middle } __Python library__

---

QART's Python package provides programmatic access
to QART's JSON schema and ready-to-use Pydantic models.
QREF's Python package provides programmatic access
to QREF's JSON schema and ready-to-use Pydantic models.


[:octicons-arrow-right-24: See user guide](library/userguide)
Expand All @@ -34,8 +34,8 @@ quantum algorithms, optimized for usage in quantum resource estimation (QRE).

---

QART is licensed under the MIT license and lives on GitHub.
QREF is licensed under the MIT license and lives on GitHub.

[:octicons-arrow-right-24: See QART on GH](https://github.com/psiq/hqar)
[:octicons-arrow-right-24: See QREF on GH](https://github.com/psiq/hqar)

</div>
2 changes: 1 addition & 1 deletion docs/library/reference/qart.experimental.rendering.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

::: qart.experimental.rendering
::: qref.experimental.rendering
handler: python
2 changes: 1 addition & 1 deletion docs/library/reference/qart.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
::: qart
::: qref
handler: python
options:
members:
Expand Down
38 changes: 19 additions & 19 deletions docs/library/userguide.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

## Installation

To install QART Python package, clone QARt repository and install it as usual with `pip`:
To install QREF Python package, clone QREF repository and install it as usual with `pip`:

```bash
# Clone QART repo (you can use HTTP link as well)
git clone [email protected]:PsiQ/qart.git
cd qart
# Clone QREF repo (you can use HTTP link as well)
git clone [email protected]:PsiQ/qref.git
cd qref
pip install .
```

Expand All @@ -17,16 +17,16 @@ installation.
## Usage


### Using JSON schema for validating data in QART format
### Using JSON schema for validating data in QREF format

JSON schema for QART format can be obtained by calling
[`generate_program_schema`][qart.generate_program_schema] function.
JSON schema for QREF format can be obtained by calling
[`generate_program_schema`][qref.generate_program_schema] function.
Such schema can be then used for validating user's input, e.g. using
[`jsonschema`](https://pypi.org/project/jsonschema/) package:

```python
from jsonschema import validate
from qart import generate_program_schema
from qref import generate_program_schema

# Hypothetical function loading your data as native Python dictionary.
data = load_some_program()
Expand All @@ -39,40 +39,40 @@ validate(schema, data)
### Validation using Pydantic models

If you are familiar with [Pydantic](https://docs.pydantic.dev/latest/), you might find
it easier to work with QART Pydantic models instead of interacting with JSON schema directly.
In the example below, we create an instance of [`SchemaV1`][qart.SchemaV1] model from
validated data stored in QART format:
it easier to work with QREF Pydantic models instead of interacting with JSON schema directly.
In the example below, we create an instance of [`SchemaV1`][qref.SchemaV1] model from
validated data stored in QREF format:

```python
from qart import SchemaV1
from qref import SchemaV1

data = load_some_program()

# This will raise if data is not valid
program = SchemaV1.model_validate(data)
```

### Rendering QART files using `qart-render` (experimental)
### Rendering QREF files using `qref-render` (experimental)

!!! Warning

This feature is considered experimental and may occassionally produce
incorrect results.


QART comes with a CLI tool for rendering hierarchical graphs of quantum
QREF comes with a CLI tool for rendering hierarchical graphs of quantum
algorithms. To render an algorithm stored in a file named `my_program.yaml` into a
file `my_program_graph.svg` run:

```bash
qart-render my_program.yaml my_program_graph.svg
qref-render my_program.yaml my_program_graph.svg
```

The `qart-render` tool supports `yaml` and `json` input formats, and all
The `qref-render` tool supports `yaml` and `json` input formats, and all
output formats supported by [graphviz](https://graphviz.org/).

If, instead of using CLI, you'd like to invoke QART's rendering capabilities
from Python script, you can look at [qart.experimental.rendering][qart.experimental.rendering]
module which exposes experimental API for performing the same task as `qart-render`.
If, instead of using CLI, you'd like to invoke QREF's rendering capabilities
from Python script, you can look at [qref.experimental.rendering][qref.experimental.rendering]
module which exposes experimental API for performing the same task as `qref-render`.


14 changes: 7 additions & 7 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# yaml-language-server: $schema=https://squidfunk.github.io/mkdocs-material/schema.json
site_name: QART
site_description: Quantum Algorithms Represented Topologically
site_name: QREF
site_description: Quantum Resource Estimation Format
site_author: PsiQuantum Corp.
copyright: Copyright © 2023-2024 PsiQuantum Corp.
repo_url: https://github.com/psiq/qart
repo_url: https://github.com/psiq/qref
nav:
- format.md
- Python Library:
- library/userguide.md
- API Reference:
- qart: library/reference/qart.md
- qart.experimental.rendering: library/reference/qart.experimental.rendering.md
- library/userguide.md
- API Reference:
- qref: library/reference/qref.md
- qref.experimental.rendering: library/reference/qref.experimental.rendering.md
- development.md
theme:
name: material
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.poetry]
name = "qart"
name = "qref"
version = "0.1.0"
description = "Quantum Algorithms, Represented Topologically"
description = "Quantum Resource Estimation Format"
authors = ["PsiQuantum"]
license = "MIT"
readme = "README.md"
Expand Down Expand Up @@ -30,7 +30,7 @@ mkdocs-open-in-new-tab = "^1.0.3"
mkdocstrings = {version = "^0.24.2", extras = ["python"]}

[tool.poetry.scripts]
qart-render = "qart.experimental.rendering:render_entry_point"
qref-render = "qref.experimental.rendering:render_entry_point"


[build-system]
Expand Down
2 changes: 1 addition & 1 deletion src/qart/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Public API of QART."""
"""Public API of QREF."""

from typing import Any

Expand Down
2 changes: 1 addition & 1 deletion src/qart/experimental/rendering.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Experimental visualization capabilities for QART.
"""Experimental visualization capabilities for QREF.
Currently, the visualizations are done with graphviz, which does not suport
hierarchical structures. Therefore, we have to use a somewhat hacky representation
Expand Down
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""Common fixtures for QART tests."""
"""Common fixtures for QREF tests."""

from pathlib import Path

import pytest
import yaml

VALID_PROGRAMS_ROOT_PATH = Path(__file__).parent / "qart/data/valid_programs"
VALID_PROGRAMS_ROOT_PATH = Path(__file__).parent / "qref/data/valid_programs"


def _load_valid_examples():
Expand Down
Loading

0 comments on commit 6fb5d37

Please sign in to comment.