Skip to content

Commit

Permalink
Fix documentation and key error in calibration (#2633)
Browse files Browse the repository at this point in the history
* Fix documentation and key error in calibration

- Tried to retrieve historical calibration and it was broken.
- Fixed docs to my understanding and fixed key error.
- Please verify that this is correct now per the API.
- Fix units in documentation.
  • Loading branch information
dstrain115 committed Dec 10, 2019
1 parent da513ac commit 58d7722
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions cirq/google/engine/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,15 +737,16 @@ def get_calibration(self, calibration_name: str) -> calibration.Calibration:
Params:
calibration_name: A string of the form
`<processor name>/calibrations/<ms since epoch>`
`projects/<project_id>/processors/<processor id>`
`/calibrations/<timestamp in seconds since epoch>`
Returns:
A dictionary containing the metadata.
"""
response = self._make_request(
self.service.projects().processors().calibrations().get(
name=calibration_name))
return calibration.Calibration(response['data']['data'])
return calibration.Calibration(response['data'])

def sampler(self, processor_id: Union[str, List[str]],
gate_set: serializable_gate_set.SerializableGateSet
Expand Down
2 changes: 1 addition & 1 deletion cirq/google/engine/engine_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,7 @@ def test_calibration_from_job(build):
},
}
calibrations = service.projects().processors().calibrations()
calibrations.get().execute.return_value = {'data': _CALIBRATION}
calibrations.get().execute.return_value = _CALIBRATION

engine = cg.Engine(project_id='project-id')
job = engine.run_sweep(
Expand Down

0 comments on commit 58d7722

Please sign in to comment.