Skip to content

Commit

Permalink
don't die if types aren't importable
Browse files Browse the repository at this point in the history
Change-Id: I8804bfdd0c1cde893768a33959d1a91b38109d74
  • Loading branch information
mpharrigan committed May 13, 2022
1 parent 16f720b commit 535f9e0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions recirq/otoc/loschmidt/tilted_square_lattice/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@ def groupby_all_except(df: pd.DataFrame, *, y_cols: Sequence[Any], agg_func: Any


def _results_to_dataframe(
results: ExecutableGroupResult,
func: Callable[[ExecutableResult, QuantumRuntimeConfiguration, SharedRuntimeInfo], Dict]
results: 'ExecutableGroupResult',
func: Callable[['ExecutableResult', 'QuantumRuntimeConfiguration', 'SharedRuntimeInfo'], Dict]
) -> pd.DataFrame:
"""Call a function on each result in an `ExecutableGroupResult` to construct a DataFrame."""
return pd.DataFrame([func(result, results.runtime_configuration, results.shared_runtime_info)
for result in results.executable_results])


def loschmidt_results_to_dataframe(results: ExecutableGroupResult) -> pd.DataFrame:
def loschmidt_results_to_dataframe(results: 'ExecutableGroupResult') -> pd.DataFrame:
"""Process an `ExecutableGroupResult`.
This function performs the data analysis using `to_ground_state_prob` and
Expand All @@ -150,11 +150,11 @@ def loschmidt_results_to_dataframe(results: ExecutableGroupResult) -> pd.DataFra
we do U and/or its inverse.
"""

def _to_record(result: ExecutableResult,
rt_config: QuantumRuntimeConfiguration,
shared_rt_info: SharedRuntimeInfo) -> Dict:
def _to_record(result: 'ExecutableResult',
rt_config: 'QuantumRuntimeConfiguration',
shared_rt_info: 'SharedRuntimeInfo') -> Dict:
success_prob = to_ground_state_prob(result.raw_data)
spec = cast(TiltedSquareLatticeLoschmidtSpec, result.spec)
spec = cast('TiltedSquareLatticeLoschmidtSpec', result.spec)

record = {
'run_id': shared_rt_info.run_id,
Expand Down

0 comments on commit 535f9e0

Please sign in to comment.