Exemplo n.º 1
0
    def fitFunc(self, x, p):
        from labrad import units as U

        flop = te.time_evolution(
            trap_frequency=U.WithUnit(p[4], "MHz"), projection=p[7], sideband_order=p[5], nmax=p[6]
        )
        evolution = flop.state_evolution_fluc(x * 10 ** -6, p[0], p[1], p[2], p[3], n_fluc=5.0)
        return evolution
Exemplo n.º 2
0
 def fitFunc(self, x, p):
     from labrad import units as U
     flop = te.time_evolution(trap_frequency=U.WithUnit(p[4], 'MHz'),
                              projection=p[7],
                              sideband_order=p[5],
                              nmax=p[6])
     evolution = flop.state_evolution_fluc(x * 10**-6,
                                           p[0],
                                           p[1],
                                           p[2],
                                           p[3],
                                           n_fluc=5.0)
     return evolution
Exemplo n.º 3
0
 def setRabiFrequencyFromPiTime(self,twopitime):
     if self.curveName == 'Rabi Flop':
             # create reasonable guess for rabi frequency based on sideband, trap_frequency
             trap_frequency=self.parent.savedAnalysisParameters[self.dataset, self.directory, self.index, 'Rabi Flop'][0]['Trap Frequency']
             sideband_order=self.parent.savedAnalysisParameters[self.dataset, self.directory, self.index, 'Rabi Flop'][0]['Sideband']
             nmax=self.parent.savedAnalysisParameters[self.dataset, self.directory, self.index, 'Rabi Flop'][0]['nmax']
             # call time evolution via fitRabiflop to get lamb-dicke parameter
             import timeevolution as te
             from labrad import units as U
             eta=te.time_evolution(U.WithUnit(trap_frequency,'MHz'),sideband_order,nmax).eta
             self.parent.savedAnalysisParameters[self.dataset, self.directory, self.index, self.curveName][0]['Rabi Frequency']=1.0/((2.0*eta)**np.abs(sideband_order)*twopitime*10**-6)
             self.fitCurves(parameters = self.getParameter(),drawCurves = True)
             self.onActivated() 
Exemplo n.º 4
0
 def model(self, params, x):
     
     nbar = params['nbar'].value
     f_rabi = params['f_rabi'].value
     delta = params['delta'].value
     delta_fluct = params['delta_fluctuations'].value
     trap_freq = params['trap_freq'].value
     sideband = params['sideband'].value
     nmax = params['nmax'].value
     projection = params['projection'].value
     
     flop = te.time_evolution(trap_frequency = U.WithUnit(trap_freq, 'MHz'), projection = projection, 
                              sideband_order = sideband, nmax = nmax)
     
     evolution = flop.state_evolution_fluc(x*10**-6, nbar, f_rabi, delta, delta_fluct, n_fluc = 5.0 )
     
     return evolution
Exemplo n.º 5
0
 def setRabiFrequencyFromPiTime(self, twopitime):
     if self.curveName == 'Rabi Flop':
         # create reasonable guess for rabi frequency based on sideband, trap_frequency
         trap_frequency = self.parent.savedAnalysisParameters[
             self.dataset, self.directory, self.index,
             'Rabi Flop'][0]['Trap Frequency']
         sideband_order = self.parent.savedAnalysisParameters[
             self.dataset, self.directory, self.index,
             'Rabi Flop'][0]['Sideband']
         nmax = self.parent.savedAnalysisParameters[self.dataset,
                                                    self.directory,
                                                    self.index,
                                                    'Rabi Flop'][0]['nmax']
         # call time evolution via fitRabiflop to get lamb-dicke parameter
         import timeevolution as te
         from labrad import units as U
         eta = te.time_evolution(U.WithUnit(trap_frequency, 'MHz'),
                                 sideband_order, nmax).eta
         self.parent.savedAnalysisParameters[
             self.dataset, self.directory, self.index,
             self.curveName][0]['Rabi Frequency'] = 1.0 / (
                 (2.0 * eta)**np.abs(sideband_order) * twopitime * 10**-6)
         self.fitCurves(parameters=self.getParameter(), drawCurves=True)
         self.onActivated()
