quil-rs 0.37.1

Rust tooling for Quil (Quantum Instruction Language)
Documentation
# This file is automatically generated by pyo3_stub_gen
# ruff: noqa: E501, F401, F403, F405

import builtins
import numpy
import numpy.typing
from quil._quil import waveform
import typing
__all__ = [
    "IqSamples",
    "IqSamplesIter",
    "IqSamplesRevIter",
    "SamplingError",
]

class IqSamples:
    r"""
    The result of sampling a waveform, representing a sequence of IQ value samples.
    """
    @property
    def sample_count(self) -> builtins.int:
        r"""
        The number of samples.  The same as `len`.
        """
    def __contains__(self, value: typing.Any) -> builtins.bool: ...
    @typing.overload
    def __getitem__(self, index: int) -> complex: ...
    @typing.overload
    def __getitem__(self, index: slice[typing.Optional[int]]) -> list[complex]: ...
    @typing.overload
    def __getitem__(self, index: builtins.int | builtins.slice[int | None]) -> builtins.complex | builtins.list[builtins.complex]:
        r"""
        Get the nth sample.
        """
    def __iter__(self) -> IqSamplesIter: ...
    def __len__(self) -> builtins.int:
        r"""
        The number of samples.  The same as `sample_count`.
        """
    def __length_hint__(self) -> builtins.int: ...
    def __repr__(self) -> builtins.str: ...
    def __reversed__(self) -> IqSamplesRevIter: ...
    def count(self, value: typing.Any) -> builtins.int:
        r"""
        Return the number of occurrences of the specified sample.
        
        Part of the `collections.abc.Sequence` interface.
        """
    @typing.overload
    def get(self, index: int) -> typing.Optional[complex]: ...
    @typing.overload
    def get(self, index: slice[typing.Optional[int]]) -> list[complex]: ...
    @typing.overload
    def get(self, index: builtins.int | builtins.slice[int | None]) -> typing.Optional[builtins.complex | builtins.list[builtins.complex]]:
        r"""
        Get the nth sample.  The same as indexing, but returns `None` instead of raising an error if
        the index is out of range.
        """
    def index(self, value: typing.Any, start: builtins.int = 0, stop: typing.Optional[builtins.int] = None) -> builtins.int:
        r"""
        Return the first occurrences of the specified sample.  Raises `ValueError` if the value is
        not present.
        
        Part of the `collections.abc.Sequence` interface.
        """
    def iq_values(self) -> numpy.typing.NDArray[numpy.complex128]:
        r"""
        Convert this sequence of samples into an explicit numpy array.
        
        The length of this array is [`self.sample_count()`][Self::sample_count], and its values are
        given by [`self[_]`][Self::get].
        """
    @typing.final
    class Flat(IqSamples):
        r"""
        A flat waveform, consisting of a single IQ value repeated some number of times.
        
        This is a more optimizable special-case representation for [`IqSamples::Samples(vec![iq;
        sample_count])`][Self::Samples], but is otherwise equivalent.
        """
        __match_args__ = ("iq", "sample_count",)
        @property
        def iq(self) -> builtins.complex: ...
        @property
        def sample_count(self) -> builtins.int: ...
        def __new__(cls, iq: builtins.complex, sample_count: builtins.int) -> IqSamples.Flat: ...
    
    @typing.final
    class Samples(IqSamples):
        r"""
        A literal sequence of IQ samples.
        """
        __match_args__ = ("samples",)
        @property
        def samples(self) -> builtins.list[builtins.complex]: ...
        def __new__(cls, samples: typing.Sequence[builtins.complex]) -> IqSamples.Samples: ...
    

@typing.final
class IqSamplesIter:
    def __iter__(self) -> IqSamplesIter: ...
    def __next__(self) -> builtins.complex: ...
    def __repr__(self) -> builtins.str: ...

@typing.final
class IqSamplesRevIter:
    def __iter__(self) -> IqSamplesRevIter: ...
    def __next__(self) -> builtins.complex: ...
    def __repr__(self) -> builtins.str: ...

class SamplingError(waveform.WaveformError):
    r"""
    Errors that may occur when sampling waveforms.
    """
    ...