Skip to main content

geqie

Core quantum image encoding library.

Table of contents

API

Quick start

import numpy as np
from PIL import Image

import geqie
from geqie.encodings import frqi

image = np.asarray(Image.open("assets/test_images/grayscale/test_image_4x4.png"))

circuit = geqie.encode(frqi.init_function, frqi.data_function, frqi.map_function, image)
counts = geqie.simulate(circuit, n_shots=1024)
reconstructed = geqie.retrieve(frqi.retrieve_function, counts)

Encodings

Each encoding lives in geqie.encodings.<name> (e.g., frqi, neqr, mcqi) and exposes:

Function Signature Returns Description
init_function (n_qubits, **encoding_params) Statevector Initial state of the circuit
data_function (*coords, R, image, **encoding_params) Statevector Data (pixel position) state for the given pixel
map_function (*coords, R, image, **encoding_params) Operator Map (pixel value) operator for the given pixel
retrieve_function (results, **encoding_params) np.ndarray Reconstructs the image from measurement counts

coords are pixel indices (e.g., u, v for 2D images) and R = ceil(log2(max(image.shape))). Custom encodings can be created by providing your own functions with the same signatures.

geqie.encode

Builds a quantum circuit encoding the image using the provided encoding functions.

geqie.encode(
    init_function, data_function, map_function, image,
    image_dimensionality=2,
    perform_measurement=True,
    logging_level=None,
    encoding_params={},
) -> QuantumCircuit
Parameter Description
init_function Function returning the initial Statevector
data_function Function returning the data Statevector for a pixel
map_function Function returning the map Operator for a pixel
image Image as a NumPy array
image_dimensionality Number of leading image axes treated as spatial coordinates (rest are e.g. channels)
perform_measurement Append measurement of all qubits to the circuit
logging_level Logging level (see geqie.logging_utils.levels)
encoding_params Extra keyword arguments passed to the encoding functions (e.g., {"bitrate": 4})

geqie.simulate

Simulates the circuit locally with Qiskit Aer.

geqie.simulate(
    circuit, n_shots,
    return_qiskit_result=False,
    return_padded_counts=False,
    device="CPU",
    method="automatic",
    noise_model=None,
    logging_level=None,
) -> dict[str, int] | qiskit.result.Result
Parameter Description
circuit Circuit returned by geqie.encode
n_shots Number of simulation shots
return_qiskit_result Return the raw Qiskit Result instead of counts
return_padded_counts Include zero-count states in the returned counts
device Aer simulator device ("CPU" or "GPU")
method Aer simulation method (e.g., "automatic", "statevector")
noise_model Optional qiskit_aer.noise.NoiseModel
logging_level Logging level

geqie.execute

Executes the circuit on real hardware via IBM Quantum Platform (Qiskit Runtime SamplerV2).

geqie.execute(
    circuit, n_shots,
    circuit_param_values={},
    return_qiskit_result=False,
    return_padded_counts=False,
    dry_run=False,
    api_token="",
    instance_crn="",
    credentials_name="",
    backend="",
    channel="ibm_quantum_platform",
    ibm_qp_runtime_args={},
    transpiler_args={},
    logging_level=None,
) -> dict[str, int] | PrimitiveResult | None
Parameter Description
circuit Circuit returned by geqie.encode
n_shots Number of shots
circuit_param_values Values for parametrized circuits
return_qiskit_result Return the raw Qiskit Runtime result instead of counts
return_padded_counts Include zero-count states in the returned counts
dry_run Set up the backend and transpile, but don't submit the job (returns None)
api_token IBM Quantum API token (used with instance_crn)
instance_crn IBM Quantum instance CRN
credentials_name Name of saved QiskitRuntimeService credentials (alternative to api_token)
backend Backend name; if empty, the least busy backend with enough qubits is selected
channel Qiskit Runtime channel
ibm_qp_runtime_args Extra keyword arguments for QiskitRuntimeService
transpiler_args Extra keyword arguments for qiskit.transpile
logging_level Logging level

Example

counts = geqie.execute(circuit, n_shots=1024, credentials_name="my-ibm-credentials")

geqie.retrieve

Reconstructs the image from measurement counts using the encoding's retrieve function.

