Quanlse/Calibration/TwoQubit.py
def _condPhaseCaliLoss(x):
        """
        Obtain the calibration pulse jobs and calculate the loss function.
        """

        # Generate the pulse jobs for calibration
        caliJobs = czCaliCondPhaseJob(sche, q0, q1, x[0], x[1], x[2])

        # Simulate the calibration pulse
        if isinstance(sche, PulseModel):
            results = sche.simulate(jobList=caliJobs, options=options)
        else:
            if runner is None or not callable(runner):
                raise ArgumentError("Please input a callable runner!")
            results = runner(jobList=caliJobs, options=options)

        # Obtain the output population value
        popB1 = numpy.square(abs(results[0]["state"])).T[0]
        popB0 = numpy.square(abs(results[1]["state"])).T[0]

        # Population of the first qubit in basis |0> when the second qubit is |1>
        pop0B1 = getPopulationOnQubit(popB1, 1, sche.sysLevel)

        # Population of the first qubit in basis |1> when the second qubit is |0>
        pop1B0 = getPopulationOnQubit(popB0, 1, sche.sysLevel)

        # Calculate the loss function
        loss = pop0B1[0] + pop1B0[1]
        return loss

        Obtain the calibration pulse jobs and calculate the loss function.
        
Obtain the calibration pulse jobs and calculate the loss function.
Obtain the calibration pulse jobs and calculate the loss function .
def _condPhaseCaliLoss(x):
        caliJobs = czCaliCondPhaseJob(sche, q0, q1, x[0], x[1], x[2])
        if isinstance(sche, PulseModel):
            results = sche.simulate(jobList=caliJobs, options=options)
        else:
            if runner is None or not callable(runner):
                raise ArgumentError("Please input a callable runner!")
            results = runner(jobList=caliJobs, options=options)
        popB1 = numpy.square(abs(results[0]["state"])).T[0]
        popB0 = numpy.square(abs(results[1]["state"])).T[0]
        pop0B1 = getPopulationOnQubit(popB1, 1, sche.sysLevel)
        pop1B0 = getPopulationOnQubit(popB0, 1, sche.sysLevel)
        loss = pop0B1[0] + pop1B0[1]
        return loss
def _condPhaseCaliLoss ( x ) : caliJobs = czCaliCondPhaseJob ( sche , q0 , q1 , x [ 0 ] , x [ 1 ] , x [ 2 ] ) if isinstance ( sche , PulseModel ) : results = sche . simulate ( jobList = caliJobs , options = options ) else : if runner is None or not callable ( runner ) : raise ArgumentError ( "Please input a callable runner!" ) results = runner ( jobList = caliJobs , options = options ) popB1 = numpy . square ( abs ( results [ 0 ] [ "state" ] ) ) . T [ 0 ] popB0 = numpy . square ( abs ( results [ 1 ] [ "state" ] ) ) . T [ 0 ] pop0B1 = getPopulationOnQubit ( popB1 , 1 , sche . sysLevel ) pop1B0 = getPopulationOnQubit ( popB0 , 1 , sche . sysLevel ) loss = pop0B1 [ 0 ] + pop1B0 [ 1 ] return loss
Obtain the calibration pulse jobs and calculate the loss function.
Obtain the calibration pulse jobs and calculate the loss function .
"""
        Obtain the calibration pulse jobs and calculate the loss function.
        """ # Generate the pulse jobs for calibration # Simulate the calibration pulse # Obtain the output population value # Population of the first qubit in basis |0> when the second qubit is |1> # Population of the first qubit in basis |1> when the second qubit is |0> # Calculate the loss function
x