rigetti / pyquil

A Python library for quantum programming using Quil.
http://docs.rigetti.com
Apache License 2.0
1.39k stars 341 forks source link

Check for existing DefMeasureCalibration before adding #1751

Open steve-jeffrey opened 4 months ago

steve-jeffrey commented 4 months ago

Pre-Request Checklist

Issue Description

When adding new Calibrations to a Program, the code checks if the Calibration already exists, and if so, it only adds the new Calibration if it differs from the existing Calibration.

When adding new DefMeasureCalibrations to a Program, the code adds the new DefMeasureCalibration and issues a warning that the DefMeasureCalibration already exists. It would be nice if the code checked if an existing DefMeasureCalibration already existed and only add the new DefMeasureCalibration if it differs from the existing DefMeasureCalibration i.e. it would be nice if it behaved the same way Calibrations are added, thereby avoiding unnecessary warnings.

Proposed Solution

Change this else statement to something like this:

elif existing_measure_calibration.instructions != defmeasure.instructions: