Quanlse/Scheduler/Superconduct/GeneratorPulseModel.py
def generateBasic1Q(ham, gate, onQubit, scheduler) -> QJob:
        """ Generate the single-qubit gates """
        job = ham.createJob()

        # Generate the operator
        if gate.name in ['X', 'RX', 'Y', 'RY']:
            if "caliDataXY" not in scheduler.conf.keys():
                raise ArgumentError(f"'caliDataXY' does not exist in scheduler.conf, "
                                    f"hence X/Y controls are not supported.")
            if onQubit not in scheduler.conf["caliDataXY"].keys():
                raise ArgumentError(f"Configuration of qubit(s) {onQubit} does not, "
                                    f"hence X/Y controls are not supported.")
            # Pulse Parameters
            piLen = scheduler.conf["caliDataXY"][onQubit]["piLen"]
            piAmp = scheduler.conf["caliDataXY"][onQubit]["piAmp"]
            piTau = scheduler.conf["caliDataXY"][onQubit]["piTau"]
            piSigma = scheduler.conf["caliDataXY"][onQubit]["piSigma"]
            dragCoef = scheduler.conf["caliDataXY"][onQubit]["dragCoef"]
            if gate.name in ['X', 'RX']:
                amp = piAmp if gate.name == 'X' else gate.uGateArgumentList[0] / pi * piAmp
                piShift = 0.
            elif gate.name in ['Y', 'RY']:
                amp = piAmp if gate.name == 'Y' else gate.uGateArgumentList[0] / pi * piAmp
                piShift = pi / 2
            else:
                raise ArgumentError(f"Unsupported gate {gate.name}!")

            # Add the waveform to job
            _frameMode = scheduler.conf["frameMode"]
            if _frameMode == 'rot':
                job.addWave(driveX, onQubit, gaussian(piLen, amp * cos(piShift), piTau, piSigma), t0=0.)
                job.addWave(driveX, onQubit, dragY1(piLen, dragCoef * amp * sin(- piShift), piTau, piSigma), t0=0.)
                job.addWave(driveY, onQubit, gaussian(piLen, amp * sin(piShift), piTau, piSigma), t0=0.)
                job.addWave(driveY, onQubit, dragY1(piLen, dragCoef * amp * cos(piShift), piTau, piSigma), t0=0.)
            elif _frameMode == 'lab':
                gaussianWave = gaussian(piLen, amp, piTau, piSigma, phase0=piShift)
                dragWave = dragY1(piLen, dragCoef * amp, piTau, piSigma, phase0=piShift)
                job.appendWave(uWave, onQubit, mix(gaussianWave, dragWave))
            else:
                raise ArgumentError(f"Unsupported frameMode '{_frameMode}'!")
        elif gate.name in ['Z', 'RZ']:
            if "caliDataZ" not in scheduler.conf.keys():
                raise ArgumentError(f"'caliDataZ' does not exist in scheduler.conf, "
                                    f"hence Z controls are not supported.")
            if onQubit not in scheduler.conf["caliDataZ"].keys():
                raise ArgumentError(f"Configuration of qubit(s) {onQubit} does not, "
                                    f"hence Z controls are not supported.")
            # Pulse Parameters
            piLen = scheduler.conf["caliDataZ"][onQubit]["piLen"]
            piAmp = scheduler.conf["caliDataZ"][onQubit]["piAmp"]
            amp = piAmp if gate.name == 'Z' else gate.uGateArgumentList[2] / pi * piAmp

            # Add the waveform to job
            job.appendWave(flux, onQubit, square(piLen, amp))

        else:
            raise ArgumentError(f"Unsupported gate {gate.name}!")

        return job
 Generate the single-qubit gates 
Generate the single-qubit gates
Generate the single - qubit gates
def generateBasic1Q(ham, gate, onQubit, scheduler) -> QJob:
        job = ham.createJob()
        if gate.name in ['X', 'RX', 'Y', 'RY']:
            if "caliDataXY" not in scheduler.conf.keys():
                raise ArgumentError(f"'caliDataXY' does not exist in scheduler.conf, "
                                    f"hence X/Y controls are not supported.")
            if onQubit not in scheduler.conf["caliDataXY"].keys():
                raise ArgumentError(f"Configuration of qubit(s) {onQubit} does not, "
                                    f"hence X/Y controls are not supported.")
            piLen = scheduler.conf["caliDataXY"][onQubit]["piLen"]
            piAmp = scheduler.conf["caliDataXY"][onQubit]["piAmp"]
            piTau = scheduler.conf["caliDataXY"][onQubit]["piTau"]
            piSigma = scheduler.conf["caliDataXY"][onQubit]["piSigma"]
            dragCoef = scheduler.conf["caliDataXY"][onQubit]["dragCoef"]
            if gate.name in ['X', 'RX']:
                amp = piAmp if gate.name == 'X' else gate.uGateArgumentList[0] / pi * piAmp
                piShift = 0.
            elif gate.name in ['Y', 'RY']:
                amp = piAmp if gate.name == 'Y' else gate.uGateArgumentList[0] / pi * piAmp
                piShift = pi / 2
            else:
                raise ArgumentError(f"Unsupported gate {gate.name}!")
            _frameMode = scheduler.conf["frameMode"]
            if _frameMode == 'rot':
                job.addWave(driveX, onQubit, gaussian(piLen, amp * cos(piShift), piTau, piSigma), t0=0.)
                job.addWave(driveX, onQubit, dragY1(piLen, dragCoef * amp * sin(- piShift), piTau, piSigma), t0=0.)
                job.addWave(driveY, onQubit, gaussian(piLen, amp * sin(piShift), piTau, piSigma), t0=0.)
                job.addWave(driveY, onQubit, dragY1(piLen, dragCoef * amp * cos(piShift), piTau, piSigma), t0=0.)
            elif _frameMode == 'lab':
                gaussianWave = gaussian(piLen, amp, piTau, piSigma, phase0=piShift)
                dragWave = dragY1(piLen, dragCoef * amp, piTau, piSigma, phase0=piShift)
                job.appendWave(uWave, onQubit, mix(gaussianWave, dragWave))
            else:
                raise ArgumentError(f"Unsupported frameMode '{_frameMode}'!")
        elif gate.name in ['Z', 'RZ']:
            if "caliDataZ" not in scheduler.conf.keys():
                raise ArgumentError(f"'caliDataZ' does not exist in scheduler.conf, "
                                    f"hence Z controls are not supported.")
            if onQubit not in scheduler.conf["caliDataZ"].keys():
                raise ArgumentError(f"Configuration of qubit(s) {onQubit} does not, "
                                    f"hence Z controls are not supported.")
            piLen = scheduler.conf["caliDataZ"][onQubit]["piLen"]
            piAmp = scheduler.conf["caliDataZ"][onQubit]["piAmp"]
            amp = piAmp if gate.name == 'Z' else gate.uGateArgumentList[2] / pi * piAmp
            job.appendWave(flux, onQubit, square(piLen, amp))
        else:
            raise ArgumentError(f"Unsupported gate {gate.name}!")
        return job