Exemplo n.º 6
0
Arquivo: pi.py Projeto: EQ4/resonator
# take list of evolutions with differnet phases and average --> dephasing!
dv.cd(dephase_directory)
deph_y_axis_list = []
for i in dephase_numbers:
    dv.cd(dephase_files[i])
    dv.open(1)
    data = dv.get().asarray
    deph_y_axis_list.append(data[:, 1])
    dv.cd(1)

deph_y_axis = np.sum(deph_y_axis_list, axis=0) / np.float32(len(dephase_files))
deph_x_axis = data[:, 0] * 10**(-6) + dephasing_time_offset['s']
t0 = deph_x_axis.min() + dephasing_time_offset['s']

#fit Rabi Flops to theory
evo = tp.time_evolution(trap_frequency, sideband, nmax=amax)


def f(x):
    evolution = evo.state_evolution_fluc(x, nb(), f_Rabi(), delta(),
                                         delta_fluc())
    return evolution


eta = evo.eta

fitting_region = np.where((flop_x_axis >= fit_range_min['s'])
                          & (flop_x_axis <= fit_range_max['s']))
flop_errors = np.sqrt(flop_y_axis * (1 - flop_y_axis) /
                      (100.0 * len(flop_files)))
print 'Fitting...'
Exemplo n.º 7
0
# take list of evolutions with differnet phases and average --> dephasing!
dv.cd(dephase_directory)
deph_y_axis_list=[]
for i in dephase_numbers:
    dv.cd(dephase_files[i])
    dv.open(1)
    data = dv.get().asarray
    deph_y_axis_list.append(data[:,1])
    dv.cd(1)

deph_y_axis = np.sum(deph_y_axis_list,axis=0)/np.float32(len(dephase_files))
deph_x_axis=data[:,0]*10**(-6)+dephasing_time_offset['s']
t0 = deph_x_axis.min()+dephasing_time_offset['s']

#fit Rabi Flops to theory
evo=tp.time_evolution(trap_frequency, sideband,nmax = amax)
def f(x):
    evolution = evo.state_evolution_fluc(x,nb(),f_Rabi(),delta(),delta_fluc())
    return evolution

eta = evo.eta

fitting_region = np.where((flop_x_axis >= fit_range_min['s'])&(flop_x_axis <= fit_range_max['s']))
flop_errors = np.sqrt(flop_y_axis*(1-flop_y_axis)/(100.0*len(flop_files)))
print 'Fitting...'
p,cov,infodict,mesg,success = fit(f, fit_params, y = flop_y_axis[fitting_region], yerr=flop_errors[fitting_region],x = flop_x_axis[fitting_region])
print 'Fitting DONE.'

#print "nbar = {}".format(nb())
#print "Rabi Frequency = {} kHz".format(f_Rabi()*10**(-3))
print "The detuning fluctuates around ({:.2f} with a spread of {:.2f}) kHz".format(delta()*10**-3,np.abs(delta_fluc())*10**-3)
Exemplo n.º 8
0
dv.cd(dephase_directory)
deph_y_axis_list=[]
for i in dephase_numbers:
    dv.cd(dephase_files[i])
    dv.open(1)
    data = dv.get().asarray
    deph_y_axis_list.append(data[:,1])
    dv.cd(1)


deph_y_axis = np.sum(deph_y_axis_list,axis=0)/np.float32(len(dephase_files))
deph_x_axis=data[:,0]*10**(-6)+dephasing_time_offset['s']
t0 = deph_x_axis.min()+dephasing_time_offset['s']

#fit to theory
evo=te.time_evolution(trap_frequency, sideband,nmax = 1000)
def f(x):
    evolution = evo.state_evolution_fluc(x,nb(),f_Rabi(),delta(),delta_fluc())
    return evolution

