You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you run Calibrations.save("json"), if the Calibrations object holds parameters not associated with a schedule (such as drive_freq which gets added when using the FixedFrequencyTransmon gate library), those parameters are not fully reloaded.
Steps to reproduce the problem
fromqiskit_experiments.calibration_managementimportCalibrations, FixedFrequencyTransmonfromqiskit.providers.fake_providerimportFakeArmonkV2library=FixedFrequencyTransmon()
backend=FakeArmonkV2()
cals=Calibrations.from_backend(backend, libraries=[library])
cals.save(file_type="json", overwrite=True, file_prefix="tmp")
loaded=Calibrations.load("tmp.json")
# Works because schedules were reloaded and their parameters were storedloaded.get_parameter_value("amp", (0,), "x")
# Does not work because nothing stored this schedule-free parameterloaded.get_parameter_value("drive_freq", (0,))
What is the expected behavior?
Both get_parameter_value calls succeed. Instead the second one produces:
CalibrationError: 'No parameter for drive_freq and schedule None and qubits (0,). No default value exists.'
Suggested solutions
The first get_parameter_value call succeeds because the schedules were also saved and reloaded and reloading them populates their parameter objects in the Calibrations._parameter_map dictionary. Perhaps the load function should loop through the parameters and add any parameters with schedule of None to the parameter map so that they can be properly loaded.
This issue was first noticed in #1351 when trying to convert the save/load tests from csv to json to reduce deprecation warnings in the tests.
The text was updated successfully, but these errors were encountered:
…es (#1357)
5b6fa06 added support for saving and
loading `Calibrations` objects with a JSON format that preserved
calibrated gate schedules. However, it did not capture and restore the
`Parameter` objects for calibration parameters (like `drive_freq`) which
were not associated with a schedule. This commit adds support for these
parameters by adding an entry to the serialization model that holds a
placeholder `QuantumCircuit` with the parameters attached to placeholder
instructions. `ExperimentEncoder` can serialize `QuantumCircuit` to qpy
and so supports this format. Using a placeholder circuit like this is
the only supported way to serialize `Parameter` objects. An alternative
approach would be to store and retrieve the hidden attributes of the
`Parameter` objects directly.
Closes#1355
Informations
What is the current behavior?
When you run
Calibrations.save("json")
, if theCalibrations
object holds parameters not associated with a schedule (such asdrive_freq
which gets added when using theFixedFrequencyTransmon
gate library), those parameters are not fully reloaded.Steps to reproduce the problem
What is the expected behavior?
Both
get_parameter_value
calls succeed. Instead the second one produces:Suggested solutions
The first
get_parameter_value
call succeeds because the schedules were also saved and reloaded and reloading them populates their parameter objects in theCalibrations._parameter_map
dictionary. Perhaps theload
function should loop through the parameters and add any parameters with schedule ofNone
to the parameter map so that they can be properly loaded.This issue was first noticed in #1351 when trying to convert the save/load tests from csv to json to reduce deprecation warnings in the tests.
The text was updated successfully, but these errors were encountered: