Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
MarquessV committed Aug 10, 2023
1 parent 0e8d14e commit c1ed9c7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 7 additions & 5 deletions pyquil/api/_qam.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,13 @@ class QAMExecutionResult:
def raw_readout_data(self) -> Union[QVMResultData, QPUResultData]:
"""
Get the raw result data. This will either be a ``QVMResultData`` or ``QPUResultData``
depending on where you ran the job.
depending on where the job was run.
This property is best used when running programs that use advanced features like
mid-circuit measurement and dynamic control flow on a QPU since they can produce
irregular result shapes that don't necessarily fit in a rectangular matrix.
This property should be used when running programs that use features like
mid-circuit measurement and dynamic control flow on a QPU, since they can
produce irregular result shapes that don't necessarily fit in a
rectangular matrix. If the program was run on a QVM, or doesn't use those
features, consdier using the ``register_map`` property instead.
"""
return self.data.result_data.inner()

Expand All @@ -80,11 +82,11 @@ def register_map(self) -> Mapping[str, Optional[np.ndarray]]:
register_map = self.data.result_data.to_register_map()
return {key: matrix.to_ndarray() for key, matrix in register_map.items()}

@property
@deprecated(
version="4.0.0",
reason="This property is ambiguous now that the `raw_readout_data` property exists and will be removed in future versions. Use `register_map` property instead",
)
@property
def readout_data(self) -> Mapping[str, Optional[np.ndarray]]:
"""Readout data returned from the QAM, keyed on the name of the readout register or post-processing node."""
return self.register_map
Expand Down
12 changes: 5 additions & 7 deletions pyquil/api/_qvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ class QVMExecuteResponse:
executable: Program
data: QVMResultData

def mapping(self) -> Mapping[str, np.ndarray]:
return {key: value.as_ndarray() for key, value in self.data.memory.items()}
@property
def memory(self):
register_map = self.data.to_register_map()
return {key: matrix.to_ndarray() for key, matrix in register_map.items()}


class QVM(QAM[QVMExecuteResponse]):
Expand Down Expand Up @@ -153,11 +155,7 @@ def execute(
options=QVMOptions(timeout_seconds=self.timeout),
)

# result_data = ResultData(result)
# data = ExecutionData(result_data=result_data, duration=None)

# memory = {name: np.asarray(data.inner()) for name, data in result.memory.items()}
return QVMExecuteResponse(executable=executable, data=result) # memory=memory)
return QVMExecuteResponse(executable=executable, data=result)

def get_result(self, execute_response: QVMExecuteResponse) -> QAMExecutionResult:
"""
Expand Down

0 comments on commit c1ed9c7

Please sign in to comment.