fitting_region = np.where((flop_x_axis >= fit_range_min['s'])&(flop_x_axis <= fit_range_max['s']))
print 'Fitting...'
p,success = fit(f, fit_params, y = flop_y_axis[fitting_region], x = flop_x_axis[fitting_region])
print 'Fitting DONE.'

figure = pyplot.figure()

print "nbar = {}".format(nb())
print "Rabi Frequency = {} kHz".format(f_Rabi()*10**(-3))
print "The detuning is centered around {} kHz and spreads with a variance of {} kHz".format(delta()*10**-3,np.abs(delta_fluc())*10**-3)
Exemplo n.º 9
0
# take list of evolutions with differnet phases and average --> dephasing!
dv.cd(dephase_directory)
deph_y_axis_list = []
for i in dephase_numbers:
    dv.cd(dephase_files[i])
    dv.open(1)
    data = dv.get().asarray
    deph_y_axis_list.append(data[:, 1])
    dv.cd(1)

deph_y_axis = np.sum(deph_y_axis_list, axis=0) / np.float32(len(dephase_files))
deph_x_axis = data[:, 0] * 10**(-6) + dephasing_time_offset['s']
t0 = deph_x_axis.min() + dephasing_time_offset['s']

#fit to theory
evo = te.time_evolution(trap_frequency, sideband, nmax=1000)


def f(x):
    evolution = evo.state_evolution_fluc(x, nb(), f_Rabi(), delta(),
                                         delta_fluc())
    return evolution


fitting_region = np.where((flop_x_axis >= fit_range_min['s'])
                          & (flop_x_axis <= fit_range_max['s']))
print 'Fitting...'
p, success = fit(f,
                 fit_params,
                 y=flop_y_axis[fitting_region],
                 x=flop_x_axis[fitting_region])