def generateBasic1Q ( ham , gate , onQubit , scheduler ) -> QJob : job = ham . createJob ( ) if gate . name in [ 'X' , 'RX' , 'Y' , 'RY' ] : if "caliDataXY" not in scheduler . conf . keys ( ) : raise ArgumentError ( f"'caliDataXY' does not exist in scheduler.conf, " f"hence X/Y controls are not supported." ) if onQubit not in scheduler . conf [ "caliDataXY" ] . keys ( ) : raise ArgumentError ( f"Configuration of qubit(s) {onQubit} does not, " f"hence X/Y controls are not supported." ) piLen = scheduler . conf [ "caliDataXY" ] [ onQubit ] [ "piLen" ] piAmp = scheduler . conf [ "caliDataXY" ] [ onQubit ] [ "piAmp" ] piTau = scheduler . conf [ "caliDataXY" ] [ onQubit ] [ "piTau" ] piSigma = scheduler . conf [ "caliDataXY" ] [ onQubit ] [ "piSigma" ] dragCoef = scheduler . conf [ "caliDataXY" ] [ onQubit ] [ "dragCoef" ] if gate . name in [ 'X' , 'RX' ] : amp = piAmp if gate . name == 'X' else gate . uGateArgumentList [ 0 ] / pi * piAmp piShift = 0. elif gate . name in [ 'Y' , 'RY' ] : amp = piAmp if gate . name == 'Y' else gate . uGateArgumentList [ 0 ] / pi * piAmp piShift = pi / 2 else : raise ArgumentError ( f"Unsupported gate {gate.name}!" ) _frameMode = scheduler . conf [ "frameMode" ] if _frameMode == 'rot' : job . addWave ( driveX , onQubit , gaussian ( piLen , amp * cos ( piShift ) , piTau , piSigma ) , t0 = 0. ) job . addWave ( driveX , onQubit , dragY1 ( piLen , dragCoef * amp * sin ( - piShift ) , piTau , piSigma ) , t0 = 0. ) job . addWave ( driveY , onQubit , gaussian ( piLen , amp * sin ( piShift ) , piTau , piSigma ) , t0 = 0. ) job . addWave ( driveY , onQubit , dragY1 ( piLen , dragCoef * amp * cos ( piShift ) , piTau , piSigma ) , t0 = 0. ) elif _frameMode == 'lab' : gaussianWave = gaussian ( piLen , amp , piTau , piSigma , phase0 = piShift ) dragWave = dragY1 ( piLen , dragCoef * amp , piTau , piSigma , phase0 = piShift ) job . appendWave ( uWave , onQubit , mix ( gaussianWave , dragWave ) ) else : raise ArgumentError ( f"Unsupported frameMode '{_frameMode}'!" ) elif gate . name in [ 'Z' , 'RZ' ] : if "caliDataZ" not in scheduler . conf . keys ( ) : raise ArgumentError ( f"'caliDataZ' does not exist in scheduler.conf, " f"hence Z controls are not supported." ) if onQubit not in scheduler . conf [ "caliDataZ" ] . keys ( ) : raise ArgumentError ( f"Configuration of qubit(s) {onQubit} does not, " f"hence Z controls are not supported." ) piLen = scheduler . conf [ "caliDataZ" ] [ onQubit ] [ "piLen" ] piAmp = scheduler . conf [ "caliDataZ" ] [ onQubit ] [ "piAmp" ] amp = piAmp if gate . name == 'Z' else gate . uGateArgumentList [ 2 ] / pi * piAmp job . appendWave ( flux , onQubit , square ( piLen , amp ) ) else : raise ArgumentError ( f"Unsupported gate {gate.name}!" ) return job
Generate the single-qubit gates
Generate the single - qubit gates
""" Generate the single-qubit gates """ # Generate the operator # Pulse Parameters # Add the waveform to job # Pulse Parameters # Add the waveform to job
ham
gate
onQubit
scheduler