124 lines
4.8 KiB
Plaintext
124 lines
4.8 KiB
Plaintext
---
|
||
title: ExecutionSpan (v0.33)
|
||
description: API reference for qiskit_ibm_runtime.execution_span.ExecutionSpan in qiskit-ibm-runtime v0.33
|
||
in_page_toc_min_heading_level: 1
|
||
python_api_type: class
|
||
python_api_name: qiskit_ibm_runtime.execution_span.ExecutionSpan
|
||
---
|
||
|
||
# ExecutionSpan
|
||
|
||
<Class id="qiskit_ibm_runtime.execution_span.ExecutionSpan" isDedicatedPage={true} github="https://github.com/Qiskit/qiskit-ibm-runtime/tree/stable/0.33/qiskit_ibm_runtime/execution_span/execution_span.py#L31-L137" signature="ExecutionSpan(start, stop)" modifiers="class">
|
||
Bases: `ABC`
|
||
|
||
Abstract parent for classes that store an execution time span for a subset of job data.
|
||
|
||
A pub is said to have dependence on an execution span if the corresponding execution includes data that forms any part of the pub’s results.
|
||
|
||
Execution spans are equality checkable, and they implement a comparison operator based on the tuple `(start, stop)`, so can be sorted.
|
||
|
||
**Parameters**
|
||
|
||
* **start** (*datetime*) – The start time of the span, in UTC.
|
||
* **stop** (*datetime*) – The stop time of the span, in UTC.
|
||
|
||
## Attributes
|
||
|
||
### duration
|
||
|
||
<Attribute id="qiskit_ibm_runtime.execution_span.ExecutionSpan.duration">
|
||
The duration of this span, in seconds.
|
||
</Attribute>
|
||
|
||
### pub\_idxs
|
||
|
||
<Attribute id="qiskit_ibm_runtime.execution_span.ExecutionSpan.pub_idxs">
|
||
Which pubs, by index, have dependence on this execution span.
|
||
</Attribute>
|
||
|
||
### size
|
||
|
||
<Attribute id="qiskit_ibm_runtime.execution_span.ExecutionSpan.size">
|
||
The total number of results with dependence on this execution span, across all pubs.
|
||
|
||
This attribute is equivalent to the sum of the elements of all present [`mask()`](#qiskit_ibm_runtime.execution_span.ExecutionSpan.mask "qiskit_ibm_runtime.execution_span.ExecutionSpan.mask")s. For sampler results, it represents the total number of shots with dependence on this execution span.
|
||
|
||
Combine this attribute with [`filter_by_pub()`](#qiskit_ibm_runtime.execution_span.ExecutionSpan.filter_by_pub "qiskit_ibm_runtime.execution_span.ExecutionSpan.filter_by_pub") to find the size of some particular pub:
|
||
|
||
```python
|
||
span.filter_by_pub(2).size
|
||
```
|
||
</Attribute>
|
||
|
||
### start
|
||
|
||
<Attribute id="qiskit_ibm_runtime.execution_span.ExecutionSpan.start">
|
||
The start time of the span, in UTC.
|
||
</Attribute>
|
||
|
||
### stop
|
||
|
||
<Attribute id="qiskit_ibm_runtime.execution_span.ExecutionSpan.stop">
|
||
The stop time of the span, in UTC.
|
||
</Attribute>
|
||
|
||
## Methods
|
||
|
||
### contains\_pub
|
||
|
||
<Function id="qiskit_ibm_runtime.execution_span.ExecutionSpan.contains_pub" github="https://github.com/Qiskit/qiskit-ibm-runtime/tree/stable/0.33/qiskit_ibm_runtime/execution_span/execution_span.py#L112-L122" signature="contains_pub(pub_idx)">
|
||
Return whether the pub with the given index has data with dependence on this span.
|
||
|
||
**Parameters**
|
||
|
||
**pub\_idx** (*int | Iterable\[int]*) – One or more pub indices from the original primitive call.
|
||
|
||
**Returns**
|
||
|
||
Whether there is dependence on this span.
|
||
|
||
**Return type**
|
||
|
||
bool
|
||
</Function>
|
||
|
||
### filter\_by\_pub
|
||
|
||
<Function id="qiskit_ibm_runtime.execution_span.ExecutionSpan.filter_by_pub" github="https://github.com/Qiskit/qiskit-ibm-runtime/tree/stable/0.33/qiskit_ibm_runtime/execution_span/execution_span.py#L124-L137" signature="filter_by_pub(pub_idx)" modifiers="abstract">
|
||
Return a new span whose slices are filtered to the provided pub indices.
|
||
|
||
For example, if this span contains slice information for pubs with indices 1, 3, 4 and `[1, 4]` is provided, then the span returned by this method will contain slice information for only those two indices, but be identical otherwise.
|
||
|
||
**Parameters**
|
||
|
||
**pub\_idx** (*int | Iterable\[int]*) – One or more pub indices from the original primitive call.
|
||
|
||
**Returns**
|
||
|
||
A new filtered span.
|
||
|
||
**Return type**
|
||
|
||
[ExecutionSpan](#qiskit_ibm_runtime.execution_span.ExecutionSpan "qiskit_ibm_runtime.execution_span.ExecutionSpan")
|
||
</Function>
|
||
|
||
### mask
|
||
|
||
<Function id="qiskit_ibm_runtime.execution_span.ExecutionSpan.mask" github="https://github.com/Qiskit/qiskit-ibm-runtime/tree/stable/0.33/qiskit_ibm_runtime/execution_span/execution_span.py#L101-L110" signature="mask(pub_idx)" modifiers="abstract">
|
||
Return an array-valued mask specifying which parts of a pub result depend on this span.
|
||
|
||
**Parameters**
|
||
|
||
**pub\_idx** (*int*) – The index of the pub to return a mask for.
|
||
|
||
**Returns**
|
||
|
||
An array with the same shape as the pub data.
|
||
|
||
**Return type**
|
||
|
||
[*ndarray*](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray "(in NumPy v2.1)")\[*Any*, [*dtype*](https://numpy.org/doc/stable/reference/generated/numpy.dtype.html#numpy.dtype "(in NumPy v2.1)")\[[*bool*](https://numpy.org/doc/stable/reference/arrays.scalars.html#numpy.bool "(in NumPy v2.1)")]]
|
||
</Function>
|
||
</Class>
|
||
|