Exemplo n.º 10
0
def get_nbar(flop_directory,
             blue_file,
             red_file,
             fit_until=U.WithUnit(1000.0, 'us'),
             show=False):
    print 'obtaining nbar from peak ratio of red and blue flop ...',
    #parameters and initial guesses for fit
    sideband = 1.0
    amax = 2000.0
    f_Rabi_init = U.WithUnit(150.0, 'kHz')
    nb_init = 0.1
    delta_init = U.WithUnit(1000.0, 'Hz')
    fit_range_min = U.WithUnit(0.0, 'us')
    fit_range_max = fit_until
    delta_fluc_init = U.WithUnit(100.0, 'Hz')

    #actual script starts here
    class Parameter:
        def __init__(self, value):
            self.value = value

        def set(self, value):
            self.value = value

        def __call__(self):
            return self.value

    def fit(function, parameters, y, x=None):
        def f(params):
            i = 0
            for p in parameters:
                p.set(params[i])
                i += 1
            return y - function(x)

        if x is None: x = np.arange(y.shape[0])
        p = [param() for param in parameters]
        return optimize.leastsq(f, p)

    #get access to servers
    cxn = labrad.connect('192.168.169.197', password='******')
    dv = cxn.data_vault

    #get trap frequency
    dv.cd(flop_directory)
    dv.cd(blue_file)
    dv.open(1)
    sideband_selection = dv.get_parameter('RabiFlopping.sideband_selection')
    sb = np.array(sideband_selection)
    trap_frequencies = [
        'TrapFrequencies.radial_frequency_1',
        'TrapFrequencies.radial_frequency_2',
        'TrapFrequencies.axial_frequency', 'TrapFrequencies.rf_drive_frequency'
    ]
    trap_frequency = dv.get_parameter(
        str(np.array(trap_frequencies)[sb.nonzero()][0]))

    #SET PARAMETERS
    nb = Parameter(nb_init)
    f_Rabi = Parameter(f_Rabi_init['Hz'])
    delta = Parameter(delta_init['Hz'])
    delta_fluc = Parameter(delta_fluc_init['Hz'])
    #which to fit?
    fit_params = [nb, f_Rabi, delta, delta_fluc]

    # take Rabi flops
    data = dv.get().asarray
    blue_flop_y_axis = data[:, 1]
    blue_flop_x_axis = data[:, 0] * 10**(-6)
    dv.cd(1)

    dv.cd(red_file)
    dv.open(1)
    data = dv.get().asarray
    red_flop_y_axis = data[:, 1]
    red_flop_x_axis = data[:, 0] * 10**(-6)

    #fit Rabi Flops to theory
    blue_evo = tp.time_evolution(trap_frequency, sideband, nmax=amax)

    def blue_f(x):
        evolution = blue_evo.state_evolution_fluc(x, nb(), f_Rabi(), delta(),
                                                  delta_fluc())
        return evolution

    red_evo = tp.time_evolution(trap_frequency, -sideband, nmax=amax)

    def red_f(x):
        evolution = red_evo.state_evolution_fluc(x, nb(), f_Rabi(), delta(),
                                                 delta_fluc())
        return evolution

    #FIT BLUE

    fitting_region = np.where((blue_flop_x_axis >= fit_range_min['s'])
                              & (blue_flop_x_axis <= fit_range_max['s']))
    fit(blue_f,
        fit_params,
        y=blue_flop_y_axis[fitting_region],
        x=blue_flop_x_axis[fitting_region])

    blue_nicer_resolution = np.linspace(0, blue_flop_x_axis.max(), 1000)
    blue_flop_fit_y_axis = blue_evo.state_evolution_fluc(
        blue_nicer_resolution, nb(), f_Rabi(), delta(), delta_fluc())
    m = pylab.unravel_index(
        np.array(blue_flop_fit_y_axis).argmax(),
        np.array(blue_flop_fit_y_axis).shape)

    blue_max = np.array(blue_flop_fit_y_axis).max()

    fit_params = [nb, delta, delta_fluc]
    #FIT RED
    fitting_region = np.where((red_flop_x_axis >= fit_range_min['s'])
                              & (red_flop_x_axis <= fit_range_max['s']))
    fit(red_f,
        fit_params,
        y=red_flop_y_axis[fitting_region],
        x=red_flop_x_axis[fitting_region])

    red_nicer_resolution = np.linspace(0, red_flop_x_axis.max(), 1000)
    red_flop_fit_y_axis = red_evo.state_evolution_fluc(red_nicer_resolution,
                                                       nb(), f_Rabi(), delta(),
                                                       delta_fluc())

    red_max = red_flop_fit_y_axis[m]

    r = red_max / blue_max
    ratio_nbar = r / (1 - r)

    if show:
        size = 0.8
        figure = pyplot.figure()
        pyplot.plot(blue_nicer_resolution * 10**6, blue_flop_fit_y_axis, 'b-')
        yerrflop = np.sqrt((1 - blue_flop_y_axis) * blue_flop_y_axis / (100.0))
        pyplot.errorbar(blue_flop_x_axis * 10**6,
                        blue_flop_y_axis,
                        yerrflop,
                        xerr=0,
                        fmt='bo')

        pyplot.xlabel(r'Evolution time in $\mu s$', fontsize=size * 22)
        pyplot.ylim((0, 1))
        pyplot.ylabel('Local Hilbert-Schmidt Distance', fontsize=size * 22)
        #pyplot.legend()

        pyplot.plot(red_nicer_resolution * 10**6, red_flop_fit_y_axis, 'r-')
        yerrflop = np.sqrt((1 - red_flop_y_axis) * red_flop_y_axis / (100.0))
        pyplot.errorbar(red_flop_x_axis * 10**6,
                        red_flop_y_axis,
                        yerrflop,
                        xerr=0,
                        fmt='ro')

        pyplot.text(
            blue_flop_x_axis.max() * 0.70 * 10**6, 0.80,
            'nbar (from ratio at blue peak) = {:.2f}'.format(ratio_nbar))
        pyplot.tick_params(axis='x', labelsize=size * 20)
        pyplot.tick_params(axis='y', labelsize=size * 20)
        pyplot.show()

    print 'done.'
    return ratio_nbar