geqie.retrieve(
    retrieve_function, results,
    image_dimensionality=2,
    encoding_params={},
) -> np.ndarray
Parameter Description
retrieve_function Encoding's retrieve_function (e.g., frqi.retrieve_function)
results Measurement counts returned by geqie.simulate or geqie.execute
image_dimensionality Number of spatial image dimensions (used by encodings that support it, e.g. mfrqi)
encoding_params Extra keyword arguments passed to the retrieve function (e.g., {"bitrate": 4})

Examples

See the examples/ directory for notebooks covering individual encodings and CLI workflows.

CLI

geqie list-encodings

geqie list-encodings

geqie simulate

Usage: geqie simulate [OPTIONS]

Options:
  --encoding TEXT                 Name of the encoding from 'encodings'
                                  directory  [required]
  --image-path TEXT               Path to the image file  [required]
  --image-dimensionality INTEGER  Number of image dimensions to consider
                                  [default: 2]
  --bitrate INTEGER               Number of color bits for encodings that
                                  support it  [default: 8]
  --verbosity-level TEXT          Set verbosity level, 0-6 (higher means more
                                  verbose)
  --n-shots INTEGER               Number of simulation shots
  --return-qiskit-result BOOLEAN  Return results directly from qiskit
                                  [default: False]
  --return-padded-counts BOOLEAN  Return state counts including zero-count
                                  states  [default: False]
  --output-path TEXT              Path to where the results will be written
  -e, --encoding-params KEY=VALUE
                                  Arbitrary extra parameters as key=value
                                  pairs. May be repeated, e.g.,
                                  -e bitrate=4 -e custom_flag=true
  --help                          Show this message and exit.

Example

geqie simulate --encoding frqi --image-path assets/test_image.png --n-shots 1024 --return-padded-counts true

geqie execute

Usage: geqie execute [OPTIONS]

Options:
  --encoding TEXT                 Name of the encoding from 'encodings'
                                  directory  [required]
  --image-path TEXT               Path to the image file  [required]
  --image-dimensionality INTEGER  Number of image dimensions to consider
                                  [default: 2]
  --bitrate INTEGER               Number of color bits for encodings that
                                  support it  [default: 8]
  --verbosity-level TEXT          Set verbosity level, 0-6 (higher means more
                                  verbose)
  --n-shots INTEGER               Number of simulation shots
  --return-qiskit-result BOOLEAN  Return results directly from qiskit
                                  [default: False]
  --return-padded-counts BOOLEAN  Return state counts including zero-count
                                  states  [default: False]
  --output-path TEXT              Path to where the results will be written
  -e, --encoding-params KEY=VALUE
                                  Arbitrary extra parameters as key=value
                                  pairs. May be repeated, e.g.,
                                  -e bitrate=4 -e custom_flag=true
  --help                          Show this message and exit.

Example

geqie execute --encoding frqi --image-path assets/test_image.png --n-shots 1024

Metadata

Release files for geqie 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for geqie 1.0.0
File Size Uploaded Provenance Actions
geqie-1.0.0.tar.gz 22.0 kB With provenance Details for geqie-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for geqie 1.0.0
File Interpreter ABI Platform Actions
geqie-1.0.0-py3-none-any.whl Python 3 none any Details for geqie-1.0.0-py3-none-any.whl

Total release size: 55.8 kB

Release files / geqie-1.0.0.tar.gz

Download URL geqie-1.0.0.tar.gz
Size 22.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e07e0098ad9c0a452f9bffd512a2378f0c7445c26d1076bd21f2b2e03e706ab6
BLAKE2b-256 checksum
How to use checksums
e6cea0ef498736110dade079de9b1861d65b2857b985d4ca3dff1814e422e2ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

Release files / geqie-1.0.0-py3-none-any.whl

Download URL geqie-1.0.0-py3-none-any.whl
Size 33.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d112d76368422a7ce3e3737c0fbc24f3ecca1f6d3ccf65481a4c71bf3fb3d935
BLAKE2b-256 checksum
How to use checksums
0c64c414303ee0c9a00420dcc503a8891748b91e9c19a1c7a9b079e945a05621
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

Security for geqie 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for geqie-1.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page