<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Example Q6
Step1:  We use a pre-existing database containing a channel library and pipeline we have established.
Step2:  Calibrating Mixers
The APS2 requires mixers to upconvert to qubit and cavity frequencies. We must tune the offset of these mixers and the amplitude factors of the quadrature channels to ensure the best possible results. We repeat the definition of the spectrum analyzer here, assuming that the LO driving this instrument is present in the channel library as spec_an_LO.
Step3:  If the plot server and client are open, then the data will be plotted along with fits from the calibration procedure. The calibration procedure automatically knows which digitizer and AWG units are needed in the process. The relevant instrument parameters are updated but not commited to the database. Therefore they may be rolled back if undesirable results are found.
Pulse Calibrations
A simple set of calibrations is performed as follows.
Step4:  Of course this is somewhat repetetive and can be sped up
Step5:  Automatic Tuneup
While we develop algorithms for fully automated tuneup, some segments of the analysis are (primitively) automated as seen below
<ASSISTANT_TASK:>
Python Code:
from QGL import *
from auspex.qubit import *
Explanation: Example Q6: Calibrations
This example notebook shows how to use the pulse calibration framework.
© Raytheon BBN Technologies 2019
End of explanation
cl = ChannelLibrary("my_config")
pl = PipelineManager()
Explanation: We use a pre-existing database containing a channel library and pipeline we have established.
End of explanation
spec_an = cl.new_spectrum_analzyer("SpecAn", "ASRL/dev/ttyACM0::INSTR", cl["spec_an_LO"])
cal = MixerCalibration(q2, spec_an, mixer="measure")
cal.calibrate()
Explanation: Calibrating Mixers
The APS2 requires mixers to upconvert to qubit and cavity frequencies. We must tune the offset of these mixers and the amplitude factors of the quadrature channels to ensure the best possible results. We repeat the definition of the spectrum analyzer here, assuming that the LO driving this instrument is present in the channel library as spec_an_LO.
End of explanation
cals = RabiAmpCalibration(q2)
cal.calibrate()
cal = RamseyCalibration(q2)
cal.calibrate()
Explanation: If the plot server and client are open, then the data will be plotted along with fits from the calibration procedure. The calibration procedure automatically knows which digitizer and AWG units are needed in the process. The relevant instrument parameters are updated but not commited to the database. Therefore they may be rolled back if undesirable results are found.
Pulse Calibrations
A simple set of calibrations is performed as follows.
End of explanation
cals = [RabiAmpCalibration, RamseyCalibration, Pi2Calibration, PiCalibration]
[cal(q2).calibrate() for cal in cals]
Explanation: Of course this is somewhat repetetive and can be sped up:
End of explanation
cal = QubitTuneup(q2, f_start=5.2e9, f_stop=5.8e9, coarse_step=50e6, fine_step=0.5e6, averages=250, amp=0.1)
cal.calibrate()
Explanation: Automatic Tuneup
While we develop algorithms for fully automated tuneup, some segments of the analysis are (primitively) automated as seen below:
End of explanation
<END_TASK>