quantumlib / Cirq

A Python framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits.
Apache License 2.0
4.24k stars 1.01k forks source link

append unit as metadata to sweeps if present #6636

Closed senecameeks closed 3 months ago

senecameeks commented 3 months ago

It's possible for internal users to pass values with units to the cirq sweep resolver. In order to support this, and so we can resolve the parameter correctly on the server side this PR does two things:

  1. Splices the value and only passes the numerical value as float to cirq.Points which only supports floats.
  2. Saves the unit as metadata in the DeviceParameter proto without setting a path. See https://github.com/qh-lab/pyle/pull/46133 for how this gets resolved server side.
codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 97.81%. Comparing base (543d9cd) to head (f96d8be).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #6636 +/- ## ======================================= Coverage 97.81% 97.81% ======================================= Files 1067 1067 Lines 91550 91564 +14 ======================================= + Hits 89549 89563 +14 Misses 2001 2001 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

senecameeks commented 3 months ago

Thanks for fruitful discussion @maffoo @NoureldinYosri @bichengying , I'm closing this PR in favor of https://github.com/quantumlib/Cirq/pull/6644 which only appends metadata if the object is passed to cirq-google. This moves the responsibility of constructing the metadata to our internal repo instead of in cirq-google.