Exemplo n.º 11
0
if 'fit_from' in info:
    fit_from = info['fit_from']['s']
else:
    fit_from = tmin
fitting_region = np.where((times <= fit_until) & (times >= fit_from))
fit_times = detailed_times - offset_time

# Find out what data and fit
if info['plot_type'] == 'rabi_flop':
    if 'sideband' in info: sideband_order = info['sideband']
    else: sideband_order = 0
    if 'nmax' in info: nmax = info['nmax']
    else: nmax = 1000
    trap_frequency = info['trap_frequency']
    flop = te.time_evolution(nmax=nmax,
                             trap_frequency=trap_frequency,
                             sideband_order=sideband_order)
    if 'take_init_fRabi_from_Pi_time' in info:
        fit_init_fRabi = 1.0 / (
            (2.0 * flop.eta)**np.abs(sideband_order) * 2.0 *
            info['take_init_fRabi_from_Pi_time']['s'])
    else:
        fit_init_fRabi = info['fit_init_fRabi']['Hz']
    fit_init_nbar = info['fit_init_nbar']
    fit_init_delta = info['fit_init_delta']['Hz']
    fit_init_delta_fluc = info['fit_init_delta_fluc']['Hz']
    nbar = Parameter(info['fit_init_nbar'])
    delta = Parameter(fit_init_delta)
    delta_fluc = Parameter(fit_init_delta_fluc)
    f_Rabi = Parameter(fit_init_fRabi)
Exemplo n.º 12
0
    fit_until=tmax
if 'fit_from' in info: 
    fit_from=info['fit_from']['s']
else:
    fit_from=tmin
fitting_region = np.where((times <= fit_until) & (times>=fit_from))
fit_times = detailed_times - offset_time

# Find out what data and fit
if info['plot_type']=='rabi_flop':
    if 'sideband' in info: sideband_order=info['sideband'] 
    else: sideband_order=0
    if 'nmax' in info: nmax=info['nmax']
    else: nmax=1000
    trap_frequency = info['trap_frequency']
    flop = te.time_evolution(nmax=nmax,trap_frequency = trap_frequency, sideband_order = sideband_order)
    if 'take_init_fRabi_from_Pi_time' in info: fit_init_fRabi=1.0/((2.0*flop.eta)**np.abs(sideband_order)*2.0*info['take_init_fRabi_from_Pi_time']['s'])
    else: fit_init_fRabi=info['fit_init_fRabi']['Hz']
    fit_init_nbar=info['fit_init_nbar']
    fit_init_delta=info['fit_init_delta']['Hz']
    fit_init_delta_fluc=info['fit_init_delta_fluc']['Hz']
    nbar = Parameter(info['fit_init_nbar'])
    delta = Parameter(fit_init_delta)
    delta_fluc = Parameter(fit_init_delta_fluc)
    f_Rabi = Parameter(fit_init_fRabi)
    def f(t):
        evolution = flop.state_evolution_fluc(t,nbar(), f_Rabi(), delta(), delta_fluc())
        return evolution
    fit_params=[]
    if info['fit_fRabi']: fit_params.append(f_Rabi)
    if info['fit_nbar']: fit_params.append(nbar)
Exemplo n.º 13
0
import timeevolution as te
from matplotlib import pyplot
import numpy as np
from labrad import units as U

tmin = 0
tmax = 0.001
t = np.linspace(tmin, tmax, 1000)
evo = te.time_evolution(U.WithUnit(2.8, 'MHz'), 1)
omega = 180000
nbar = 0.626127382989
#evo.state_evolution(t, 5.0, 20000)

nminusone = evo.n - 1
nminusone[0] = 0
omeganminusone = evo.effective_rabi_coupling(nminusone) * omega
omeganminusone[0] = 0
omegan = evo.rabi_coupling * omega
p = evo.p_thermal(nbar, nshift=False)
ones = np.ones_like(t)

flop = evo.state_evolution(t, nbar, omega / (2.0 * np.pi))

