Quanlse/Calibration/SingleQubit.py
def ramsey(pulseModel: PulseModel, pulseFreq: float, tg: float, x90: float, sample: int = 100,
           maxTime: int = 800, detuning: float = None) -> [list, list]:
    """
    Perform a Ramsey experiment. This function takes a PulseModel object, pulse frequency, pi/2 pulse length,
    pi/2 pulse amplitude, sample size, maximum idling time and detuning pulse amplitude. This function returns
    a list of idling time and a list of population.

    :param pulseModel: a PulseModel object
    :param pulseFreq: pulse frequency
    :param tg: pi/2 pulse length
    :param x90: pi/2 pulse amplitude
    :param sample: sample size
    :param maxTime: maximum idling time
    :param detuning: detuning amplitude
    """

    # get Hamiltonian from pulse model
    ham = pulseModel.createQHamiltonian(frameMode='lab')

    # Define the detuning
    if detuning is None:
        detuning = 2 * pi * 8. / maxTime

    # time list
    tList = np.linspace(0, maxTime, sample)

    # define jobList for Ramsey experiment
    ramseyJob = ham.createJobList()
    for t in tList:
        job = pulseModel.ham.createJob()
        job.setLO(driveX(3), 0, freq=pulseFreq)
        job.addWave(driveX(3), 0, gaussian(t=tg, a=x90 / 2, tau=tg / 2, sigma=tg / 8), t0=0.)  # pi/2 pulse
        job.addWave(driveZ(3), 0, waves=square(t=t, a=detuning), t0=tg)  # simulate the rotation due to the detuning
        job.addWave(driveX(3), 0, gaussian(t=tg, a=-x90 / 2, tau=tg / 2, sigma=tg / 8), t0=tg + t)  # pi/2 pulse
        ramseyJob.addJob(job)

    # run simulation
    stateInit = basis(3, 0)
    results = pulseModel.ham.simulate(state0=stateInit, jobList=ramseyJob, isOpen=True)

    # calculate populations from results
    popList = []
    for result in results:
        rho = result['state']
        prj = basis(3, 1) @ dagger(basis(3, 1))
        popList.append(expect(prj, rho))
    return list(tList), popList

    Perform a Ramsey experiment. This function takes a PulseModel object, pulse frequency, pi/2 pulse length,
    pi/2 pulse amplitude, sample size, maximum idling time and detuning pulse amplitude. This function returns
    a list of idling time and a list of population.

    :param pulseModel: a PulseModel object
    :param pulseFreq: pulse frequency
    :param tg: pi/2 pulse length
    :param x90: pi/2 pulse amplitude
    :param sample: sample size
    :param maxTime: maximum idling time
    :param detuning: detuning amplitude
    
Perform a Ramsey experiment. This function takes a PulseModel object, pulse frequency, pi/2 pulse length,
pi/2 pulse amplitude, sample size, maximum idling time and detuning pulse amplitude. This function returns
a list of idling time and a list of population.
Perform a Ramsey experiment . This function takes a PulseModel object pulse frequency pi / 2 pulse length pi / 2 pulse amplitude sample size maximum idling time and detuning pulse amplitude . This function returns a list of idling time and a list of population .
def ramsey(pulseModel: PulseModel, pulseFreq: float, tg: float, x90: float, sample: int = 100,
           maxTime: int = 800, detuning: float = None) -> [list, list]:
    ham = pulseModel.createQHamiltonian(frameMode='lab')
    if detuning is None:
        detuning = 2 * pi * 8. / maxTime
    tList = np.linspace(0, maxTime, sample)
    ramseyJob = ham.createJobList()
    for t in tList:
        job = pulseModel.ham.createJob()
        job.setLO(driveX(3), 0, freq=pulseFreq)
        job.addWave(driveX(3), 0, gaussian(t=tg, a=x90 / 2, tau=tg / 2, sigma=tg / 8), t0=0.)  
        job.addWave(driveZ(3), 0, waves=square(t=t, a=detuning), t0=tg)  
        job.addWave(driveX(3), 0, gaussian(t=tg, a=-x90 / 2, tau=tg / 2, sigma=tg / 8), t0=tg + t)  
        ramseyJob.addJob(job)
    stateInit = basis(3, 0)
    results = pulseModel.ham.simulate(state0=stateInit, jobList=ramseyJob, isOpen=True)
    popList = []
    for result in results:
        rho = result['state']
        prj = basis(3, 1) @ dagger(basis(3, 1))
        popList.append(expect(prj, rho))
    return list(tList), popList
def ramsey ( pulseModel : PulseModel , pulseFreq : float , tg : float , x90 : float , sample : int = 100 , maxTime : int = 800 , detuning : float = None ) -> [ list , list ] : ham = pulseModel . createQHamiltonian ( frameMode = 'lab' ) if detuning is None : detuning = 2 * pi * 8. / maxTime tList = np . linspace ( 0 , maxTime , sample ) ramseyJob = ham . createJobList ( ) for t in tList : job = pulseModel . ham . createJob ( ) job . setLO ( driveX ( 3 ) , 0 , freq = pulseFreq ) job . addWave ( driveX ( 3 ) , 0 , gaussian ( t = tg , a = x90 / 2 , tau = tg / 2 , sigma = tg / 8 ) , t0 = 0. ) job . addWave ( driveZ ( 3 ) , 0 , waves = square ( t = t , a = detuning ) , t0 = tg ) job . addWave ( driveX ( 3 ) , 0 , gaussian ( t = tg , a = - x90 / 2 , tau = tg / 2 , sigma = tg / 8 ) , t0 = tg + t ) ramseyJob . addJob ( job ) stateInit = basis ( 3 , 0 ) results = pulseModel . ham . simulate ( state0 = stateInit , jobList = ramseyJob , isOpen = True ) popList = [ ] for result in results : rho = result [ 'state' ] prj = basis ( 3 , 1 ) @ dagger ( basis ( 3 , 1 ) ) popList . append ( expect ( prj , rho ) ) return list ( tList ) , popList
Perform a Ramsey experiment.
Perform a Ramsey experiment .
"""
    Perform a Ramsey experiment. This function takes a PulseModel object, pulse frequency, pi/2 pulse length,
    pi/2 pulse amplitude, sample size, maximum idling time and detuning pulse amplitude. This function returns
    a list of idling time and a list of population.

    :param pulseModel: a PulseModel object
    :param pulseFreq: pulse frequency
    :param tg: pi/2 pulse length
    :param x90: pi/2 pulse amplitude
    :param sample: sample size
    :param maxTime: maximum idling time
    :param detuning: detuning amplitude
    """ # get Hamiltonian from pulse model # Define the detuning # time list # define jobList for Ramsey experiment # pi/2 pulse # simulate the rotation due to the detuning # pi/2 pulse # run simulation # calculate populations from results
pulseModel
PulseModel
a PulseModel object
a PulseModel object
pulseFreq
float
None
tg
float
pi/2 pulse length
pi / 2 pulse length
x90
float
pi/2 pulse amplitude
pi / 2 pulse amplitude
sample
int
None
maxTime
int
maximum idling time
maximum idling time
detuning
float
None