52 lines
1.8 KiB
Plaintext
52 lines
1.8 KiB
Plaintext
---
|
||
title: ResultDecoder (v0.31)
|
||
description: API reference for qiskit.providers.ibmq.runtime.ResultDecoder in qiskit v0.31
|
||
in_page_toc_min_heading_level: 1
|
||
python_api_type: class
|
||
python_api_name: qiskit.providers.ibmq.runtime.ResultDecoder
|
||
---
|
||
|
||
# ResultDecoder
|
||
|
||
<Class id="qiskit.providers.ibmq.runtime.ResultDecoder" isDedicatedPage={true} github="https://github.com/qiskit/qiskit-ibmq-provider/tree/stable/0.17/qiskit/providers/ibmq/runtime/program/result_decoder.py" signature="ResultDecoder" modifiers="class">
|
||
Bases: `object`
|
||
|
||
Runtime job result decoder.
|
||
|
||
You can subclass this class and overwrite the [`decode()`](qiskit.providers.ibmq.runtime.ResultDecoder#decode "qiskit.providers.ibmq.runtime.ResultDecoder.decode") method to create a custom result decoder for the results of your runtime program. For example:
|
||
|
||
```python
|
||
class MyResultDecoder(ResultDecoder):
|
||
|
||
@classmethod
|
||
def decode(cls, data):
|
||
decoded = super().decode(data)
|
||
custom_processing(decoded) # perform custom processing
|
||
```
|
||
|
||
Users of your program will need to pass in the subclass when invoking [`qiskit.providers.ibmq.runtime.RuntimeJob.result()`](qiskit.providers.ibmq.runtime.RuntimeJob#result "qiskit.providers.ibmq.runtime.RuntimeJob.result") or [`qiskit.providers.ibmq.runtime.IBMRuntimeService.run()`](qiskit.providers.ibmq.runtime.IBMRuntimeService#run "qiskit.providers.ibmq.runtime.IBMRuntimeService.run").
|
||
|
||
## Methods
|
||
|
||
<span id="qiskit-providers-ibmq-runtime-resultdecoder-decode" />
|
||
|
||
### decode
|
||
|
||
<Function id="qiskit.providers.ibmq.runtime.ResultDecoder.decode" signature="ResultDecoder.decode(data)" modifiers="classmethod">
|
||
Decode the result data.
|
||
|
||
**Parameters**
|
||
|
||
**data** (`str`) – Result data to be decoded.
|
||
|
||
**Return type**
|
||
|
||
`Any`
|
||
|
||
**Returns**
|
||
|
||
Decoded result data.
|
||
</Function>
|
||
</Class>
|
||
|