gg = 0.5 * np.sum(np.outer(p, ones) *
                  (np.cos(np.outer(omegan / 2.0, t))**2 +
                   np.sin(np.outer(omeganminusone / 2.0, t))**2),
                  axis=0)
eg = -0.5 * 1.j * np.sum(
    np.outer(p, ones) * np.cos(np.outer(omeganminusone / 2.0, t)) *
    (np.cos(np.outer(omegan / 2.0, t)) -
     1.j * np.sin(np.outer(omeganminusone / 2.0, t))),
Exemplo n.º 14
0
def get_nbar(flop_directory,blue_file,red_file,fit_until=U.WithUnit(1000.0,'us'),show=False):
    print 'obtaining nbar from peak ratio of red and blue flop ...',
    #parameters and initial guesses for fit
    sideband = 1.0
    amax=2000.0
    f_Rabi_init = U.WithUnit(150.0,'kHz')
    nb_init = 0.1
    delta_init = U.WithUnit(1000.0,'Hz')
    fit_range_min=U.WithUnit(0.0,'us')
    fit_range_max=fit_until
    delta_fluc_init=U.WithUnit(100.0,'Hz')
    
    #actual script starts here
    class Parameter:
        def __init__(self, value):
                self.value = value
    
        def set(self, value):
                self.value = value
    
        def __call__(self):
                return self.value
            
    def fit(function, parameters, y, x = None):
        def f(params):
            i = 0
            for p in parameters:
                p.set(params[i])
                i += 1
            return y - function(x)
    
        if x is None: x = np.arange(y.shape[0])
        p = [param() for param in parameters]
        return optimize.leastsq(f, p)
    
    #get access to servers
    cxn = labrad.connect('192.168.169.197', password = '******')
    dv = cxn.data_vault
    
    #get trap frequency
    dv.cd(flop_directory)
    dv.cd(blue_file)
    dv.open(1)
    sideband_selection = dv.get_parameter('RabiFlopping.sideband_selection')
    sb = np.array(sideband_selection)
    trap_frequencies = ['TrapFrequencies.radial_frequency_1','TrapFrequencies.radial_frequency_2','TrapFrequencies.axial_frequency','TrapFrequencies.rf_drive_frequency']
    trap_frequency = dv.get_parameter(str(np.array(trap_frequencies)[sb.nonzero()][0]))            
    
    #SET PARAMETERS
    nb = Parameter(nb_init)
    f_Rabi = Parameter(f_Rabi_init['Hz'])
    delta = Parameter(delta_init['Hz'])
    delta_fluc=Parameter(delta_fluc_init['Hz'])
    #which to fit?
    fit_params = [nb,f_Rabi,delta,delta_fluc]
    
    # take Rabi flops
    data = dv.get().asarray
    blue_flop_y_axis = data[:,1]
    blue_flop_x_axis = data[:,0]*10**(-6)
    dv.cd(1)
    
    dv.cd(red_file)
    dv.open(1)
    data = dv.get().asarray
    red_flop_y_axis = data[:,1]
    red_flop_x_axis = data[:,0]*10**(-6)
    
    #fit Rabi Flops to theory
    blue_evo=tp.time_evolution(trap_frequency, sideband,nmax = amax)
    def blue_f(x):
        evolution = blue_evo.state_evolution_fluc(x,nb(),f_Rabi(),delta(),delta_fluc())
        return evolution
    
    red_evo=tp.time_evolution(trap_frequency, -sideband,nmax = amax)
    def red_f(x):
        evolution = red_evo.state_evolution_fluc(x,nb(),f_Rabi(),delta(),delta_fluc())
        return evolution
    
    #FIT BLUE
    
    fitting_region = np.where((blue_flop_x_axis >= fit_range_min['s'])&(blue_flop_x_axis <= fit_range_max['s']))
    fit(blue_f, fit_params, y = blue_flop_y_axis[fitting_region], x = blue_flop_x_axis[fitting_region])
    
    blue_nicer_resolution = np.linspace(0,blue_flop_x_axis.max(),1000)
    blue_flop_fit_y_axis = blue_evo.state_evolution_fluc(blue_nicer_resolution, nb(), f_Rabi(), delta(),delta_fluc())
    m=pylab.unravel_index(np.array(blue_flop_fit_y_axis).argmax(), np.array(blue_flop_fit_y_axis).shape)
    
    blue_max = np.array(blue_flop_fit_y_axis).max()
    
    fit_params = [nb,delta,delta_fluc]
    #FIT RED
    fitting_region = np.where((red_flop_x_axis >= fit_range_min['s'])&(red_flop_x_axis <= fit_range_max['s']))
    fit(red_f, fit_params, y = red_flop_y_axis[fitting_region], x = red_flop_x_axis[fitting_region])
    
    red_nicer_resolution = np.linspace(0,red_flop_x_axis.max(),1000)
    red_flop_fit_y_axis = red_evo.state_evolution_fluc(red_nicer_resolution, nb(), f_Rabi(), delta(),delta_fluc())
    
    red_max = red_flop_fit_y_axis[m]
    
    r = red_max/blue_max
    ratio_nbar = r/(1-r)
    
    if show:
        size=0.8
        figure = pyplot.figure()
        pyplot.plot(blue_nicer_resolution*10**6,blue_flop_fit_y_axis,'b-')
        yerrflop = np.sqrt((1-blue_flop_y_axis)*blue_flop_y_axis/(100.0))
        pyplot.errorbar(blue_flop_x_axis*10**6, blue_flop_y_axis, yerrflop, xerr = 0, fmt='bo')
        
        pyplot.xlabel(r'Evolution time in $\mu s$',fontsize=size*22)
        pyplot.ylim((0,1))
        pyplot.ylabel('Local Hilbert-Schmidt Distance',fontsize=size*22)
        #pyplot.legend()
        
        pyplot.plot(red_nicer_resolution*10**6,red_flop_fit_y_axis,'r-')
        yerrflop = np.sqrt((1-red_flop_y_axis)*red_flop_y_axis/(100.0))
        pyplot.errorbar(red_flop_x_axis*10**6, red_flop_y_axis, yerrflop, xerr = 0, fmt='ro')
        
        pyplot.text(blue_flop_x_axis.max()*0.70*10**6,0.80, 'nbar (from ratio at blue peak) = {:.2f}'.format(ratio_nbar))
        pyplot.tick_params(axis='x', labelsize=size*20)
        pyplot.tick_params(axis='y', labelsize=size*20)
        pyplot.show()
    
    print 'done.' 
    return ratio_nbar
Exemplo n.º 15
0
import timeevolution as te
from matplotlib import pyplot
import numpy as np
from labrad import units as U

tmin = 0
tmax = 0.001
t=np.linspace(tmin,tmax,1000)
evo = te.time_evolution(U.WithUnit(2.8,'MHz'), 1)
omega = 180000
nbar = 0.626127382989
#evo.state_evolution(t, 5.0, 20000)

nminusone = evo.n-1
nminusone[0]=0
omeganminusone = evo.effective_rabi_coupling(nminusone)*omega
omeganminusone[0]=0
omegan = evo.rabi_coupling*omega
p=evo.p_thermal(nbar,nshift = False)
ones = np.ones_like(t)

flop = evo.state_evolution(t, nbar, omega/(2.0*np.pi))

gg = 0.5*np.sum(np.outer(p,ones)*(np.cos(np.outer(omegan/2.0,t))**2+np.sin(np.outer(omeganminusone/2.0,t))**2),axis=0)
eg = -0.5*1.j*np.sum(np.outer(p,ones)*np.cos(np.outer(omeganminusone/2.0,t))*(np.cos(np.outer(omegan/2.0,t))-1.j*np.sin(np.outer(omeganminusone/2.0,t))),axis=0)

ee = 1-np.abs(gg)
egreal = np.real(eg)
egim = np.imag(eg)

figure = pyplot.figure()