Esempio n. 1
0
def constructLoadRamps():
    global report

    # Initialize channels to ZSLOAD values and with cncstepsize
    ss = f('CNC', 'cncstepsize')
    motpow = wfm.wave(cnv('motpow', f('ZSLOAD', 'motpow')), ss)
    repdet = wfm.wave(cnv('repdet', f('ZSLOAD', 'repdet')), ss)
    trapdet = wfm.wave(cnv('trapdet', f('ZSLOAD', 'trapdet')), ss)
    reppow = wfm.wave(cnv('reppow', f('ZSLOAD', 'reppow')), ss)
    trappow = wfm.wave(cnv('trappow', f('ZSLOAD', 'trappow')), ss)

    #Insert AOM imaging values in one analogstepsize
    motpow.linear(cnv('motpow', f('ZSLOAD', 'imgpow')), 0.0)
    repdet.linear(cnv('repdet', f('ZSLOAD', 'imgdetrep')), 0.0)
    trapdet.linear(cnv('trapdet', f('ZSLOAD', 'imgdettrap')), 0.0)
    reppow.linear(cnv('reppow', f('ZSLOAD', 'imgpowrep')), 0.0)
    trappow.linear(cnv('trappow', f('ZSLOAD', 'imgpowtrap')), 0.0)

    maxDT = max(motpow.dt(), repdet.dt(), trapdet.dt(), reppow.dt(),
                trappow.dt())

    motpow.extend(maxDT)
    repdet.extend(maxDT)
    trapdet.extend(maxDT)
    reppow.extend(maxDT)
    trappow.extend(maxDT)

    motpow.fileoutput('L:/software/apparatus3/seq/ramps/motpow.txt')
    repdet.fileoutput('L:/software/apparatus3/seq/ramps/repdet.txt')
    trapdet.fileoutput('L:/software/apparatus3/seq/ramps/trapdet.txt')
    reppow.fileoutput('L:/software/apparatus3/seq/ramps/reppow.txt')
    trappow.fileoutput('L:/software/apparatus3/seq/ramps/trappow.txt')

    return max(motpow.dt(), repdet.dt(), trapdet.dt(), reppow.dt(),
               trappow.dt())
Esempio n. 2
0
def uvRamps(motpow, bfield, ENDCNC):
	ss=f('CNC','cncstepsize')


	uvdt = f('UV','dt')
	#---Ramp down red power
	motpow.linear(  0.002, uvdt) #0.002 is max attenuation before RF switch
	
	#---Bfield ramp
	dtload = f('UV','dtload_bfield')
	dtcnc = f('UV','dtcnc_bfield')
	uvhold = f('UV','uvhold')
	
	#OBSOLETE
	#bfield.linear(  f('UV','uvbfield'), uvdt)
	#bfield.appendhold(dtload)
	#bfield.linear( f('UV','uvbfieldf'), dtcnc)
	
	bfield.linear(  uvsec.uvbfield, uvsec.dt)
	bfield.appendhold( uvsec.dtload_bfield)
	bfield.linear(  uvsec.uvbfieldf, uvsec.dtcnc_bfield) 
	

	#OBSOLETE
	#bfield.appendhold(uvhold)	
	
	ENDUVMOT = max( motpow.dt(), bfield.dt() )
	
	#---UVPOW ramps
	
	#OBSOLETE
	#dtload_uvpow = f('UV','dtload_uvpow')
	#dtcnc_uvpow = f('UV','dtcnc_uvpow')
	
	
	#
	uvpow= wfm.wave('uvpow', f('UV','uvpow'),ss)
	uvpow2= wfm.wave('uvpow2',f('UV','uvpow2'),ss)
	#
	uvpow.extend( ENDCNC + uvsec.dt + uvsec.dtload_uvpow)
	uvpow2.extend(ENDCNC + uvsec.dt + uvsec.dtload_uvpow)
	#
	uvpow.linear( f('UV','uvpowf'), uvsec.dtcnc_uvpow)
	uvpow2.linear( f('UV','uvpow2f') , uvsec.dtcnc_uvpow)	
	
	#---ENDUVMOT is defined as the point where the longest of bfield 
	#---or uvpow ramps ends
	maxramp = max( motpow.dt(), bfield.dt(), uvpow.dt(), uvpow2.dt() )
	ENDUVMOT = maxramp + uvhold
	bfield.extend(ENDUVMOT)
	uvpow.extend(ENDUVMOT)
	uvpow2.extend(ENDUVMOT)	
	
	motpow.extend(ENDUVMOT)
	bfield.extend(ENDUVMOT)
	uvpow.extend(ENDUVMOT)
	uvpow2.extend(ENDUVMOT)

	return uvpow2, uvpow, motpow, bfield, ENDUVMOT
Esempio n. 3
0
def uvRamps(motpow, bfield, ENDCNC):
	ss=f('CNC','cncstepsize')
	
	#---Put pulse on uvfppiezo
	uvfppiezo= wfm.wave('uvfppiezo',0.0,ss)
	uvfppiezo.extend( ENDCNC)
	uvfppiezo.linear( f('UV','pulsedet'), 0.0)	
	uvfppiezo.appendhold( f('UV','dtpulse'))
	uvfppiezo.linear( 0.0, f('UV','dtpulseramp'))
	#uvfppiezo.dither( f('UV','dtpulse'), 3)
	#uvfppiezo.lineardither( 0.0, f('UV','dtpulseramp'),3)


	uvdt = f('UV','dt')
	#---Ramp down red power
	motpow.linear(  0.002, uvdt) #0.002 is max attenuation before RF switch
	
	#---Bfield ramp
	dtload = f('UV','dtload_bfield')
	dtcnc = f('UV','dtcnc_bfield')
	uvhold = f('UV','uvhold')
	bfield.linear(  f('UV','uvbfield'), uvdt)
	bfield.appendhold(dtload)
	bfield.linear( f('UV','uvbfieldf'), dtcnc)
	#bfield.appendhold(uvhold)	
	
	ENDUVMOT = max( motpow.dt(), bfield.dt() )
	
	#---UVPOW ramps
	dtload_uvpow = f('UV','dtload_uvpow')
	dtcnc_uvpow = f('UV','dtcnc_uvpow')
	#
	uvpow= wfm.wave('uvpow', f('UV','uvpow'),ss)
	uvpow2= wfm.wave('uvpow2',f('UV','uvpow2'),ss)
	#
	uvpow.extend(ENDCNC+uvdt+dtload)
	uvpow2.extend(ENDCNC+uvdt+dtload)
	#
	uvpow.linear( f('UV','uvpowf'), dtcnc_uvpow)
	uvpow2.linear( f('UV','uvpow2f') , dtcnc_uvpow)	
	
	#---ENDUVMOT is defined as the point where the longest of bfield 
	#---or uvpow ramps ends
	maxramp = max( motpow.dt(), bfield.dt(), uvpow.dt(), uvpow2.dt() )
	ENDUVMOT = maxramp + uvhold
	bfield.extend(ENDUVMOT)
	uvpow.extend(ENDUVMOT)
	uvpow2.extend(ENDUVMOT)	
	
	uvfppiezo.extend(ENDUVMOT)
	motpow.extend(ENDUVMOT)
	bfield.extend(ENDUVMOT)
	uvpow.extend(ENDUVMOT)
	uvpow2.extend(ENDUVMOT)

	return uvfppiezo, uvpow2, uvpow, motpow, bfield, ENDUVMOT
Esempio n. 4
0
def odt_dbz(odtpow0):
    dbz_ss = f('DBZ', 'dbz_ss')

    odtpow = odt_wave('odtpow', None, dbz_ss, volt=odtpow0)
    bfield = wfm.wave('bfield', f('FESHBACH', 'bias'), dbz_ss)

    odtpow.linear(f('DBZ', 'cpow'), f('DBZ', 'cdt'))
    odtpow.appendhold(f('DBZ', 'waitdt'))
    bfield.extend(odtpow.dt())

    #Field goes to zero
    bfield.linear(0.0, f('DBZ', 'bdt'))
    bfield.appendhold(f('DBZ', 'waitdt2'))
    #Field TTL goes off here
    OFFDT1 = bfield.dt()
    bfield.appendhold(f('DBZ', 'switchdt'))
    #Field switches from feshbach to gradient here
    bfield.appendhold(f('DBZ', 'switchdt'))
    #Field TTL goes back on here
    bfield.appendhold(f('DBZ', 'switchdt'))
    bfield.linear(f('DBZ', 'dbz'), f('DBZ', 'rampdt'))
    bfield.appendhold(f('DBZ', 'holddt'))
    #Field goes off here (atoms should be oscillating in the trap)
    bfield.linear(0.0, f('DBZ', 'dbz_ss'))

    odtpow.extend(bfield.dt())
    return odtpow, bfield, OFFDT1
Esempio n. 5
0
def odt_lightshift_evap(image):
    evap_ss = f('EVAP', 'evapss')

    p0 = f('ODT', 'odtpow')
    p1 = f('EVAP', 'p1')
    t1 = f('EVAP', 't1')
    tau = f('EVAP', 'tau')
    beta = f('EVAP', 'beta')

    offset = f('EVAP', 'offset')
    t2 = f('EVAP', 't2')
    tau2 = f('EVAP', 'tau2')

    odtpow2 = odt_wave('odtpow', p0, evap_ss)
    #odtpow.Evap(p0, p1, t1, tau, beta, image)
    #odtpow.Evap2(p0, p1, t1, tau, beta, offset, t2, tau2, image)
    ficpow = odtpow2.Evap3(p0, p1, t1, tau, beta, offset, t2, tau2, image)

    uvdet = wfm.wave('uvdet', None, evap_ss, volt=3.744)
    uvdet.linear(f('UVLS', 'uvdet'), 100)

    maxDT = odtpow2.dt()
    uvdet.extend(maxDT)

    return odtpow2, uvdet, maxDT
Esempio n. 6
0
def odt_dbz(odtpow0):
	dbz_ss = f('DBZ','dbz_ss')

	odtpow  = odt_wave('odtpow',  None, dbz_ss, volt=odtpow0)
	bfield  = wfm.wave('bfield',  f('FESHBACH','bias'), dbz_ss)
	
	odtpow.linear( f('DBZ','cpow'), f('DBZ','cdt') )
	odtpow.appendhold( f('DBZ','waitdt'))
	bfield.extend(odtpow.dt())
	
	#Field goes to zero
	bfield.linear( 0.0, f('DBZ','bdt') )
	bfield.appendhold( f('DBZ','waitdt2'))
	#Field TTL goes off here
	OFFDT1 = bfield.dt()
	bfield.appendhold( f('DBZ','switchdt'))
	#Field switches from feshbach to gradient here
	bfield.appendhold( f('DBZ','switchdt'))
	#Field TTL goes back on here
	bfield.appendhold( f('DBZ','switchdt'))
	bfield.linear( f('DBZ', 'dbz'), f('DBZ','rampdt'))
	bfield.appendhold( f('DBZ','holddt'))
	#Field goes off here (atoms should be oscillating in the trap)
	bfield.linear( 0.0, f('DBZ','dbz_ss'))
	
	odtpow.extend( bfield.dt() )
	return odtpow, bfield, OFFDT1
Esempio n. 7
0
def odt_lightshift_evap(image):
	evap_ss = f('EVAP','evapss')

	p0   = f('ODT','odtpow')
	p1   = f('EVAP','p1')
	t1   = f('EVAP','t1')
	tau  = f('EVAP','tau')
	beta = f('EVAP','beta')
	
	offset = f('EVAP','offset')
	t2     = f('EVAP','t2')
	tau2   = f('EVAP','tau2')
		
	odtpow2 = odt_wave('odtpow', p0, evap_ss)
	#odtpow.Evap(p0, p1, t1, tau, beta, image)
	#odtpow.Evap2(p0, p1, t1, tau, beta, offset, t2, tau2, image)
	ficpow = odtpow2.Evap3(p0, p1, t1, tau, beta, offset, t2, tau2, image)
	
	uvdet = wfm.wave('uvdet', None , evap_ss, volt=3.744)
	uvdet.linear( f('UVLS','uvdet'), 100 )
	
	maxDT = odtpow2.dt()
	uvdet.extend(maxDT)
	
	return odtpow2, uvdet, maxDT
Esempio n. 8
0
def odt_adiabaticDown(ss, STARTDELAY):
    maxpow = f('ODT', 'odtpow')
    tau = f('ODT', 'tau')
    dt = 2 * tau
    odtpow = wfm.wave('odtpow', cnv('odtpow', maxpow), ss)
    odtpow.extend(STARTDELAY + f('ODT', 'intrap'))
    odtpow.AdiabaticRampDown(dt, tau, 'odtpow')
    return odtpow
Esempio n. 9
0
def odt_adiabaticDown(ss, STARTDELAY):
    maxpow = f("ODT", "odtpow")
    tau = f("ODT", "tau")
    dt = 2 * tau
    odtpow = wfm.wave("odtpow", cnv("odtpow", maxpow), ss)
    odtpow.extend(STARTDELAY + f("ODT", "intrap"))
    odtpow.AdiabaticRampDown(dt, tau, "odtpow")
    return odtpow
Esempio n. 10
0
def odt_lightshift(odtpow0):
	ls_ss = f('UVLS','ls_ss')

	odtpow  = odt_wave('odtpow',  None, ls_ss, volt=odtpow0)
	bfield  = wfm.wave('bfield',  f('FESHBACH','bias'), ls_ss)
	uv1freq = wfm.wave('uv1freq', None , ls_ss, volt=7.600)
	uvpow2   = wfm.wave('uvpow2',   f('UV','uvpow2'), ls_ss)


	uv1freq.linear( None, 10.0, volt=f('UVLS','uvfreq'))
	uvpow2.linear(  f('UVLS','lspow2'), 10.0)
		
	odtpow.linear( f('UVLS','cpow'), f('UVLS','cdt') )
	odtpow.appendhold( f('UVLS','waitdt'))
	bfield.extend(odtpow.dt())
	
	bfield.linear( f('UVLS','bpulse'), f('UVLS','bdt') )
	bfield.appendhold( f('UVLS','waitdt2'))
	bfield.appendhold( f('UVLS','waitdt3'))
	ENDC=bfield.dt()

	#~ bfield.linear( f('UVLS','bpulse') , f('UVLS','bdt') )
	#~ bfield.appendhold(f('UVLS','waitdt'))
	#~ odtpow.extend(bfield.dt())
	
	#~ odtpow.linear( f('UVLS','cpow'), f('UVLS','cdt') )
	#~ odtpow.appendhold( f('UVLS', 'waitdt2'))
	#~ ENDC = odtpow.dt()
	
	#~ bfield.extend( odtpow.dt() )
	
	odtpow.extend( bfield.dt() )
	bfield.appendhold( f('UVLS','dtpulse')) 
	

	bfield.linear( f('ZEROCROSS','zcbias') , f('UVLS','hframpdt'))
	#Change f('FESHBACH','bias') -> f('ZEROCROSS','zcbias') 110911 by Ernie
	#bfield.linear( 0.0, f('UVLS','hframpdt'))
	
	totalDT = bfield.dt()
	
	odtpow.extend(totalDT)
	uv1freq.extend(totalDT)
	uvpow2.extend(totalDT)
	
	return odtpow, bfield, uv1freq, uvpow2, ENDC
Esempio n. 11
0
def odt_lightshift(odtpow0):
    ls_ss = f('UVLS', 'ls_ss')

    odtpow = odt_wave('odtpow', None, ls_ss, volt=odtpow0)
    bfield = wfm.wave('bfield', f('FESHBACH', 'bias'), ls_ss)
    uv1freq = wfm.wave('uv1freq', None, ls_ss, volt=7.600)
    uvpow2 = wfm.wave('uvpow2', f('UV', 'uvpow2'), ls_ss)

    uv1freq.linear(None, 10.0, volt=f('UVLS', 'uvfreq'))
    uvpow2.linear(f('UVLS', 'lspow2'), 10.0)

    odtpow.linear(f('UVLS', 'cpow'), f('UVLS', 'cdt'))
    odtpow.appendhold(f('UVLS', 'waitdt'))
    bfield.extend(odtpow.dt())

    bfield.linear(f('UVLS', 'bpulse'), f('UVLS', 'bdt'))
    bfield.appendhold(f('UVLS', 'waitdt2'))
    bfield.appendhold(f('UVLS', 'waitdt3'))
    ENDC = bfield.dt()

    #~ bfield.linear( f('UVLS','bpulse') , f('UVLS','bdt') )
    #~ bfield.appendhold(f('UVLS','waitdt'))
    #~ odtpow.extend(bfield.dt())

    #~ odtpow.linear( f('UVLS','cpow'), f('UVLS','cdt') )
    #~ odtpow.appendhold( f('UVLS', 'waitdt2'))
    #~ ENDC = odtpow.dt()

    #~ bfield.extend( odtpow.dt() )

    odtpow.extend(bfield.dt())
    bfield.appendhold(f('UVLS', 'dtpulse'))

    bfield.linear(f('ZEROCROSS', 'zcbias'), f('UVLS', 'hframpdt'))
    #Change f('FESHBACH','bias') -> f('ZEROCROSS','zcbias') 110911 by Ernie
    #bfield.linear( 0.0, f('UVLS','hframpdt'))

    totalDT = bfield.dt()

    odtpow.extend(totalDT)
    uv1freq.extend(totalDT)
    uvpow2.extend(totalDT)

    return odtpow, bfield, uv1freq, uvpow2, ENDC
Esempio n. 12
0
def odt_evap_field_free(toENDBFIELD, scale =1.0):
	
	
	odtfree = EVAP.free - EVAP.buffer - toENDBFIELD
	
	#---Setup ODT ramp
	odtpow = odt_wave('odtpow', ODT.odtpow, EVAP.evapss)
	odtpow.appendhold( odtfree )
	
	#image = DIMPLE.image if DIMPLE.image <= EVAP.image else EVAP.image
	image = DIMPLE.image 
	
	### SELECT EVAP TRAJECTORY HERE###
	finalcpow = odtpow.Evap8(\
							ODT.odtpow, \
							EVAP.p1, \
							EVAP.t1, 
							EVAP.tau, \
							EVAP.beta, \
							EVAP.offset, \
							EVAP.t2, \
							EVAP.tau2, \
							EVAP.smoothdt, \
							image, \
							EVAP.scale \
							)
	#Here, go ahead and save the finalcpow to the report
	gen.save_to_report('EVAP','finalcpow', finalcpow)
	

	#---Setup field ramp and shunt ramp
	field_ramp_time = EVAP.fieldrampt0*scale
	field_ramp_dt   = EVAP.fieldrampdt*scale

	print '\t...Making new Evap_field'
	bfield = wfm.wave('bfield', FB.bias, EVAP.evapss)
	bfield.extend(field_ramp_time + odtfree)
	bfield.linear(EVAP.fieldrampfinal,field_ramp_dt)
	
	if((field_ramp_time+field_ramp_dt)<image*scale):
		bfield.extend(image*scale)
	else:
		bfield.chop(image*scale)
	
	#---Setup ipganalog ramp
	ipganalog = ipg_wave('ipganalog', 10., EVAP.evapss)
	if ODT.use_servo == 0:
		ipganalog.extend( odtpow.dt() )
	elif ODT.use_servo == 1:
		if ODT.ipgfollow == 1:
			ipganalog.follow( odtpow ,ODT.ipgmin)
		else:
			ipganalog.extend( odtpow.dt() )

	maxDT = odtpow.dt()
	return bfield, odtpow, maxDT, finalcpow, ipganalog
Esempio n. 13
0
def odt_modulationRamps(ss, STARTDELAY):
    maxpow = f('ODT', 'odtpow')
    moddt = f('TRAPFREQ', 'moddt')
    modfreq = f('TRAPFREQ', 'modfreq')
    moddepth = f('TRAPFREQ', 'moddepth')

    odtpow = wfm.wave('odtpow', cnv('odtpow', maxpow), ss)
    odtpow.extend(STARTDELAY + f('TRAPFREQ', 'intrapdt'))
    odtpow.SineMod(maxpow, moddepth, moddt, modfreq, 'odtpow')
    odtpow.linear(cnv('odtpow', maxpow), ss)

    return odtpow
Esempio n. 14
0
def odt_modulationRamps(ss, STARTDELAY):
    maxpow = f("ODT", "odtpow")
    moddt = f("TRAPFREQ", "moddt")
    modfreq = f("TRAPFREQ", "modfreq")
    moddepth = f("TRAPFREQ", "moddepth")

    odtpow = wfm.wave("odtpow", cnv("odtpow", maxpow), ss)
    odtpow.extend(STARTDELAY + f("TRAPFREQ", "intrapdt"))
    odtpow.SineMod(maxpow, moddepth, moddt, modfreq, "odtpow")
    odtpow.linear(cnv("odtpow", maxpow), ss)

    return odtpow
Esempio n. 15
0
def odt_flicker(odtpow0):
    flicker_ss = f('FLICKER', 'flicker_ss')

    odtpow = odt_wave('odtpow', None, flicker_ss, volt=odtpow0)
    bfield = wfm.wave('bfield', f('FESHBACH', 'bias'), flicker_ss)

    odtpow.linear(f('FLICKER', 'cpow'), f('FLICKER', 'cdt'))
    odtpow.appendhold(f('FLICKER', 'waitdt'))
    bfield.extend(odtpow.dt())

    bfield.linear(f('FLICKER', 'bflick'), f('FLICKER', 'bdt'))
    bfield.appendhold(f('FLICKER', 'waitdt2'))

    odtpow.extend(bfield.dt())

    return odtpow, bfield, odtpow.dt()
Esempio n. 16
0
def odt_flicker(odtpow0):
	flicker_ss = f('FLICKER','flicker_ss')

	odtpow  = odt_wave('odtpow',  None, flicker_ss, volt=odtpow0)
	bfield  = wfm.wave('bfield',  f('FESHBACH','bias'), flicker_ss)
	
	odtpow.linear( f('FLICKER','cpow'), f('FLICKER','cdt') )
	odtpow.appendhold( f('FLICKER','waitdt'))
	bfield.extend(odtpow.dt())
	
	bfield.linear( f('FLICKER','bflick'), f('FLICKER','bdt') )
	bfield.appendhold( f('FLICKER','waitdt2'))
	
	odtpow.extend( bfield.dt() )
	
	return odtpow, bfield, odtpow.dt()
Esempio n. 17
0
def odt_trapfreq(odtpow0):
	mod_ss = f('TRAPFREQ','mod_ss')

	odtpow  = odt_wave('odtpow',  None, mod_ss, volt=odtpow0)
	bfield  = wfm.wave('bfield',  f('FESHBACH','bias'), mod_ss)
	
	odtpow.linear( f('TRAPFREQ','cpow'), f('TRAPFREQ','cdt') )
	odtpow.appendhold( f('TRAPFREQ','waitdt'))
	bfield.extend(odtpow.dt())
	
	bfield.linear( f('TRAPFREQ','bmod'), f('TRAPFREQ','bdt') )
	bfield.appendhold( f('TRAPFREQ','waitdt2'))
	
	odtpow.extend( bfield.dt() )
	#odtpow.SineMod( f('TRAPFREQ','cpow'), f('TRAPFREQ','moddt'), f('TRAPFREQ','modfreq'), f('TRAPFREQ','moddepth'))
	#odtpow.SineMod2( f('TRAPFREQ','cpow'), f('TRAPFREQ','moddt'), f('TRAPFREQ','modfreq'), f('TRAPFREQ','moddepth'))
	odtpow.SineMod3( f('TRAPFREQ','cpow'), f('TRAPFREQ','moddt'), f('TRAPFREQ','modfreq'), f('TRAPFREQ','moddepth'))
	
	return odtpow, bfield, odtpow.dt()
Esempio n. 18
0
def odt_evap(image):
    evap_ss = f("EVAP", "evapss")

    p0 = f("ODT", "odtpow")
    p1 = f("EVAP", "p1")
    t1 = f("EVAP", "t1")
    tau = f("EVAP", "tau")
    beta = f("EVAP", "beta")

    odtpow = wfm.wave("odtpow", cnv("odtpow", p0), evap_ss)
    odtpow.Evap(p0, p1, t1, tau, beta, image)

    # ~ odtpow.Exponential(pow0,powf,evap_dt,tau)
    # ~ odtpow.linear( cnv('odtpow',powf), evap_ss)
    # ~ odtpow.appendhold( evap_dt)

    maxDT = odtpow.dt()

    return odtpow, maxDT
Esempio n. 19
0
def odt_evap(image):
    evap_ss = f('EVAP', 'evapss')

    p0 = f('ODT', 'odtpow')
    p1 = f('EVAP', 'p1')
    t1 = f('EVAP', 't1')
    tau = f('EVAP', 'tau')
    beta = f('EVAP', 'beta')

    odtpow = wfm.wave('odtpow', cnv('odtpow', p0), evap_ss)
    odtpow.Evap(p0, p1, t1, tau, beta, image)

    #~ odtpow.Exponential(pow0,powf,evap_dt,tau)
    #~ odtpow.linear( cnv('odtpow',powf), evap_ss)
    #~ odtpow.appendhold( evap_dt)

    maxDT = odtpow.dt()

    return odtpow, maxDT
Esempio n. 20
0
def odt_trapfreq(odtpow0):
    mod_ss = f('TRAPFREQ', 'mod_ss')

    odtpow = odt_wave('odtpow', None, mod_ss, volt=odtpow0)
    bfield = wfm.wave('bfield', f('FESHBACH', 'bias'), mod_ss)

    odtpow.linear(f('TRAPFREQ', 'cpow'), f('TRAPFREQ', 'cdt'))
    odtpow.appendhold(f('TRAPFREQ', 'waitdt'))
    bfield.extend(odtpow.dt())

    bfield.linear(f('TRAPFREQ', 'bmod'), f('TRAPFREQ', 'bdt'))
    bfield.appendhold(f('TRAPFREQ', 'waitdt2'))

    odtpow.extend(bfield.dt())
    #odtpow.SineMod( f('TRAPFREQ','cpow'), f('TRAPFREQ','moddt'), f('TRAPFREQ','modfreq'), f('TRAPFREQ','moddepth'))
    #odtpow.SineMod2( f('TRAPFREQ','cpow'), f('TRAPFREQ','moddt'), f('TRAPFREQ','modfreq'), f('TRAPFREQ','moddepth'))
    #odtpow.SineMod3( f('TRAPFREQ','cpow'), f('TRAPFREQ','moddt'), f('TRAPFREQ','modfreq'), f('TRAPFREQ','moddepth'))
    odtpow.SineMod4(f('TRAPFREQ', 'cpow'), f('TRAPFREQ', 'moddt'),
                    f('TRAPFREQ', 'modfreq'), f('TRAPFREQ', 'moddepth'))

    return odtpow, bfield, odtpow.dt()
Esempio n. 21
0
def uvzsload_imaging():
	# Initialize channels to MOT SS values and with cncstepsize
	ss=f('CNC','cncstepsize')
	motpow   = wfm.wave('motpow', f('MOT','motpow')   ,ss)
	repdet   = wfm.wave('repdet', f('MOT','repdetSS') ,ss)
	trapdet  = wfm.wave('trapdet',f('MOT','trapdetSS'),ss)
	reppow   = wfm.wave('reppow', f('MOT','reppowSS') ,ss)
	trappow  = wfm.wave('trappow',f('MOT','trappowSS'),ss)
	bfield   = wfm.wave('bfield', f('MOT','bfield')   ,ss)
	
	sec='ZSLOAD'
	
	#Insert bfield imaging value at release
	bfdt = 0.0
	bfield.linear(f(sec,'imgbfield'),bfdt)
	
	#Insert AOM imaging values 30us after release
	imgdt=0.03
	motpow.appendhold(imgdt)
	repdet.appendhold(imgdt)
	trapdet.appendhold(imgdt)
	reppow.appendhold(imgdt)
	trappow.appendhold(imgdt)
	
	motpow.linear( f(sec,'imgpow'),    0.0)
	#repdet.linear( f(sec,'imgdetrep'), 0.0)
	repdet.linear( f(sec,'imgdettrap'), 0.0)
	trapdet.linear(f(sec,'imgdettrap'),0.0)
	reppow.linear( f(sec,'imgpowrep'), 0.0)
	trappow.linear(f(sec,'imgpowtrap'),0.0)

	maxDT = max( motpow.dt(), repdet.dt(), trapdet.dt(), bfield.dt(), reppow.dt(), trappow.dt())

	motpow.extend(maxDT)
	repdet.extend(maxDT)
	trapdet.extend(maxDT)
	bfield.extend(maxDT)
	reppow.extend(maxDT)
	trappow.extend(maxDT)
	
	return motpow, repdet, trapdet, reppow, trappow, bfield
def  go_to_highfield(s):

	#---Keep ODT on
	odton = gen.bstr('ODT',report)
	if odton == True:
		s.digichg('odtttl',1)
	s.wait(20.0)

	ss = SEQ.analogstepsize

	#---Cool and Compress MOT
	#---ENDCNC is defined as the time up to release from the MOT
	motpow, repdet, trapdet, reppow, trappow, bfield, ENDCNC = cnc.cncRamps()

	#---Load UVMOT from CNCMOT
	uvpow2, uvpow, motpow, bfield, ENDUVMOT = uvmot.uvRamps(motpow, bfield, ENDCNC)

	repdet.extend(ENDUVMOT)
	trapdet.extend(ENDUVMOT)
	reppow.extend(ENDUVMOT)
	trappow.extend(ENDUVMOT)
	
	#---Make sure everything has the same length before setting imaging values
	#--- Set imaging values
	camera = 'ANDOR'
	motpow, repdet, trapdet, reppow, trappow, maxDT = cnc.imagingRamps_nobfield(motpow, repdet, trapdet, reppow, trappow, camera)


	#---Switch bfield to FESHBACH 
	bfield.appendhold(FB.rampdelay)
	bfield.linear( FB.bf, FB.rampbf)
	bfield.appendhold( FB.feshbachdt)
	bfield.linear(0.0, 0.0)
	bfield.appendhold( FB.switchondt + FB.switchdelay + UV.extradt)
	bfield.linear(FB.bias,FB.rampdt)


	#---Set the starting voltage for the ODT
	odtpow0 = odt.odt_wave('odtpow', ODT.odtpow0, ss)
	odtpow0.extend(ENDUVMOT)
	
	#---Change shunt value from motV to hfV before going to highfield
	shunt = wfm.wave('gradientfield', SHUNT.motV, ss, volt = SHUNT.motV)
	shunt.extend(ENDUVMOT + FB.rampdelay + FB.rampbf + FB.feshbachdt + UV.extradt) 
	#shunt.linear(SHUNT.hfV, 0.0,volt =SHUNT.hfV)	
	shunt.linear(SHUNT.hfV, 0.0,volt =0.0)	
	
	
	wfms = [ motpow, repdet, trapdet, bfield, reppow, trappow, uvpow, uvpow2,odtpow0, shunt]

	
	#---Add waveforms to sequence
	s.analogwfm_add(ss,wfms)
	
		
	#wait normally rounds down using floor, here the duration is changed before so that
	#the wait is rounded up
	ENDUVMOT = ss*math.ceil(ENDUVMOT/ss)
	
	#---Insert QUICK pulse for fast ramping of the field gradient during CNC
	s.wait(-10.0)
	quickval = 1 if gen.bstr('CNC',report) == True else 0
	s.digichg('quick',quickval)	
	s.wait(10.0)
	s.wait(ENDCNC)
	s.digichg('quick',0)
	
	#---Go back in time, shut down the UVAOM's and open the shutter
	#---UVAOM's were on to keep them warm
	s.wait(-50.0)
	s.digichg('uvaom1',0)
	s.digichg('uvaom2',0)
	s.digichg('uvshutter',1)
	s.wait(50.0)
	
	#---Insert ODT overlap 
	s.wait(-ODT.overlapdt-ODT.servodt)
	s.digichg('odt7595',1)
	s.wait(ODT.servodt)
	s.digichg('odtttl',1)
	s.wait(ODT.overlapdt)
	
	#---Turn OFF red light
	s.wait(UV.delay_red)
	s.digichg('motswitch',0) 
	s.digichg('motshutter',1)
	s.wait(-UV.delay_red)
	
	#---Turn ON UVAOM's
	s.wait(UV.delay_uv)
	s.digichg('uvaom1',1)
	s.digichg('uvaom2',1)
	s.wait(-UV.delay_uv)
	

	#---Go to MOT release time
	s.wait(-ENDCNC)
	s.wait(ENDUVMOT)
	

	#---Go to end of field rampdown and set QUICK back to low
	s.wait(FB.rampdelay+FB.rampbf) 
	s.digichg('quick',0)
	

	#---Wait in the UVMOT and then do optical pumping
	s.wait(UV.extradt) 
	s.wait(-UV.pumptime)
	s.digichg('uvaom2',0)
	s.wait(UV.pumptime)
	#---Turn OFF UVAOM
	s.digichg('uvaom1',0)
	#---Close UV shutter
	waitshutter=5.0
	s.wait(waitshutter)
	s.digichg('uvshutter',0)
	s.wait(-waitshutter)

	#---Turn OFF MOT magnetic field and switch it to FESHBACH
	s.digichg('field',0)
	s.wait( FB.feshbachdt )
	s.digichg('feshbach',1)
	s.wait(FB.switchondt)
	do_quick=1
	s.digichg('field',1)
	s.digichg('hfquick',do_quick)
	s.digichg('quick',do_quick)
	#Can't leave quick ON for more than quickmax
	quickmax=100.
	s.wait(quickmax)
	s.digichg('hfquick',0)
	s.digichg('quick',0)
	s.wait(-quickmax)
	#
	s.wait(FB.switchdelay+FB.rampdt)
	s.digichg('quick',0)
	s.wait(-FB.rampdt)
	s.wait(-FB.switchdelay - FB.switchondt - FB.feshbachdt - ss)


	#---At this point the time sequence is at ENDUVMOT
	#---Leave the sequence at the end of the UVMOT, but provide the amount
	#---of time that it needs to wait to go to ENDBFIELD
	toENDBFIELD = FB.rampdt + FB.switchdelay + FB.switchondt + FB.feshbachdt
	
	return s, toENDBFIELD
Esempio n. 23
0
def  go_to_highfield(s):

	#Keep ODT on
	ODT = gen.bstr('ODT',report)
	if ODT == True:
		s.digichg('odtttl',1)
	s.wait(20.0)

	ss = float(report['SEQ']['analogstepsize'])

	# Cool and Compress MOT
	# ENDCNC is defined as the time up to release from the MOT
	motpow, repdet, trapdet, reppow, trappow, bfield, ENDCNC = cnc.cncRamps()

	# Load UVMOT from CNCMOT
	uvfppiezo, uvpow, motpow, repdet, trapdet, reppow, trappow, bfield, ENDUVMOT = uvcooling.uvcoolRamps(motpow, repdet, trapdet, reppow, trappow, bfield, ENDCNC)

	# Set imaging values
	camera = 'ANDOR'
	motpow, repdet, trapdet, reppow, trappow, maxDT = cnc.imagingRamps_nobfield(motpow, repdet, trapdet, reppow, trappow, camera)

	# Switch bfield to FESHBACH
	overlapdt    = float(report['ODT']['overlapdt'])
	rampdelay    = float(report['ODT']['rampdelay'])
	rampbf       = float(report['ODT']['rampbf'])
	bf           = float(report['ODT']['bf'])
	feshbachdt   = float(report['ODT']['feshbachdt'])
	switchondt  = float(report['FESHBACH']['switchondt'])
	switchdelay  = float(report['FESHBACH']['switchdelay'])
	bias         = float(report['FESHBACH']['bias'])
	biasrampdt   = float(report['FESHBACH']['rampdt'])

	bfield.chop(ENDUVMOT-overlapdt)
	bfield.appendhold(rampdelay)
	bfield.linear( bf, rampbf)
	bfield.extend(ENDUVMOT+feshbachdt)
	bfield.linear(0.0, 0.0)
	ENDBFIELD = feshbachdt
	bfield.appendhold( switchondt + switchdelay)
	bfield.linear(bias,biasrampdt)

	rampupdt = float(report['ODT']['rampupdt'])
	updt = float(report['ODT']['updt'])
	overshootdt = float(report['ODT']['overshootdt'])
	
	#~ odtpow0 = wfm.wave('odtpow', 0.0, ss)
	#~ odtpow0.extend(ENDUVMOT-overlapdt-updt-rampupdt)
	#~ odtpow0.odt_linear( 0.0 , f('ODT','odtpow0'), rampupdt)
	#~ odtpow0.appendhold( updt)
	#~ odtpow0.odt_linear(f('ODT','odtpow0'), f('ODT','odtpow'), overshootdt)

	odtpow0 = wfm.wave('odtpow', f('ODT','odtpow0'), ss)
	odtpow0.extend(ENDUVMOT-overlapdt)
	odtpow0.odt_linear(f('ODT','odtpow0'), f('ODT','odtpow'), overshootdt)

	
	EXTRA = max( overshootdt - (bfield.dt() - (ENDUVMOT-overlapdt-updt-rampupdt)) , 0.0) 
	print "...EXTRA time to allow for ODT overshoot = %f"  % EXTRA


	#Add waveforms to sequence
	s.analogwfm_add(ss,[ motpow, repdet, trapdet, bfield, reppow, trappow, uvfppiezo, uvpow, odtpow0])
	
	#wait normally rounds down using floor, here the duration is changed before so that
	#the wait is rounded up
	ENDUVMOT = ss*math.ceil(ENDUVMOT/ss)
	
	#insert QUICK pulse  for fast ramping of the field gradient
	s.wait(-10.0)
	quickval = 1 if gen.bstr('CNC',report) == True else 0
	s.digichg('quick',quickval)	
	s.wait(10.0)

	#insert UV pulse
	uvtime  = float(report['UV']['uvtime'])
	s.wait(ENDCNC)
	s.digichg('quick',0)
	s.wait(uvtime)
	#Shut down the UVAOM's and open the shutter
	s.wait(-50.0)
	s.digichg('uvaom1',0)
	s.digichg('uvaom2',0)
	s.digichg('uvshutter',1)
	s.wait(50.0)
	#Turn on UVAOM
	s.digichg('uvaom1',1)
	s.wait(-uvtime - ENDCNC)
	
	#Go to MOT release time and set QUICK back to low
	s.wait(ENDUVMOT)
	s.digichg('quick',0)

	#Leave UVMOT on for state transfer
	fstatedt  = float(report['ODT']['fstatedt'])
	s.wait(fstatedt)
	s.digichg('uvaom1',0)
	s.wait(-fstatedt) 


	#RELEASE FROM MOT
	waitshutter=5.0
	s.wait(waitshutter)
	s.digichg('uvshutter',0)
	#~ s.wait(20.0)
	#~ s.digichg('uvaom1',0)
	#~ s.digichg('uvaom2',0)
	#~ s.wait(-20.0)
	s.wait(-waitshutter)

	s.digichg('motswitch',0) 
	s.digichg('motshutter',1)
	s.digichg('field',0)

	#Insert ODT overlap with UVMOT and switch field to FESHBACH
	overlapdt = float(report['ODT']['overlapdt'])
	servodt = float(report['ODT']['servodt'])
	s.wait(-overlapdt-servodt)
	s.digichg('odt7595',1)
	s.wait(servodt)
	s.digichg('odtttl',1)
	#feshbachdt = rampdelay + rampbf + holdbf
	s.wait(overlapdt)
	s.wait( feshbachdt )
	s.digichg('feshbach',1)
	#s.wait(overlapdt - feshbachdt)
	#s.wait( -feshbachdt)
	

	#s.wait(offdelay)
	#s.wait(2*switchdt)
	#s.wait(quickdelay)
	s.wait(switchondt)
	do_quick=1
	s.digichg('field',1)
	s.digichg('hfquick',do_quick)
	s.digichg('quick',do_quick)
	#Can't leave quick ON for more than quickmax
	quickmax=100.
	s.wait(quickmax)
	s.digichg('hfquick',0)
	s.digichg('quick',0)
	s.wait(-quickmax)
	s.wait(switchdelay+biasrampdt)
	s.digichg('quick',0)
	s.wait(-biasrampdt)
	#s.wait(-switchdelay-quickdelay-2*switchdt-offdelay)
	s.wait(-switchdelay - switchondt - feshbachdt - ss)

	#At this point the time sequence is at ENDUVMOT
	
	#This is the time until the end of the bfield ramp
	#toENDBFIELD = biasrampdt + switchdelay + quickdelay + 2*switchdt + offdelay
	toENDBFIELD = biasrampdt + switchdelay + switchondt + feshbachdt
	
	return s, toENDBFIELD + EXTRA
Esempio n. 24
0
def dimple_to_lattice(s, cpowend):

    print "----- LATTICE LOADING RAMPS -----"

    dt = DL.dt
    N0 = 0

    N = int(math.floor(dt / DL.ss))
    x = numpy.arange(dt / N, dt, dt / N)

    print "%d samples" % N
    print x.shape

    # Define how we want to ramp up the lattice depth
    v0_ramp, xy_v0, v0set = interpolate_ramp(DL.latticeV0)
    v0 = v0_ramp(x)

    NH = int(math.floor(DL.dthold / DL.ss))

    v0 = numpy.concatenate((numpy.zeros(N0), v0, numpy.array(NH * [v0[-1]])))

    x_v0 = numpy.arange(v0.size)
    x_v0 = x_v0 * DL.ss

    # Number of samples to keep
    NS = int(math.floor(DL.image / DL.ss))
    if NS > v0.size and DL.image < 2500.:
        x_v0 = numpy.append(x_v0, (NS - v0.size) * [x_v0[-1]])
        v0 = numpy.append(v0, (NS - v0.size) * [v0[-1]])

    else:
        x_v0 = x_v0[:NS]
        v0 = v0[:NS]

    ###########################################
    #### AXIS DEFINITIONS FOR PLOTS ###
    ###########################################

    fig = plt.figure(figsize=(4.5 * 1.05, 8. * 1.1))
    ax0 = fig.add_axes([0.18, 0.76, 0.76, 0.20])
    ax2 = fig.add_axes([0.18, 0.645, 0.76, 0.11])
    ax3 = fig.add_axes([0.18, 0.53, 0.76, 0.11])
    ax1 = fig.add_axes([0.18, 0.415, 0.76, 0.11])
    ax5 = fig.add_axes([0.18, 0.30, 0.76, 0.11])
    ax4 = fig.add_axes([0.18, 0.185, 0.76, 0.11])
    ax6 = fig.add_axes([0.18, 0.07, 0.76, 0.11])

    lw = 1.5
    labelx = -0.12
    legsz = 8.

    xymew = 0.5
    xyms = 9

    ax0.plot(x_v0, v0, 'b', lw=2.5, label='Lattice depth')
    ax0.plot(xy_v0[:, 0], xy_v0[:, 1], 'x', color='blue', ms=5.)
    ax0.plot(v0set[:, 0], v0set[:, 1], '.', mew=xymew, ms=xyms, color='blue')

    ###########################################
    #### USER DEFINED RAMPS: IR, GR, and U ###
    ###########################################

    # Define how we want to ramp up the IR power
    if DIMPLE.allirpow > 0.:
        ir_offset = DIMPLE.allirpow
    else:
        ir_offset = DIMPLE.ir1pow2
    ir_ramp, xy_ir, ir = interpolate_ramp(DL.irpow, yoffset=ir_offset)

    dt_ir = numpy.amax(ir[:, 0]) - numpy.amin(ir[:, 0])
    N_ir = int(math.floor(dt_ir / DL.ss))
    x_ir = numpy.arange(dt_ir / N_ir, dt_ir, dt_ir / N_ir)

    #y_ir = ir_spline(x_ir)
    y_ir = ir_ramp(x_ir)

    if v0.size > y_ir.size:
        y_ir = numpy.append(y_ir, (v0.size - y_ir.size) * [y_ir[-1]])
    elif v0.size < y_ir.size:
        y_ir = y_ir[0:v0.size]

    if v0.size != y_ir.size:
        msg = "IRPOW ERROR: number of samples in IR ramp and V0 ramp does not match!"
        errormsg.box('LATTICE LOADING ERROR', msg)
        exit(1)

    alpha_clip_range = 0.1
    if (v0 > y_ir + alpha_clip_range).any():
        msg = "IRPOW ERROR:  not enough power to get desired lattice depth"
        print msg
        bad = numpy.where(v0 > y_ir + alpha_clip_range)
        timefail = int(bad[0][0]) * float(DL.ss)
        msg = msg + "\nFirst bad sample = %d out of %d" % (bad[0][0], v0.size)
        msg = msg + "\n  t = %f " % timefail
        msg = msg + "\n v0 = %f " % v0[bad[0][0]]
        msg = msg + "\n ir = %f " % y_ir[bad[0][0]]
        print v0[bad[0][0]]
        print y_ir[bad[0][0]]
        errormsg.box('LATTICE LOADING ERROR', msg)
        exit(1)

    ax0.plot(xy_ir[:, 0], xy_ir[:, 1], 'x', color='darkorange', ms=5.)
    ax0.plot(ir[:, 0], ir[:, 1], '.', mew=xymew, ms=xyms, color='darkorange')
    ax0.plot(x_v0, y_ir, lw=lw, color='darkorange', label='irpow')

    # Define how we want to ramp up the GR power
    grwfms = {}
    splmrkr = ['x', '+', 'd']
    ptsmrkr = ['^', 's', 'p']
    for i, grramp in enumerate([(DL.grpow1, DIMPLE.gr1pow2),
                                (DL.grpow2, DIMPLE.gr2pow2),
                                (DL.grpow3, DIMPLE.gr3pow2)]):
        ramppts = grramp[0]
        ramp0 = grramp[1]

        print 'gr' + '%d' % i + ' offset = %f' % ramp0

        gr_ramp, xy_gr, gr = interpolate_ramp(ramppts, yoffset=ramp0)

        dt_gr = numpy.amax(gr[:, 0]) - numpy.amin(gr[:, 0])
        N_gr = int(math.floor(dt_gr / DL.ss))
        x_gr = numpy.arange(dt_gr / N_gr, dt_gr, dt_gr / N_gr)

        y_gr = gr_ramp(x_gr)

        if v0.size > y_gr.size:
            y_gr = numpy.append(y_gr, (v0.size - y_gr.size) * [y_gr[-1]])
        elif v0.size < y_gr.size:
            y_gr = y_gr[0:v0.size]

        if v0.size != y_gr.size:
            msg = "GRPOW ERROR: number of samples in GR ramp and V0 ramp does not match!"
            errormsg.box('LATTICE LOADING ERROR', msg)
            exit(1)

        grwfms['greenpow' + '%1d' % (i + 1)] = y_gr

        ax0.plot(xy_gr[:, 0],
                 xy_gr[:, 1],
                 marker=splmrkr[i],
                 mec='green',
                 mfc='None',
                 ms=3.)
        ax0.plot(gr[:, 0],
                 gr[:, 1],
                 marker=ptsmrkr[i],
                 mew=xymew,
                 ms=xyms / 2.,
                 mfc='None',
                 mec='green')  #, label='grpow dat')
        ax0.plot(x_v0, y_gr, lw=lw, color='green', label='grpow')

    for grch in grwfms.keys():
        print grch, " = ", grwfms[grch].shape

    ax0.set_xlim(left=-10., right=ax0.get_xlim()[1] * 1.1)
    plt.setp(ax0.get_xticklabels(), visible=False)
    ylim = ax0.get_ylim()
    extra = (ylim[1] - ylim[0]) * 0.1
    ax0.set_ylim(ylim[0] - extra, ylim[1] + extra)
    ax0.grid(True)
    ax0.set_ylabel('$E_{r}$', size=16, labelpad=0)
    ax0.yaxis.set_label_coords(labelx, 0.5)
    ax0.set_title('Lattice Loading')
    ax0.legend(loc='best', numpoints=1, prop={'size': legsz * 0.8})

    # Define how we want to ramp up the scattering length (control our losses)
    a_s_ramp, xy_a_s, a_s = interpolate_ramp(DL.a_s)

    dt_a_s = numpy.amax(a_s[:, 0]) - numpy.amin(a_s[:, 0])
    N_a_s = int(math.floor(dt_a_s / DL.ss))
    x_a_s = numpy.arange(dt_a_s / N_a_s, dt_a_s, dt_a_s / N_a_s)
    y_a_s = a_s_ramp(x_a_s)

    if v0.size > y_a_s.size:
        y_a_s = numpy.append(y_a_s, (v0.size - y_a_s.size) * [y_a_s[-1]])
    elif v0.size < y_a_s.size:
        y_a_s = y_a_s[0:v0.size]

    if v0.size != y_a_s.size:
        msg = "a_s ERROR: number of samples in a_s ramp and V0 ramp does not match!"
        errormsg.box('LATTICE LOADING ERROR', msg)
        exit(1)

    ax1.plot(xy_a_s[:, 0], xy_a_s[:, 1] / 100., 'x', color='#C10087', ms=5.)
    ax1.plot(a_s[:, 0],
             a_s[:, 1] / 100.,
             '.',
             mew=xymew,
             ms=xyms,
             color='#C10087')
    ax1.plot(x_v0,
             y_a_s / 100.,
             lw=lw,
             color='#C10087',
             label=r'$a_s\mathrm{(100 a_{0})}$')
    ax1.set_ylabel(r'$a_s\mathrm{(100 a_{0})}$', size=16, labelpad=0)
    ax1.yaxis.set_label_coords(labelx, 0.5)

    ax1.set_xlim(ax0.get_xlim())
    ylim = ax1.get_ylim()
    extra = (ylim[1] - ylim[0]) * 0.1
    ax1.set_ylim(ylim[0] - extra, ylim[1] + extra)
    plt.setp(ax1.get_xticklabels(), visible=False)
    ax1.grid(True)
    ax1.legend(loc='best', numpoints=1, prop={'size': legsz})

    #######################################################################
    #### CALCULATED RAMPS:  ALPHA, TUNNELING, SCATTERING LENGTH, BFIELD ###
    #######################################################################

    alpha = (v0 / y_ir)**2.

    alpha_advance = 100.
    N_adv = int(math.floor(alpha_advance / DL.ss))

    alpha = alpha.clip(0., 1.)
    alpha_desired = numpy.copy(alpha)

    if N_adv < v0.size:
        alpha = alpha[N_adv:]
        alpha = numpy.append(alpha, (v0.size - alpha.size) * [alpha[-1]])
    else:
        alpha = numpy.array(v0.size * [alpha[-1]])

    #alpha = alpha.clip(0., 1.)

    ax2.plot(x_v0, alpha, lw=lw, color='saddlebrown', label='alpha adv')
    ax2.plot(x_v0,
             alpha_desired,
             ':',
             lw=lw,
             color='saddlebrown',
             label='alpha')

    ax2.set_xlim(ax0.get_xlim())
    ax2.set_ylim(-0.05, 1.05)
    plt.setp(ax2.get_xticklabels(), visible=False)
    ax2.grid()
    ax2.set_ylabel('$\\alpha$', size=16, labelpad=0)
    ax2.yaxis.set_label_coords(labelx, 0.5)

    ax2.legend(loc='best', numpoints=1, prop={'size': legsz})

    tunneling_Er = physics.inv('t_to_V0', v0)
    tunneling_kHz = tunneling_Er * 29.2

    ax3.plot(x_v0, tunneling_kHz, lw=lw, color='red', label='$t$ (kHz)')

    ax3.set_xlim(ax0.get_xlim())
    ylim = ax3.get_ylim()
    extra = (ylim[1] - ylim[0]) * 0.1
    ax3.set_ylim(ylim[0] - extra, ylim[1] + extra)
    plt.setp(ax3.get_xticklabels(), visible=False)
    ax3.grid(True)
    ax3.set_ylabel(r'$t\,\mathrm{(kHz)}$', size=16, labelpad=0)
    ax3.yaxis.set_label_coords(labelx, 0.5)
    ax3.legend(loc='best', numpoints=1, prop={'size': legsz})

    wannierF = physics.inv('wF_to_V0', v0)

    bohrRadius = 5.29e-11  #meters
    lattice_spacing = 1.064e-6 / 2.  #meters

    bfieldG = physics.cnv('as_to_B', y_a_s)

    U_over_t = y_a_s * bohrRadius / lattice_spacing * wannierF / tunneling_Er

    ax4.plot(x_v0, U_over_t, lw=lw, color='k', label=r'$U/t$')

    ax4.set_xlim(ax0.get_xlim())
    ylim = ax4.get_ylim()
    extra = (ylim[1] - ylim[0]) * 0.1
    ax4.set_ylim(ylim[0] - extra, ylim[1] + extra)
    plt.setp(ax4.get_xticklabels(), visible=False)
    ax4.grid(True)
    ax4.set_ylabel(r'$U/t$', size=16, labelpad=0)
    ax4.yaxis.set_label_coords(labelx, 0.5)

    ax4.legend(loc='best', numpoints=1, prop={'size': legsz})

    ax5.plot(x_v0, bfieldG, lw=lw, color='purple', label='$B$ (G)')

    ax5.set_xlim(ax0.get_xlim())
    ylim = ax5.get_ylim()
    extra = (ylim[1] - ylim[0]) * 0.1
    ax5.set_ylim(ylim[0] - extra, ylim[1] + extra)
    ax5.grid(True)
    plt.setp(ax5.get_xticklabels(), visible=False)
    ax5.set_ylabel(r'$B\,\mathrm{(G)}$', size=16, labelpad=0)
    ax5.yaxis.set_label_coords(labelx, 0.5)

    ax5.legend(loc='best', numpoints=1, prop={'size': legsz})

    ax6.plot(x_v0, (tunneling_Er / U_over_t),
             lw=lw,
             color='#25D500',
             label=r'$t^{2}/U\,(E_{r)}$')
    #ax6.set_yscale('log')

    ax6.set_xlim(ax0.get_xlim())
    ylim = ax6.get_ylim()
    extra = (ylim[1] - ylim[0]) * 0.1
    ax6.set_ylim(ylim[0] * 0.5, ylim[1])
    ax6.grid(True)
    ax6.set_ylabel(r'$t^{2}/U\,(E_{r)}$', size=16, labelpad=0)
    ax6.yaxis.set_label_coords(labelx, 0.5)

    ax6.legend(loc='best', numpoints=1, prop={'size': legsz})

    ax6.set_xlabel('time (ms)')

    figfile = seqconf.seqtxtout().split('.')[0] + '_latticeRamp.png'
    plt.savefig(figfile, dpi=120)

    #Save all ramps to a txt file for later plotting.
    datfile = seqconf.seqtxtout().split('.')[0] + '_latticeRamp.dat'
    allRamps = numpy.transpose(numpy.vstack((x_v0, v0, y_ir, grwfms['greenpow1'], y_a_s, alpha, alpha_desired, \
                                    tunneling_kHz, U_over_t, bfieldG)))
    header = '# Column index'
    header = header + '\n#\t0\t' + 'time(ms)'
    header = header + '\n#\t1\t' + 'Lattice Depth (Er)'
    header = header + '\n#\t2\t' + 'Ir power (Er)'
    header = header + '\n#\t3\t' + 'GR power (Er)'
    header = header + '\n#\t4\t' + 'a_s (a0)'
    header = header + '\n#\t5\t' + 'alpha - advance'
    header = header + '\n#\t6\t' + 'alpha - desired'
    header = header + '\n#\t7\t' + 'tunneling (kHz)'
    header = header + '\n#\t8\t' + 'U/t'
    header = header + '\n#\t9\t' + 'bfield (Gauss)'
    header = header + '\n'

    numpy.savetxt(datfile, allRamps)

    with open(datfile, 'w') as f:
        X = numpy.asarray(allRamps)
        f.write(bytes(header))

        format = '%.6e'
        ncol = X.shape[1]
        format = [
            format,
        ] * ncol
        format = ' '.join(format)

        newline = '\n'
        for row in X:
            f.write(numpy.compat.asbytes(format % tuple(row) + newline))

    shutil.copyfile(
        figfile,
        seqconf.savedir() + 'expseq' + seqconf.runnumber() +
        '_latticeRamp.png')
    shutil.copyfile(
        datfile,
        seqconf.savedir() + 'expseq' + seqconf.runnumber() +
        '_latticeRamp.dat')
    #plt.savefig( seqconf.savedir() + 'expseq' + seqconf.runnumber() + '_latticeRamp.png', dpi=120)

    #################################
    #### APPEND RAMPS TO SEQUENCE ###
    #################################

    wfms = []

    for ch in ['ir1pow', 'ir2pow', 'ir3pow']:
        n = filter(str.isdigit, ch)[0]
        w = wfm.wave(ch, 0.0, DL.ss)  #Start value will be overrriden
        w.y = physics.cnv(ch, y_ir)
        wfms.append(w)

    for ch in ['greenpow1', 'greenpow2', 'greenpow3']:
        n = filter(str.isdigit, ch)[0]
        w = wfm.wave(ch, 0.0, DL.ss)  #Start value will be overrriden

        correction = DIMPLE.__dict__['gr' + n + 'correct']

        w.y = physics.cnv(ch, correction * grwfms[ch])
        wfms.append(w)

    for ch in ['lcr1', 'lcr2', 'lcr3']:
        n = filter(str.isdigit, ch)[0]
        w = wfm.wave(ch, 0.0, DL.ss)  #Start value will be overrriden
        force = DL.__dict__['force_' + ch]
        if force >= 0 and force <= 1:
            print "...Forcing LCR%s = %f during lattice ramp" % (n, force)
            w.y = physics.cnv(ch, numpy.array(alpha.size * [force]))
        else:
            w.y = physics.cnv(ch, alpha)
        wfms.append(w)

    bfieldA = bfieldG / 6.8

    ##ADD field
    bfield = wfm.wave('bfield', 0.0, DL.ss)
    bfield.y = physics.cnv('bfield', bfieldA)
    wfms.append(bfield)

    ##ADD gradient field
    gradient = gradient_wave('gradientfield', 0.0, DL.ss, volt=0.0)
    gradient.follow(bfield)
    wfms.append(gradient)

    # RF sweep
    if DL.rf == 1:
        rfmod = wfm.wave('rfmod', 0., DL.ss)
        rfmod.appendhold(bfield.dt() + DL.rftime)
        rfmod.linear(DL.rfvoltf, DL.rfpulsedt)
        wfms.append(rfmod)

    #Take care of imaging frequencies, including various kill experiments
    bfieldG = physics.inv('bfield', bfield.y[-1]) * 6.8
    hfimg0 = -1. * (100.0 + 163.7 - 1.414 * bfieldG)

    print "...ANDOR:hfimg and hfimg0 will be modified  in report\n"
    print "\tNEW  ANDOR:hfimg  = %.2f MHz" % (hfimg0 - DL.imgdet)
    print "\tNEW  ANDOR:hfimg0 = %.2f MHz\n" % hfimg0
    gen.save_to_report('ANDOR', 'hfimg', hfimg0 - DL.imgdet)
    gen.save_to_report('ANDOR', 'hfimg0', hfimg0)
    newANDORhfimg = hfimg0 - DL.imgdet

    # Kill hfimg
    if DL.probekill == 1 or DL.braggkill == 1 or DL.lightassist or DL.lightassist_lock:
        hfimgdelay = 50.  #ms
        analogimg = wfm.wave('analogimg', newANDORhfimg, DL.ss)

        if DL.probekill == 1:
            if (-DL.probekilltime + hfimgdelay) < DL.image:
                analogimg.appendhold(bfield.dt() + DL.probekilltime -
                                     hfimgdelay)
                analogimg.linear(DL.probekill_hfimg, 0.0)
                analogimg.appendhold(hfimgdelay + DL.probekilldt + 3 * DL.ss)

        elif DL.braggkill == 1:
            if (-DL.braggkilltime + hfimgdelay) < DL.image:
                analogimg.appendhold(bfield.dt() + DL.braggkilltime -
                                     hfimgdelay)
                analogimg.linear(DL.braggkill_hfimg, 0.0)
                analogimg.appendhold(hfimgdelay + DL.braggkilldt + 3 * DL.ss)

        #elif DL.lightassist == 1 or DL.lightassist_lock:
        #    analogimg.appendhold( bfield.dt()  - hfimgdelay)
        #    analogimg.linear( DL.lightassist_hfimg , 0.0)
        #    duration = DL.lightassist_lockdtUP + DL.lightassist_t0 + DL.lightassistdt + DL.lightassist_lockdtDOWN
        #    analogimg.appendhold( hfimgdelay + duration + 3*DL.ss)

        analogimg.linear(newANDORhfimg, 0.)
        analogimg.extend(10)
        wfms.append(analogimg)

    #analogimg = bfieldwfm.hfimg_wave('analogimg', ANDOR.hfimg, DL.ss)
    #andorhfimg0 = analogimg.follow(bfield, DL.imgdet)
    #wfms.append(analogimg)

    # If we are doing round trip END, then mirror all the ramps
    # before adding them to the sequence
    if DL.round_trip == 1:
        if DL.round_trip_type == 1:
            maxdt = 0.
            maxi = -1
            for i, w in enumerate(wfms):
                if w.dt() > maxdt:
                    maxdt = w.dt()
                    maxi = i

            maxdt = maxdt + DL.wait_at_top / 2.

            for w in wfms:
                w.extend(maxdt)
                if 'lcr' in w.name:
                    yvals = w.y

                    #Get the reverse of the alpha desired array
                    alpha_mirror = numpy.copy(alpha_desired[::-1])

                    #Add the wait at top part so that it has same length as yvals
                    if alpha_mirror.size > yvals.size:
                        print "Error making mirror ramp for LCR."
                        print "Program will exit."
                        exit(1)
                    alpha_mirror = numpy.append(
                        (yvals.size - alpha_mirror.size) * [alpha_mirror[0]],
                        alpha_mirror)

                    #This is how much the mirror ramp will be advanced
                    N_adv = int(math.floor(DL.lcr_mirror_advance / DL.ss))

                    if N_adv < alpha_mirror.size:
                        alpha_mirror = alpha_mirror[N_adv:]
                        alpha_mirror = numpy.append(
                            alpha_mirror, (yvals.size - alpha_mirror.size) *
                            [alpha_mirror[-1]])
                    else:
                        alpha_mirror = numpy.array(yvals.size *
                                                   [alpha_mirror[-1]])

                    w.y = numpy.concatenate(
                        (yvals, physics.cnv(w.name, alpha_mirror)))
                else:
                    w.mirror()
                w.appendhold(DL.wait_at_end)

    N_adv = int(math.floor(alpha_advance / DL.ss))

    alpha_desired = numpy.copy(alpha)

    for wavefm in wfms:
        print "%s dt = %f" % (wavefm.name, wavefm.dt())

    #Wait the buffer for the lattice loading ramps before adding them
    bufferdt = 20.
    s.wait(bufferdt)
    #Add lattice wfms
    duration = s.analogwfm_add(DL.ss, wfms)

    if DL.image < 2500.:
        s.wait(duration)
    else:
        print "...DL.image = %f  >= 2500.  Digital seq extension will be used." % DL.image
        s.wait(DL.image)

    #Here give some buffer time to do lock, RF etc.
    #It has to be minimum 5.0 ms

    ### Figure out when to turn interlock back on, using alpha information
    #~ if duration > DL.t0 + DL.dt:
    #~ s.wait(-DL.lattice_interlock_time)
    #~ if DL.use_lattice_interlock == 1:
    #~ s.digichg('latticeinterlockbypass',0)
    #~ else:
    #~ s.digichg('latticeinterlockbypass',1)
    #~ s.wait( DL.lattice_interlock_time)

    return s, y_ir[-1]
Esempio n. 25
0
def cncRamps():
	# Initialize channels to MOT SS values and with cncstepsize
	ss=f('CNC','cncstepsize')
	motpow   = wfm.wave('motpow', f('MOT','motpow')   ,ss)
	repdet   = wfm.wave('repdet', f('MOT','repdetSS') ,ss)
	trapdet  = wfm.wave('trapdet',f('MOT','trapdetSS'),ss)
	reppow   = wfm.wave('reppow', f('MOT','reppowSS') ,ss)
	trappow  = wfm.wave('trappow',f('MOT','trappowSS'),ss)
	bfield   = wfm.wave('bfield', f('MOT','bfield')   ,ss)
	
	CNC = gen.bstr('CNC',report)
	#If CNC is selected in the report then insert necessary linear ramps
	
	#First ramp bfield
	SINH = gen.bstr('sinh',report)
	if SINH == True:
		bfield.sinhRise(f('CNC','bfieldf') if CNC == True else  f('MOT','bfield'),  f('CNC','dtbfield'), f('CNC','dtbfield')*f('CNC','taubfield'))
	else:
		bfield.linear(  f('CNC','bfieldf') if CNC == True else  f('MOT','bfield'),  f('CNC','dtbfield'))
	
	#Hold off start of laser ramps
	delay = f('CNC','delay')
	motpow.appendhold( delay )
	repdet.appendhold( delay )
	trapdet.appendhold( delay )
	reppow.appendhold( delay )
	trappow.appendhold( delay )
	
	#Do laser ramps
	motpow.linear(  f('CNC','motpowf')  if CNC == True else  f('MOT','motpow')    , f('CNC','dtmotpow'))
	repdet.linear(  f('CNC','repdetf')  if CNC == True else  f('MOT','repdetSS')  , f('CNC','dtrepdet'))
	trapdet.linear( f('CNC','trapdetf') if CNC == True else  f('MOT','trapdetSS'),  f('CNC','dttrapdet'))
	reppow.linear(  f('CNC','reppowf')  if CNC == True else  f('MOT','reppowSS')  , f('CNC','dtreppow'))
	trappow.linear( f('CNC','trappowf') if CNC == True else  f('MOT','trappowSS'),  f('CNC','dttrappow'))
	
	#print motpow.dt()
	#Extend all ramps to match current total duration
	print '...CNC = ' + str(CNC)
	ht = (f('CNC','holdtime') if CNC == True else 0.0)
	#print "holdtime = " + str(ht)
	ENDCNC = max( motpow.dt(), repdet.dt(), trapdet.dt(), reppow.dt(), trappow.dt(), bfield.dt() ) + ht
	
	motpow.extend( ENDCNC)
	#print motpow.dt()
	repdet.extend( ENDCNC)
	trapdet.extend(ENDCNC)
	bfield.extend( ENDCNC)
	reppow.extend( ENDCNC)
	trappow.extend( ENDCNC)
	maxN=int(math.floor( (ENDCNC)/ss))+1
	
	#print motpow.dt()
	#print reppow.dt()
	#print trappow.dt()
	#print repdet.dt()
	#print trapdet.dt()
	#print bfield.dt()
	#print uvdet.dt()
	
	#Up to here you have a Cooled and Compressed MOT
	#
	return motpow, repdet, trapdet, reppow, trappow, bfield, ENDCNC
s, toENDBFIELD = highfield_uvmot.go_to_highfield(s)


# Evaporate in cross beam trap
s, endcrap = odt.crossbeam_evap(s, toENDBFIELD)


# Go to scattering length zero-crossing
evap_ss = float(report['EVAP']['evapss'])
buffer=20.0 #Time needed to re-latch the trigger for the AOUTS
s.wait(buffer)
bias = float(report['FESHBACH']['bias'])
zcrampdt = float(report['ZEROCROSS']['zcrampdt'])
zcdt = float(report['ZEROCROSS']['zcdt'])
zcbias = float(report['ZEROCROSS']['zcbias'])
bfield = wfm.wave('bfield',bias,evap_ss)
bfield.linear(zcbias,zcrampdt)
bfield.appendhold(zcdt)
s.analogwfm_add(evap_ss,[bfield])
s.wait(zcdt+zcrampdt)


buffer=25.0 #Time needed to re-latch the trigger for the AOUTS
s.wait(buffer)

# Ramp up IR and green beams
irramp1 = float(report['LATTICE']['irrampdt1'])
irramp2 = float(report['LATTICE']['irrampdt2'])
irramp3 = float(report['LATTICE']['irrampdt3'])
odtoverlap = float(report['LATTICE']['mantaodtoverlap'])
irdelay1 = float(report['LATTICE']['irdelay1'])
def rampupcnv( ch, delay, pow, ramp, cnvflag):
    w = wfm.wave( ch, 0., ir_ss)
    w.appendhold( delay)
    w.linear( pow, ramp, cnvflag)
    return w
Esempio n. 28
0
def constructUVSpecRamps(cam):
    global report

    # Initialize channels to MOT SS values and with cncstepsize
    ss = f('CNC', 'cncstepsize')
    motpow = wfm.wave(cnv('motpow', f('MOT', 'motpow')), ss)
    repdet = wfm.wave(cnv('repdet', f('MOT', 'repdetSS')), ss)
    trapdet = wfm.wave(cnv('trapdet', f('MOT', 'trapdetSS')), ss)
    reppow = wfm.wave(cnv('reppow', f('MOT', 'reppowSS')), ss)
    trappow = wfm.wave(cnv('trappow', f('MOT', 'trappowSS')), ss)
    bfield = wfm.wave(cnv('bfield', f('MOT', 'bfield')), ss)

    #Ramp down  bfield
    bfield.linear(cnv('bfield', f('UVSPEC', 'uvbfield')), 10 * ss)
    bfield.appendhold(f('UVSPEC', 'lowfieldDT'))

    maxCNCdt = max(motpow.dt(), repdet.dt(), trapdet.dt(), bfield.dt())

    DURATION = maxCNCdt

    motpow.extend(DURATION)
    repdet.extend(DURATION)
    trapdet.extend(DURATION)
    bfield.extend(DURATION)

    maxN = int(math.floor((DURATION) / ss)) + 1

    #Initialize AO power channels
    reppow = wfm.wave(cnv('reppow', f('MOT', 'reppowSS')), ss, maxN)
    trappow = wfm.wave(cnv('trappow', f('MOT', 'trappowSS')), ss, maxN)

    #Insert bfield imaging value at release
    bfield.linear(cnv('bfield', f(cam, 'imgbfield')), 0.0)

    #Insert AOM imaging values 50us after release
    imgdt = 0.2
    motpow.appendhold(imgdt)
    repdet.appendhold(imgdt)
    trapdet.appendhold(imgdt)
    reppow.appendhold(imgdt)
    trappow.appendhold(imgdt)

    motpow.linear(cnv('motpow', f(cam, 'imgpow')), 0.0)
    repdet.linear(cnv('repdet', f(cam, 'imgdetrep')), 0.0)
    trapdet.linear(cnv('trapdet', f(cam, 'imgdettrap')), 0.0)
    reppow.linear(cnv('reppow', f(cam, 'imgpowrep')), 0.0)
    trappow.linear(cnv('trappow', f(cam, 'imgpowtrap')), 0.0)


    maxDT = max( motpow.dt(), repdet.dt(), trapdet.dt(), bfield.dt(),\
     reppow.dt(), trappow.dt())

    motpow.extend(maxDT)
    repdet.extend(maxDT)
    trapdet.extend(maxDT)
    bfield.extend(maxDT)
    reppow.extend(maxDT)
    trappow.extend(maxDT)

    motpow.fileoutput('L:/software/apparatus3/seq/ramps/motpow.txt')
    repdet.fileoutput('L:/software/apparatus3/seq/ramps/repdet.txt')
    trapdet.fileoutput('L:/software/apparatus3/seq/ramps/trapdet.txt')
    bfield.fileoutput('L:/software/apparatus3/seq/ramps/bfield.txt')
    reppow.fileoutput('L:/software/apparatus3/seq/ramps/reppow.txt')
    trappow.fileoutput('L:/software/apparatus3/seq/ramps/trappow.txt')
    return DURATION
#Allow time for free evaporation (also helps provide buffer to reload the analog chs)
buffer=10.0 #Time needed to re-latch the trigger for the AOUTS
if EVAP.free < buffer + toENDBFIELD :
    print 'Need at list ' + str(buffer) + 'ms of EVAP.free evap before evaporation can be triggered'
    print 'Currently ramps end at %f , and EVAP.free is %f' % (toENDBFIELD,EVAP.free)
    exit(1)
s.wait(EVAP.free)


#Do Evap
if int(EVAP.use_field_ramp) == 1:
    bfield, odtpow, ENDEVAP, cpowend, ipganalog= odt.odt_evap_field(EVAP.scale)
else:
    odtpow, ENDEVAP, cpowend, ipganalog = odt.odt_evap(EVAP.scale)
    bfield = wfm.wave('bfield',FESHBACH.bias,EVAP.evapss)
    bfield.extend(odtpow.dt())
#Use the EVAP.image time equal to EVAP.image times EVAP.scale for the sequence after the part.
EVAP.image = EVAP.image *EVAP.scale    


#Ramp the field to the zerocrossing
bfield.linear(ZEROCROSS.zcbias,ZEROCROSS.zcrampdt)
bfield.appendhold(ZEROCROSS.zcdt)
odtpow.extend(bfield.dt())
ipganalog.extend(bfield.dt())


#Recompress with the ODT
if int(EVAP.use_odt_lock) == 1: 
    
Esempio n. 30
0
def crossbeam_evap_into_lattice(s, toENDBFIELD):
	# Add evaporation ramp to ODT, returns sequence right at the end of evaporation
	free = float(report['EVAP']['free'])
	image= float(report['EVAP']['image'])
	buffer=10.0 #Time needed to re-latch the trigger for the AOUTS
	if free < buffer + toENDBFIELD :
		print 'Need at list ' + str(buffer) + 'ms of free evap before evaporation can be triggered'
		print 'Currently ramps end at %f , and free is %f' % (toENDBFIELD,free)
		exit(1)
	s.wait(free)
	odtpow, ENDEVAP, cpowend, ipganalog = odt_evap(image)
	# ENDEVAP should be equal to image
	evap_ss = float(report['EVAP']['evapss'])
	
	# Set LCR preset value in the begining of evap 1 is lattice 0 is dimple
	lcr_preset = float(report['EVAP']['lcr_preset'])
	lcr1  = lattice.lattice_wave('lcr1',lcr_preset, evap_ss)
	lcr2  = lattice.lattice_wave('lcr2', lcr_preset, evap_ss)
	lcr3  = lattice.lattice_wave('lcr3', lcr_preset, evap_ss)
	lcr1.extend(ENDEVAP)
	lcr2.extend(ENDEVAP)
	lcr3.extend(ENDEVAP)
	
	# Ramp up IR and green beams
	irramp1 = float(report['INTOLATTICE']['irrampdt1'])
	irramp2 = float(report['INTOLATTICE']['irrampdt2'])
	irramp3 = float(report['INTOLATTICE']['irrampdt3'])
	irdelay1 = float(report['INTOLATTICE']['irdelay1'])
	irdelay2 = float(report['INTOLATTICE']['irdelay2'])
	irdelay3 = float(report['INTOLATTICE']['irdelay3'])

	ir1  = wfm.wave('ir1pow', 0., evap_ss)
	ir2  = wfm.wave('ir2pow', 0., evap_ss)
	ir3  = wfm.wave('ir3pow', 0., evap_ss)
	
	loadtime = float(report['INTOLATTICE']['loadtime'])
	
	ir1.appendhold( ENDEVAP - loadtime)
	ir2.appendhold( ENDEVAP - loadtime)
	ir3.appendhold( ENDEVAP - loadtime)

	ir1.appendhold(irdelay1)
	ir2.appendhold(irdelay2)
	ir3.appendhold(irdelay3)

	ir1.linear(float(report['INTOLATTICE']['irpow1']),irramp1)
	ir2.linear(float(report['INTOLATTICE']['irpow2']),irramp2)
	ir3.linear(float(report['INTOLATTICE']['irpow3']),irramp3)

	gr1  = wfm.wave('greenpow1', 0., evap_ss)
	gr2  = wfm.wave('greenpow2', 0., evap_ss)
	gr3  = wfm.wave('greenpow3', 0., evap_ss)
	
	gr1.appendhold( ENDEVAP - loadtime)
	gr2.appendhold( ENDEVAP - loadtime)
	gr3.appendhold( ENDEVAP - loadtime)

	grdelay1 = float(report['INTOLATTICE']['grdelay1'])
	grdelay2 = float(report['INTOLATTICE']['grdelay2'])
	grdelay3 = float(report['INTOLATTICE']['grdelay3'])

	gr1.appendhold(grdelay1)
	gr2.appendhold(grdelay2)
	gr3.appendhold(grdelay3)

	grramp1 = float(report['INTOLATTICE']['grrampdt1'])
	grramp2 = float(report['INTOLATTICE']['grrampdt2'])
	grramp3 = float(report['INTOLATTICE']['grrampdt3'])
	gr1.linear(float(report['INTOLATTICE']['grpow1']),grramp1)
	gr2.linear(float(report['INTOLATTICE']['grpow2']),grramp2)
	gr3.linear(float(report['INTOLATTICE']['grpow3']),grramp3)

	
	#end = s.analogwfm_add(evap_ss,[odtpow,ipganalog,ir1,ir2,ir3,gr1,gr2,gr3])
	end = s.analogwfm_add(evap_ss,[odtpow,ir1,ir2,ir3,gr1,gr2,gr3,lcr1,lcr2,lcr3])
	
	
	s.wait(image-loadtime)
	
	# Turn on IR lattice beams
	s.wait(irdelay1)
	s.digichg('irttl1', float(report['INTOLATTICE']['ir1']) )
	s.wait(-irdelay1+irdelay2)
	s.digichg('irttl2', float(report['INTOLATTICE']['ir2']) )
	s.wait(-irdelay2+irdelay3)
	s.digichg('irttl3', float(report['INTOLATTICE']['ir3']) )
	s.wait(-irdelay3)

	s.wait(grdelay1)
	s.digichg('greenttl1', float(report['INTOLATTICE']['gr1']) )
	s.wait(-grdelay1+grdelay2)
	s.digichg('greenttl2', float(report['INTOLATTICE']['gr2']) )
	s.wait(-grdelay2+grdelay3)
	s.digichg('greenttl3', float(report['INTOLATTICE']['gr3']) )
	s.wait(-grdelay3)
	
	s.wait(loadtime + end - image)	
	
	return s
Esempio n. 31
0
def odt_evap_field(image,scale =1.0):
	evap_ss = f('EVAP','evapss')

	p0   = f('ODT','odtpow')
	p1   = f('EVAP','p1')
	t1   = f('EVAP','t1')
	tau  = f('EVAP','tau')
	beta = f('EVAP','beta')
	
	offset = f('EVAP','offset')
	t2     = f('EVAP','t2')
	tau2   = f('EVAP','tau2')
	smoothdt   = f('EVAP','smoothdt')
	
	field_ramp_time = f('EVAP','fieldrampt0')*scale
	field_ramp_dt = f('EVAP','fieldrampdt')*scale
	field_ramp_start = f('FESHBACH','bias')
	field_ramp_final = f('EVAP','fieldrampfinal')
	
	ramp=[]
	hashbase = ''
	hashbase = hashbase + '%.8f' % image
	hashbase = hashbase + '%.8f' % evap_ss
	hashbase = hashbase + '%.8f' % field_ramp_time
	hashbase = hashbase + '%.8f' % field_ramp_dt
	hashbase = hashbase + '%.8f' % field_ramp_start
	hashbase = hashbase + '%.8f' % field_ramp_final
	hashbase = hashbase + '%.8f' % scale
	
	ramphash = seqconf.ramps_dir() +'Evap_field_withscale'+ hashlib.md5( hashbase).hexdigest()
	
	#Here, go ahead and save the trajectory path to the report
	gen.save_to_report('EVAP','ramp_field', ramphash)

	bfield = wfm.wave('bfield',field_ramp_start,evap_ss)

	if not os.path.exists(ramphash) or True:
		bfield.extend(field_ramp_time)
		bfield.linear(field_ramp_final,field_ramp_dt)
		if((field_ramp_time+field_ramp_dt)<image*scale):
			bfield.extend(image*scale)
		else:
			bfield.chop(image*scale)
		ramp = bfield.y
		ramp.tofile(ramphash,sep=',',format="%.4f")
	else:
		print '\t...Recycling previously calculated Evap_field'
		ramp = numpy.fromfile(ramphash,sep=',')
		bfield.y=numpy.append(bfield.y,ramp)

	odtpow = odt_wave('odtpow', p0, evap_ss)
	#~ odtpow_test = odt_wave('NC0', p0, evap_ss)
	#~ odtpow_test2 = odt_wave('NC1', p0, evap_ss)
	#odtpow.Evap(p0, p1, t1, tau, beta, image)
	#odtpow.Evap2(p0, p1, t1, tau, beta, offset, t2, tau2, image)
	#odtpow.Evap3(p0, p1, t1, tau, beta, offset, t2, tau2, image)
	
	### SELECT EVAP TRAJECTORY HERE###
	finalcpow = odtpow.Evap8(p0, p1, t1, tau, beta, offset, t2, tau2,smoothdt,image,scale)
	#~ finalcpow2 = odtpow_test.Evap7(p0, p1, t1, tau, beta, offset, t2, tau2,smoothdt,image)
	#~ finalcpow3 = odtpow_test2.Evap7(p0, p1, t1, tau, beta, offset, t2, tau2,smoothdt,image)
	
	#Here, go ahead and save the finalcpow to the report
	gen.save_to_report('EVAP','finalcpow', finalcpow)
	
	#ipganalog starts out at full power
	ipganalog = ipg_wave('ipganalog', 10., evap_ss)
	
	if f('ODT','use_servo') == 0:
		ipganalog.extend( odtpow.dt() )
	elif f('ODT','use_servo') == 1:
		ipganalog.follow( odtpow )
	#~ ipganalog.follow( odtpow )

	#~ odtpow.Exponential(pow0,powf,evap_dt,tau)
	#~ odtpow.linear( powf, evap_ss)
	#~ odtpow.appendhold( evap_dt)

	maxDT = odtpow.dt()
		
	return bfield, odtpow, maxDT, finalcpow, ipganalog#,odtpow_test,odtpow_test2
Esempio n. 32
0
def odt_evap_field(scale =1.0):
	field_ramp_time = EVAP.fieldrampt0*scale
	field_ramp_dt   = EVAP.fieldrampdt*scale
	
	ramp=[]
	hashbase = ''
	hashbase = hashbase + '%.8f' % EVAP.image
	hashbase = hashbase + '%.8f' % EVAP.evapss
	hashbase = hashbase + '%.8f' % field_ramp_time
	hashbase = hashbase + '%.8f' % field_ramp_dt
	hashbase = hashbase + '%.8f' % FB.bias
	hashbase = hashbase + '%.8f' % EVAP.fieldrampfinal
	hashbase = hashbase + '%.8f' % scale
	hashbase = hashbase + wfm.rawcalibdat( 'bfield' ) 

	
	#---Here, go ahead and save the trajectory path to the report
	ramphash = seqconf.ramps_dir() +'Evap_field_withscale'+ hashlib.md5( hashbase).hexdigest()
	gen.save_to_report('EVAP','ramp_field', ramphash)

	#---Setup field ramp
	bfield = wfm.wave('bfield', FB.bias, EVAP.evapss)
	if not os.path.exists(ramphash) or True:
		print '\t...Making new Evap_field'
		bfield.extend(field_ramp_time)
		bfield.linear(EVAP.fieldrampfinal,field_ramp_dt)
		if((field_ramp_time+field_ramp_dt)<EVAP.image*scale):
			bfield.extend(EVAP.image*scale)
		else:
			bfield.chop(EVAP.image*scale)
		ramp = bfield.y
		#ramp.tofile(ramphash,sep=',',format="%.4f")
	else:
		print '\t...Recycling previously calculated Evap_field'
		ramp = numpy.fromfile(ramphash,sep=',')
		bfield.y=ramp

	#---Setup ODT ramp
	odtpow = odt_wave('odtpow', ODT.odtpow, EVAP.evapss)
	### SELECT EVAP TRAJECTORY HERE###
	finalcpow = odtpow.Evap8(\
							ODT.odtpow, \
							EVAP.p1, \
							EVAP.t1, 
							EVAP.tau, \
							EVAP.beta, \
							EVAP.offset, \
							EVAP.t2, \
							EVAP.tau2, \
							EVAP.smoothdt, \
							EVAP.image, \
							EVAP.scale \
							)
	#Here, go ahead and save the finalcpow to the report
	gen.save_to_report('EVAP','finalcpow', finalcpow)
	
	#---Setup ipganalog ramp
	ipganalog = ipg_wave('ipganalog', 10., EVAP.evapss)
	if ODT.use_servo == 0:
		ipganalog.extend( odtpow.dt() )
	elif ODT.use_servo == 1:
		ipganalog.follow( odtpow )

	maxDT = odtpow.dt()
	return bfield, odtpow, maxDT, finalcpow, ipganalog
Esempio n. 33
0
#Get hfimg ready
s.digichg('hfimg', 1)

#If using analoghfimg get it ready
if ANDOR.analoghfimg == 1:
    s.digichg('analogimgttl', 1)

# Do CNC, UVMOT, and field ramps
s, toENDBFIELD = highfield_uvmot.go_to_highfield(s)

analoghfimg = []
# THis section used to resolve the issue we have probe or bragg kill in dimple section
if DL.probekill == 1:
    if (-DL.probekilltime) > DL.image:
        analoghfimg = [wfm.wave('analogimg', DL.probekill_hfimg, EVAP.evapss)]
elif DL.braggkill == 1:
    if (-DL.braggkilltime) > DL.image:
        print "...braggkill will be inserted in DIMPLE part of sequence"
        hfimgwfm = wfm.wave('analogimg', DL.braggkill_hfimg, EVAP.evapss)

        analoghfimg = [hfimgwfm]

# Evaporate into the dimple
s, cpowend = odt.crossbeam_dimple_evap(s, toENDBFIELD, analoghfimg)

# Ramp up the lattice
s = lattice.dimple_to_lattice(s, cpowend)

#########################################
## OTHER TTL EVENTS: probekill, braggkill, rf, quick2
s.wait(free)


evap_ss = float(report['EVAP']['evapss'])
bias = float(report['FESHBACH']['bias'])
zcrampdt = float(report['ZEROCROSS']['zcrampdt'])
zcdt = float(report['ZEROCROSS']['zcdt'])
zcbias = float(report['ZEROCROSS']['zcbias'])

#add bfield ramp up during evap#
if (int(report['EVAP']['use_field_ramp'])):
    bfield, odtpow, ENDEVAP, cpowend, ipganalog= odt.odt_evap_field(image)#,odtpow_test,odtpow_test2 
    
else:
    odtpow, ENDEVAP, cpowend, ipganalog = odt.odt_evap(image)
    bfield = wfm.wave('bfield',bias,evap_ss)
    bfield.extend(odtpow.dt())
    

bfield.linear(zcbias,zcrampdt)
bfield.appendhold(zcdt)
odtpow.extend(bfield.dt())
ipganalog.extend(bfield.dt())


#add odt ramp up#
if int(report['EVAP']['use_odt_lock']) == 1: 
    odtlockpow = float(report['EVAP']['odtlockpow'])
    odtlockpowdt = float(report['EVAP']['odtlockpowdt'])
    
    if odtlockpow == -1: 
Esempio n. 35
0
def dimple_to_lattice(s,cpowend):
    
    print "----- LATTICE LOADING RAMPS -----"

    # Find out which is the longest of the ramps we are dealing with:
    maxX =max( [xdomain(DL.latticeV0)[1] ,\
         xdomain(DL.irpow)[1],\
         xdomain(DL.grpow1)[1],\
         xdomain(DL.grpow2)[1],\
         xdomain(DL.grpow3)[1],\
         xdomain(DL.a_s)[1]] )
    print "Largest x value = %.3f ms\n" %  maxX
   
    # We define the times for which all functions will be evaluated
    # MIN TIME TO DO DIGITAL EXTENSION
    DIGEXTENSION = 2050.
    if DL.image >= DIGEXTENSION:
        Xendtime = DIGEXTENSION
    else:
        Xendtime = DL.image

    Nnew = int(math.floor( Xendtime / DL.ss) )  
    Xnew = numpy.arange( Xendtime/Nnew, DL.image, Xendtime/Nnew ) 
    print "X array defined from dt:"
    print "DL.ss =", DL.ss
    print "x0  = ",Xnew[0]
    print "xf  = ",Xnew[-1]
    print "xdt = ",Xnew[1]-Xnew[0]
    print "%d samples" % Nnew
    print 'x shape = ', Xnew.shape
    
    # Define how we want to ramp up the lattice depth
    v0_ramp, xy_v0, v0set =  interpolate_ramp( DL.latticeV0)
    v0  = v0_ramp(Xnew)
                        
    
    
    ###########################################
    #### AXIS DEFINITIONS FOR PLOTS ###
    ###########################################    
    
    fig = plt.figure( figsize=(4.5*1.05,8.*1.1))
    ax0 = fig.add_axes( [0.18,0.76,0.76,0.20]) 
    ax2 = fig.add_axes( [0.18,0.645,0.76,0.11])
    ax3 = fig.add_axes( [0.18,0.53,0.76,0.11])
    ax1 = fig.add_axes( [0.18,0.415,0.76,0.11])
    ax5 = fig.add_axes( [0.18,0.30,0.76,0.11])
    ax4 = fig.add_axes( [0.18,0.185,0.76,0.11])
    ax6 = fig.add_axes( [0.18,0.07,0.76,0.11])

    allax = [ax0, ax1, ax2, ax3, ax4, ax5, ax6]
    for ax in allax:
        ax.axvline( DL.image, linewidth = 1., color='black', alpha=0.6)
    
    lw=1.5
    labelx=-0.12
    legsz =8.
    
    xymew=0.5
    xyms=9
    
    
    ax0.plot( Xnew, v0, 'b', lw=2.5, label='Lattice depth')
    ax0.plot(xy_v0[:,0],xy_v0[:,1], 'x', color='blue', ms=5.)
    ax0.plot(v0set[:,0],v0set[:,1], '.', mew=xymew, ms=xyms, color='blue')
    
    
    ###########################################
    #### USER DEFINED RAMPS: IR, GR, and U ###
    ###########################################      
    
    # Define how we want to ramp up the IR power
    if DIMPLE.allirpow > 0.:
      ir_offset = DIMPLE.allirpow
    else:
      ir_offset = DIMPLE.ir1pow2
    ir_ramp, xy_ir, ir =  interpolate_ramp( DL.irpow, yoffset=ir_offset)
    
    dt_ir = numpy.amax( ir[:,0]) - numpy.amin( ir[:,0])
    N_ir = int(math.floor( dt_ir / DL.ss ))
    x_ir = numpy.arange( dt_ir/N_ir, dt_ir, dt_ir/N_ir)
    
    y_ir = ir_ramp(Xnew)
    
    if v0.size > y_ir.size:
        y_ir = numpy.append(y_ir, (v0.size-y_ir.size)*[y_ir[-1]])
    elif v0.size < y_ir.size:
        y_ir = y_ir[0:v0.size]
        
    if v0.size != y_ir.size:
        msg = "IRPOW ERROR: number of samples in IR ramp and V0 ramp does not match!"
        errormsg.box('LATTICE LOADING ERROR',msg)
        exit(1)
        
   
    alpha_clip_range = 0.1 
    if (v0 > y_ir+ alpha_clip_range).any():
        msg = "IRPOW ERROR:  not enough power to get desired lattice depth"
        print msg
        bad = numpy.where( v0 > y_ir + alpha_clip_range)
        timefail =  int(bad[0][0])*float(DL.ss)
        msg = msg + "\nFirst bad sample = %d out of %d" % (bad[0][0], v0.size)
        msg = msg + "\n  t = %f " %  timefail
        msg = msg + "\n v0 = %f " %   v0[ bad[0][0] ]
        msg = msg + "\n ir = %f " % y_ir[ bad[0][0] ]
        print v0[bad[0][0]]
        print y_ir[bad[0][0]]
        errormsg.box('LATTICE LOADING ERROR',msg)
        exit(1)
    
    ax0.plot(xy_ir[:,0],xy_ir[:,1], 'x', color='darkorange', ms=5.)
    ax0.plot(ir[:,0],ir[:,1], '.', mew=xymew, ms=xyms, color='darkorange')
    ax0.plot(Xnew, y_ir, lw=lw, color='darkorange',label='irpow')
    
    
    # Define how we want to ramp up the GR power
    grwfms = {}
    splmrkr = ['x','+','d']
    ptsmrkr = ['^','s','p']
    for i,grramp in enumerate([(DL.grpow1,DIMPLE.gr1pow2), (DL.grpow2,DIMPLE.gr2pow2), (DL.grpow3,DIMPLE.gr3pow2)]):
      ramppts = grramp[0]
      ramp0 = grramp[1] 

      print 'gr'+'%d'%i +' offset = %f' % ramp0

      gr_ramp, xy_gr, gr =  interpolate_ramp( ramppts, yoffset=ramp0)
    
      dt_gr = numpy.amax( gr[:,0]) - numpy.amin( gr[:,0])
      N_gr = int(math.floor( dt_gr / DL.ss ))
      x_gr = numpy.arange( dt_gr/N_gr, dt_gr, dt_gr/N_gr)
    
      y_gr = gr_ramp(Xnew)
      if DL.signal == 0:
          y_gr = y_gr / 2.0
    
      if v0.size > y_gr.size:
          y_gr = numpy.append(y_gr, (v0.size-y_gr.size)*[y_gr[-1]])
      elif v0.size < y_gr.size:
          y_gr = y_gr[0:v0.size]
        
      if v0.size != y_gr.size:
          msg = "GRPOW ERROR: number of samples in GR ramp and V0 ramp does not match!"
          errormsg.box('LATTICE LOADING ERROR',msg)
          exit(1)

      grwfms[ 'greenpow' + '%1d' % (i+1) ] = y_gr 

      ax0.plot(xy_gr[:,0],xy_gr[:,1], marker= splmrkr[i] ,mec='green', mfc='None', ms=3.)
      ax0.plot(gr[:,0],gr[:,1], marker=ptsmrkr[i], mew=xymew, ms=xyms/2., mfc='None', mec='green')#, label='grpow dat')
      ax0.plot(Xnew, y_gr, lw=lw, color='green', label='grpow')

    for grch in grwfms.keys():
      print grch, " = ", grwfms[grch].shape
    
    ax0.set_xlim(left=-10., right= ax0.get_xlim()[1]*1.1)   
    plt.setp( ax0.get_xticklabels(), visible=False)
    ylim = ax0.get_ylim()
    extra = (ylim[1]-ylim[0])*0.1
    ax0.set_ylim( ylim[0]-extra, ylim[1]+extra )
    ax0.grid(True)
    ax0.set_ylabel('$E_{r}$',size=16, labelpad=0)
    ax0.yaxis.set_label_coords(labelx, 0.5)
    ax0.set_title('Lattice Loading')
    ax0.legend(loc='best',numpoints=1,prop={'size':legsz*0.8})
    
    
    # Define how we want to ramp up the scattering length (control our losses)
    a_s_ramp, xy_a_s, a_s =  interpolate_ramp( DL.a_s)
    
    
    dt_a_s = numpy.amax( a_s[:,0]) - numpy.amin( a_s[:,0])
    N_a_s = int(math.floor( dt_a_s / DL.ss ))
    x_a_s = numpy.arange( dt_a_s/N_a_s, dt_a_s, dt_a_s/N_a_s)
    y_a_s = a_s_ramp(Xnew)

   
    
    if v0.size > y_a_s.size:
        y_a_s = numpy.append(y_a_s, (v0.size-y_a_s.size)*[y_a_s[-1]])
    elif v0.size < y_a_s.size:
        y_a_s = y_a_s[0:v0.size]
        
    if v0.size != y_a_s.size:
        msg = "a_s ERROR: number of samples in a_s ramp and V0 ramp does not match!"
        errormsg.box('LATTICE LOADING ERROR',msg)
        exit(1)
    
    
    
    ax1.plot(xy_a_s[:,0],xy_a_s[:,1]/100., 'x', color='#C10087', ms=5.)
    ax1.plot(a_s[:,0],a_s[:,1]/100., '.', mew=xymew, ms=xyms, color='#C10087')
    ax1.plot(Xnew, y_a_s/100., lw=lw, color='#C10087', label=r'$a_s\mathrm{(100 a_{0})}$')
    ax1.set_ylabel(r'$a_s\mathrm{(100 a_{0})}$',size=16, labelpad=0)
    ax1.yaxis.set_label_coords(labelx, 0.5)

    
    ax1.set_xlim( ax0.get_xlim()) 
    ylim = ax1.get_ylim()
    extra = (ylim[1]-ylim[0])*0.1
    ax1.set_ylim( ylim[0]-extra, ylim[1]+extra )
    plt.setp( ax1.get_xticklabels(), visible=False)
    ax1.grid(True)
    ax1.legend(loc='best',numpoints=1,prop={'size':legsz})
    

    #######################################################################
    #### CALCULATED RAMPS:  ALPHA, TUNNELING, SCATTERING LENGTH, BFIELD ###
    #######################################################################
    
    alpha = (v0/y_ir)**2.
    
    alpha_advance = 100.
    N_adv = int(math.floor( alpha_advance / DL.ss))
    
    alpha  = alpha.clip(0.,1.)
    alpha_desired = numpy.copy(alpha)
    
    if N_adv < v0.size:
        alpha = alpha[N_adv:]
        alpha = numpy.append(alpha, (v0.size-alpha.size)*[alpha[-1]])
    else:
        alpha = numpy.array( v0.size*[alpha[-1]] )
    
    #alpha = alpha.clip(0., 1.)
    
    ax2.plot( Xnew, alpha, lw=lw, color='saddlebrown', label='alpha adv')
    ax2.plot( Xnew, alpha_desired,':', lw=lw, color='saddlebrown', label='alpha')
    
    ax2.set_xlim( ax0.get_xlim()) 
    ax2.set_ylim(-0.05,1.05)
    plt.setp( ax2.get_xticklabels(), visible=False)
    ax2.grid()
    ax2.set_ylabel('$\\alpha$',size=16, labelpad=0)
    ax2.yaxis.set_label_coords(labelx, 0.5)
    
    ax2.legend(loc='best',numpoints=1,prop={'size':legsz})
    
    
    tunneling_Er  = physics.inv('t_to_V0', v0)
    tunneling_kHz = tunneling_Er * 29.2
    
    ax3.plot( Xnew, tunneling_kHz, lw=lw, color='red', label='$t$ (kHz)')

    
    ax3.set_xlim( ax0.get_xlim()) 
    ylim = ax3.get_ylim()
    extra = (ylim[1]-ylim[0])*0.1
    ax3.set_ylim( ylim[0]-extra, ylim[1]+extra )
    plt.setp( ax3.get_xticklabels(), visible=False)
    ax3.grid(True)
    ax3.set_ylabel(r'$t\,\mathrm{(kHz)}$',size=16, labelpad=0)
    ax3.yaxis.set_label_coords(labelx, 0.5)
    ax3.legend(loc='best',numpoints=1,prop={'size':legsz})

    
    wannierF = physics.inv('wF_to_V0', v0)
     
    bohrRadius = 5.29e-11 #meters
    lattice_spacing = 1.064e-6 / 2. #meters
    
    bfieldG = physics.cnv('as_to_B', y_a_s)
    print 
    print "The last value of the scattering length ramp is:"
    print 'a_s =', y_a_s[-1]
    print 'B   =', bfieldG[-1]
    print 
    
    U_over_t = y_a_s * bohrRadius / lattice_spacing * wannierF / tunneling_Er
    
    
    
    
    ax4.plot( Xnew, U_over_t, lw=lw, color='k', label=r'$U/t$')
    
    ax4.set_xlim( ax0.get_xlim()) 
    ylim = ax4.get_ylim()
    extra = (ylim[1]-ylim[0])*0.1
    ax4.set_ylim( ylim[0]-extra, ylim[1]+extra )
    plt.setp( ax4.get_xticklabels(), visible=False)
    ax4.grid(True)
    ax4.set_ylabel(r'$U/t$',size=16, labelpad=0)
    ax4.yaxis.set_label_coords(labelx, 0.5)
    
    ax4.legend(loc='best',numpoints=1,prop={'size':legsz})
    
    
    ax5.plot( Xnew, bfieldG, lw=lw, color='purple', label='$B$ (G)')
    
    ax5.set_xlim( ax0.get_xlim()) 
    ylim = ax5.get_ylim()
    extra = (ylim[1]-ylim[0])*0.1
    ax5.set_ylim( ylim[0]-extra, ylim[1]+extra )
    ax5.grid(True)
    plt.setp( ax5.get_xticklabels(), visible=False)
    ax5.set_ylabel(r'$B\,\mathrm{(G)}$',size=16, labelpad=0)
    ax5.yaxis.set_label_coords(labelx, 0.5)
    
    
    ax5.legend(loc='best',numpoints=1,prop={'size':legsz})
    
    
    ax6.plot( Xnew, (tunneling_Er / U_over_t), lw=lw, color='#25D500', label=r'$t^{2}/U\,(E_{r)}$')
    #ax6.set_yscale('log')
    
    ax6.set_xlim( ax0.get_xlim()) 
    ylim = ax6.get_ylim()
    extra = (ylim[1]-ylim[0])*0.1
    ax6.set_ylim( ylim[0]*0.5, ylim[1] )
    ax6.grid(True)
    ax6.set_ylabel(r'$t^{2}/U\,(E_{r)}$',size=16, labelpad=0)
    ax6.yaxis.set_label_coords(labelx, 0.5)
    
    
    ax6.legend(loc='best',numpoints=1,prop={'size':legsz})
    
    ax6.set_xlabel('time (ms)')

    figfile = seqconf.seqtxtout().split('.')[0]+'_latticeRamp.png'    
    plt.savefig(figfile , dpi=120 )
    
    #Save all ramps to a txt file for later plotting. 
    datfile = seqconf.seqtxtout().split('.')[0]+'_latticeRamp.dat'
    allRamps = numpy.transpose(numpy.vstack((Xnew, v0, y_ir, grwfms['greenpow1'], y_a_s, alpha, alpha_desired, \
                                    tunneling_kHz, U_over_t, bfieldG)))
    header = '# Column index'
    header = header + '\n#\t0\t' + 'time(ms)'
    header = header + '\n#\t1\t' + 'Lattice Depth (Er)'
    header = header + '\n#\t2\t' + 'Ir power (Er)'
    header = header + '\n#\t3\t' + 'GR power (Er)'
    header = header + '\n#\t4\t' + 'a_s (a0)'
    header = header + '\n#\t5\t' + 'alpha - advance'
    header = header + '\n#\t6\t' + 'alpha - desired'
    header = header + '\n#\t7\t' + 'tunneling (kHz)'
    header = header + '\n#\t8\t' + 'U/t'
    header = header + '\n#\t9\t' + 'bfield (Gauss)'
    header = header + '\n'
    
    numpy.savetxt( datfile, allRamps)
    
    with open(datfile, 'w') as f:
        X = numpy.asarray( allRamps )
        f.write(bytes(header))
        
        format = '%.6e'
        ncol = X.shape[1]
        format = [format ,] *ncol
        format = ' '.join(format)
        
        newline = '\n'
        for row in X:
            f.write(numpy.compat.asbytes(format % tuple(row) + newline))

    
    shutil.copyfile( figfile,  seqconf.savedir() + 'expseq' + seqconf.runnumber() + '_latticeRamp.png')
    shutil.copyfile( datfile,  seqconf.savedir() + 'expseq' + seqconf.runnumber() + '_latticeRamp.dat')
    #plt.savefig( seqconf.savedir() + 'expseq' + seqconf.runnumber() + '_latticeRamp.png', dpi=120)
    
    
    #################################
    #### APPEND RAMPS TO SEQUENCE ###
    #################################
    
    wfms=[]

    if DL.signal == 0:
          print " LOCK VALUE FOR SIGNAL / NOSIGNAL "
          print " before = ", DL.lock_Er
          DL.lock_Er = DL.lock_Er / 1.8
          print " after  = \n", DL.lock_Er
    
    for ch in ['ir1pow','ir2pow','ir3pow']:
        n = filter( str.isdigit, ch)[0] 
        w = wfm.wave(ch, 0.0, DL.ss)  #Start value will be overrriden
        w.y = physics.cnv( ch, y_ir )
        if DL.lock:
            endval = w.y[-1]
            w.insertlin_cnv(DL.lock_Er, DL.lock_dtUP, DL.lock_t0 )
        elif DL.lightassist_lock:
            endval = w.y[-1]
            w.linear(DL.lightassist_lockpowIR, DL.lightassist_lockdtUP)
            w.appendhold( DL.lightassist_t0 + DL.lightassistdt )
            if DL.endvalIR >= 0.:
                w.linear(  DL.endvalIR, DL.lightassist_lockdtDOWN)
            else:
                w.linear(  None, DL.lightassist_lockdtDOWN, volt=endval)
        wfms.append(w)
        
    for ch in ['greenpow1','greenpow2','greenpow3']:
        n = filter( str.isdigit, ch)[0] 
        w = wfm.wave(ch, 0.0, DL.ss)  #Start value will be overrriden
        
        correction = DIMPLE.__dict__['gr'+n+'correct']
        
        w.y = physics.cnv( ch, correction * grwfms[ch] )
        if DL.lightassist_lock:
            endval = w.y[-1]
            w.linear(DL.lightassist_lockpowGR, DL.lightassist_lockdtUP)
            w.appendhold( DL.lightassist_t0 + DL.lightassistdt )
            if DL.endvalGR >= 0.:
                w.linear(  DL.endvalGR, DL.lightassist_lockdtDOWN)
            else:
                w.linear(  None, DL.lightassist_lockdtDOWN, volt=endval)
        wfms.append(w)
     

    for ch in ['lcr1','lcr2','lcr3']:
        n = filter( str.isdigit, ch)[0] 
        w = wfm.wave(ch, 0.0, DL.ss)  #Start value will be overrriden
        force = DL.__dict__['force_'+ch]
        if force >= 0 and force <=1:
            print "...Forcing LCR%s = %f during lattice ramp" % (n,force)
            w.y = physics.cnv( ch, numpy.array( alpha.size*[force] )  )
        elif DL.signal == 0:
            print "...Forcing LCR%s = 0. so that it does NOT rotate to LATTICE" % n 
            w.y = physics.cnv( ch, numpy.array( alpha.size*[0.0] )  )
        else:
            w.y = physics.cnv( ch, alpha )
        wfms.append(w)
    

    
    bfieldA = bfieldG/6.8
    
    ##ADD field
    bfield = wfm.wave('bfield', 0.0, DL.ss)
    bfield.y = physics.cnv( 'bfield', bfieldA)
    print "The last value of the bfield voltage is =", bfield.y[-1]
    print 
    wfms.append(bfield)
    
    
    ##ADD gradient field
    gradient = gradient_wave('gradientfield', 0.0, DL.ss,volt = 0.0)
    gradient.follow(bfield)
    wfms.append(gradient)
   
    
    buffer = 40.
    s.wait(buffer)
    
    
    #~ odtpow = odt.odt_wave('odtpow', cpowend, DL.ss)
    #~ if DIMPLE.odt_t0 > buffer :
        #~ odtpow.appendhold( DIMPLE.odt_t0 - buffer)
    #~ if DIMPLE.odt_pow < 0.:
        #~ odtpow.appendhold( DIMPLE.odt_dt)
    #~ else:
        #~ odtpow.tanhRise( DIMPLE.odt_pow, DIMPLE.odt_dt, DIMPLE.odt_tau, DIMPLE.odt_shift)    
        
    #~ if numpy.absolute(DIMPLE.odt_pow) < 0.0001:
        #~ s.wait( odtpow.dt() )
        #~ s.digichg('odtttl',0)
        #~ s.wait(-odtpow.dt() )
    
    #~ wfms.append(odtpow)
        
    
    # RF sweep
    if DL.rf == 1:   
        rfmod  = wfm.wave('rfmod', 0., DL.ss)
        rfmod.appendhold( bfield.dt() + DL.rftime )
        rfmod.linear( DL.rfvoltf, DL.rfpulsedt)
        wfms.append(rfmod)


    if DL.round_trip == 1:
        bindex = 0  # Calculate detunings using starting field
    else: 
        bindex = -1 # Calculate detunings using field at the end of ramps

    bfieldG = physics.inv( 'bfield', bfield.y[bindex]) * 6.8
    hfimg0 = -1.*(100.0 + 163.7 - 1.414*bfieldG)
   
    # Find bindex for braggkill time 
    bindex_BK =  math.floor(-DL.braggkilltime / bfield.ss)
    bfieldG_BK = physics.inv( 'bfield', bfield.y[-1-bindex_BK]) * 6.8
    hfimg0_BK =  -1.*(100.0 + 163.7 - 1.414*bfieldG_BK) 
    DL.braggkill_hfimg = hfimg0_BK - DL.braggkill_hfimg
    print "\n...Braggkill hfimg modification:\n"
    print "\tNEW braggkill_hfimg = %.2f MHz" % DL.braggkill_hfimg

    # Find bindex for bragg2kill time 
    bindex_B2K =  math.floor(-DL.bragg2killtime / bfield.ss)
    bfieldG_B2K = physics.inv( 'bfield', bfield.y[-1-bindex_B2K]) * 6.8
    hfimg0_B2K =  -1.*(100.0 + 163.7 - 1.414*bfieldG_B2K) 
    DL.bragg2kill_hfimg1 = hfimg0_B2K - DL.bragg2kill_hfimg1
    DL.bragg2kill_hfimg2 = hfimg0_B2K - DL.bragg2kill_hfimg2
    print "\n...Bragg2kill hfimg modification:\n"
    print "\tNEW brag2gkill_hfimg1 = %.2f MHz" % DL.bragg2kill_hfimg1
    print "\tNEW brag2gkill_hfimg2 = %.2f MHz" % DL.bragg2kill_hfimg2
    
    
    print "\n...ANDOR:hfimg and hfimg0 will be modified  in report\n"
    print "\tNEW  ANDOR:hfimg  = %.2f MHz" % ( hfimg0 - DL.imgdet)
    print "\tNEW  ANDOR:hfimg0 = %.2f MHz\n" %  hfimg0
    gen.save_to_report('ANDOR','hfimg', hfimg0 - DL.imgdet)
    gen.save_to_report('ANDOR','hfimg0', hfimg0)
    
    newANDORhfimg = hfimg0 - DL.imgdet

    # THIS DEFINES THE TIME IT TAKES THE OFFSET LOCK TO SWITCH TO
    # A NEW SETPOINT
    hfimgdelay = 50. #ms
        
    # Kill hfimg
    if DL.probekill ==1 or DL.braggkill ==1 or  DL.bragg2kill==1 or DL.lightassist or DL.lightassist_lock:
        analogimg = wfm.wave('analogimg', newANDORhfimg, DL.ss)
        
        if DL.probekill == 1:
            if (-DL.probekilltime+hfimgdelay) < DL.image:
                analogimg.appendhold( bfield.dt() + DL.probekilltime - hfimgdelay)
                analogimg.linear( DL.probekill_hfimg , 0.0)
                analogimg.appendhold( hfimgdelay + DL.probekilldt + 3*DL.ss)
        
        elif DL.braggkill == 1:
            print "Setting up analogimg for braggkill"
            if (-DL.braggkilltime+hfimgdelay) < DL.image:
                analogimg.appendhold( bfield.dt() + DL.braggkilltime - hfimgdelay)
                analogimg.linear( DL.braggkill_hfimg , 0.0)
                analogimg.appendhold( hfimgdelay + DL.braggkilldt + 3*DL.ss)
 
        elif DL.bragg2kill == 1:
            print "Setting up analogimg for bragg2kill"
            if (-DL.bragg2killtime+hfimgdelay) < DL.image:
                # This sets up the detuning for the first pulse
                analogimg.appendhold( bfield.dt() + DL.bragg2killtime - hfimgdelay)
                analogimg.linear( DL.bragg2kill_hfimg1 , 0.0)
                analogimg.appendhold( hfimgdelay + DL.bragg2killdt + 3*DL.ss)
 
                # Then set up the detuning for the second pulse
                analogimg.linear( DL.bragg2kill_hfimg2 , 0.0)
                analogimg.appendhold( hfimgdelay + DL.bragg2killdt + 3*DL.ss)
                
            
        
        elif DL.lightassist == 1 or DL.lightassist_lock:
            analogimg.appendhold( bfield.dt()  - hfimgdelay)
            analogimg.linear( DL.lightassist_hfimg , 0.0)
            duration = DL.lightassist_lockdtUP + DL.lightassist_t0 + DL.lightassistdt + DL.lightassist_lockdtDOWN
            analogimg.appendhold( hfimgdelay + duration + 3*DL.ss)
            
        analogimg.linear( newANDORhfimg, 0.)
        analogimg.extend(10)
        wfms.append(analogimg)
    
        

    
    #analogimg = bfieldwfm.hfimg_wave('analogimg', ANDOR.hfimg, DL.ss)
    #andorhfimg0 = analogimg.follow(bfield, DL.imgdet)
    #wfms.append(analogimg)
    

    # If we are doing round trip END, then mirror all the ramps 
    # before adding them to the sequence
    if DL.round_trip == 1:
        if DL.round_trip_type == 1:
            maxdt = 0.
            maxi = -1
            for i,w in enumerate(wfms):
                if w.dt() > maxdt:
                    maxdt = w.dt()
                    maxi = i
    
            maxdt = maxdt + DL.wait_at_top / 2. 
    
            for w in wfms:
                w.extend(maxdt)
                if 'lcr' in w.name:
                    yvals = w.y
                    
                    #Get the reverse of the alpha desired array
                    alpha_mirror = numpy.copy(alpha_desired[::-1])
                    
                    #Add the wait at top part so that it has same length as yvals
                    if alpha_mirror.size > yvals.size:
                        print "Error making mirror ramp for LCR."
                        print "Program will exit."
                        exit(1)
                    alpha_mirror = numpy.append( (yvals.size - alpha_mirror.size)*[ alpha_mirror[0] ], alpha_mirror )
                    
                                   
                    #This is how much the mirror ramp will be advanced
                    N_adv = int(math.floor( DL.lcr_mirror_advance / DL.ss))
                    
                    if N_adv < alpha_mirror.size:
                        alpha_mirror = alpha_mirror[N_adv:]
                        alpha_mirror = numpy.append(alpha_mirror, (yvals.size-alpha_mirror.size)*[alpha_mirror[-1]])
                    else:
                        alpha_mirror = numpy.array( yvals.size*[alpha_mirror[-1]] )
                    
                    
                    
                    w.y = numpy.concatenate((yvals,physics.cnv( w.name, alpha_mirror )))
                else:
                    w.mirror()
                w.appendhold( DL.wait_at_end)
            
        
    
    N_adv = int(math.floor( alpha_advance / DL.ss))
    
    alpha_desired = numpy.copy(alpha)
    
    
    for wavefm in wfms:
        print "%s dt = %f" % (wavefm.name, wavefm.dt())
   
     
    
    duration = s.analogwfm_add(DL.ss,wfms)
    
    if DL.image < DIGEXTENSION:
        s.wait(duration)
    else:
        print "...DL.image = %f  >= %.2f  Digital seq extension will be used." % (DL.image, DIGEXTENSION)
        s.wait( DL.image )
        
    
    ### Prepare the parts of the ramps that are going to be used to mock
    ### the conditions for the noatoms shot
    ### 1. get dt = [noatoms] ms from the end of the lattice ramps.
    if 'manta' in DL.camera:
        noatomsdt = MANTA.noatoms
    else:
        noatomsdt = ANDOR.noatoms
    noatomswfms = []
    for wavefm in wfms:
        cp = copy.deepcopy( wavefm ) 
        cp.idnum = time.time()*100
        cp.retain_last( DL.bgRetainDT )
        noatomswfms.append( cp ) 
    
        
        
    
    
    
    ### Figure out when to turn interlock back on, using alpha information
    #~ if duration > DL.t0 + DL.dt:
        #~ s.wait(-DL.lattice_interlock_time)
        #~ if DL.use_lattice_interlock == 1:
            #~ s.digichg('latticeinterlockbypass',0)
        #~ else:
            #~ s.digichg('latticeinterlockbypass',1)
        #~ s.wait( DL.lattice_interlock_time)
        
        
    #########################################
    ## OTHER TTL EVENTS: probekill, braggkill, rf, quick2
    #########################################
    # Braggkill
    if DL.braggkill == 1:
        print "Using Bragg Kill"
        s.wait( DL.braggkilltime)
        s = manta.OpenShutterBragg(s,DL.shutterdelay)
        s.digichg('bragg',1)
        s.wait( DL.braggkilldt)
        s.digichg('brshutter',1) # to close shutter
        s.digichg('bragg',0)
        
        s.wait( -DL.braggkilldt)
        s.wait( -DL.braggkilltime )

    if DL.bragg2kill == 1:
        print "Using Bragg 2 Kill"
        tcur = s.tcur 
        s.wait( DL.bragg2killtime )
        s = manta.OpenShutterBragg(s,DL.shutterdelay)
        s.digichg('bragg',1)
        s.wait( DL.bragg2killdt)
        s.digichg('brshutter',1) # to close shutter
        s.digichg('bragg',0)
  
        s.wait( hfimgdelay + 3*DL.ss )
        s = manta.OpenShutterBragg(s,DL.shutterdelay)
        s.digichg('bragg',1)
        s.wait( DL.bragg2killdt)
        s.digichg('brshutter',1) # to close shutter
        s.digichg('bragg',0)

        # Revert to current time after pulses have been added in the past
        s.tcur = tcur

        
       
        
         

    # Probe Kill
    if DL.probekill == 1:
        s.wait(DL.probekilltime)
        
        s.wait(-10)
        s.digichg('prshutter',0)
        s.wait(10)
        s.digichg('probe',1)
        s.wait(DL.probekilldt)
        s.digichg('probe',0)

        s.digichg('prshutter',1)
        s.wait(-DL.probekilltime)


    # Pulse RF
    if DL.rf == 1:
        s.wait(DL.rftime)
        s.digichg('rfttl',1)
        s.wait(DL.rfpulsedt)
        s.digichg('rfttl',0)
        s.wait(-DL.rfpulsedt)
        s.wait(-DL.rftime)
        



    # QUICK2
    if DL.quick2 == 1:
        s.wait( DL.quick2time)
        s.digichg('quick2',1)
        s.wait(-DL.quick2time)
        

    # Light-assisted collisions
    if DL.lightassist == 1 or DL.lightassist_lock:
        s.wait( -DL.lightassist_lockdtUP -DL.lightassist_t0 -DL.lightassistdt -DL.lightassist_lockdtDOWN - 3*DL.ss)
        
        s.wait(DL.lightassist_lockdtUP + DL.lightassist_t0)
        s.wait(-10)
        s.digichg('prshutter',0)
        s.wait(10)
        s.digichg('probe', DL.lightassist)
        s.wait(DL.lightassistdt)
        s.digichg('probe',0)

        s.digichg('prshutter',1)
        s.wait(DL.lightassist_lockdtDOWN)
        s.wait(3*DL.ss)
        # After the collisions happen we still need to wait some time 
        # for the probe frequency to come back to the desired value
        s.wait(hfimgdelay)


    #########################################
    ## GO BACK IN TIME IF DOING ROUND-TRIP START
    #########################################
    if DL.round_trip == 1:
        if DL.round_trip_type == 0:
            s.wait( -DL.image )
            s.stop_analog()


    #########################################
    ## TURN GREEN OFF BEFORE PICTURES
    #########################################
    if DL.greenoff == 1:
      s.wait( DL.greenoff_t0 ) 
      s.digichg('greenttl1', 0)
      s.digichg('greenttl2', 0)
      s.digichg('greenttl3', 0)
      s.wait(-DL.greenoff_t0 ) 


    
    #########################################
    ## LATTICE LOCK WITH POSSIBILITY OF RF
    #########################################
    bufferdt = 5.0
    lastIR = y_ir[-1]
   
    lockwfms=[]
    if DL.locksmooth == 1 and DL.lock == 0:
        s.wait(bufferdt)
        for ch in ['ir1pow','ir2pow','ir3pow']:
            n = filter( str.isdigit, ch)[0]
            w = wfm.wave(ch, lastIR, DL.lockss)  #Start value will be overrriden
            w.tanhRise( DL.lock_Er, DL.lock_dtUP, 0.4,0.2)
            lockwfms.append(w)
        print "...LOCKING LATTICE TO %f Er" % DL.lock_Er
        print "...lastIR = %.4f" % lastIR
        duration = s.analogwfm_add(DL.lockss,lockwfms)
        print "...duration = %.2f" % duration
        s.wait(duration)
        #~ if DL.lockrf:
            #~ s.digichg('rfttl',1)
            #~ s.wait(DL.rfpulsedt)
            #~ s.digichg('rfttl',0)
        #~ s.wait(0.036)
    #else:
    #    s.wait(bufferdt)
  
    lockwfmscopy = []
    for wavefm in lockwfms:
        cp = copy.deepcopy( wavefm ) 
        cp.idnum = time.time()*100 + 1e3*numpy.random.randint(0,1e8)
        lockwfmscopy.append( cp ) 
        
    
    #########################################
    ## IMAGING AT LOW FIELD
    #########################################
    if DL.lowfieldimg == 1:
        s.wait(DL.lowfieldimg_t0)
        s.digichg('field',0)
        s.wait(-DL.lowfieldimg_t0)
    
    
    #########################################
    ## TTL RELEASE FROM ODT and LATTICE
    #########################################
    #INDICATE WHICH CHANNELS ARE TO BE CONSIDERED FOR THE BACKGROUND
    bg = ['odtttl','irttl1','irttl2','irttl3','greenttl1','greenttl2','greenttl3']
    bgdictPRETOF={}
    for ch in bg:
        bgdictPRETOF[ch] = s.digistatus(ch)
    bgdictPRETOF['tof'] = DL.tof
    print "\nChannel status for pictures: PRE-TOF"
    print bgdictPRETOF
    print
        
    #RELEASE FROM LATTICE
    if DL.tof <= 0.:
        s.wait(1.0+ANDOR.exp)
    s.digichg('greenttl1',0)
    s.digichg('greenttl2',0)
    s.digichg('greenttl3',0)
    s.digichg('irttl1',0)
    s.digichg('irttl2',0)
    s.digichg('irttl3',0)
    #RELEASE FROM IR TRAP
    s.digichg('odtttl',0)
    if DL.tof <= 0.:
        s.wait(-1.0+ANDOR.exp)

    print "TIME WHEN RELEASED FROM LATTICE = ",s.tcur
    s.wait(DL.tof)
    
    return s, noatomswfms, lockwfmscopy, bgdictPRETOF
Esempio n. 36
0
#Switch bfield to FESHBACH
switchdt  = float(report['FESHBACH']['switchdt'])
fstatedt  = float(report['ODT']['fstatedt'])
#bfield.appendhold(fstatedt)
bfield.linear(0.0,0.0)
bfield.appendhold(4*switchdt)
bias  = float(report['FESHBACH']['bias'])
bfield.linear(cnv('bfield',bias),1.0)
#bfield.ExponentialTurnOn( bias, 20.0, 3.0, 'bfield')


uvfppiezo.extend(maxDT)
uvpow.extend(maxDT)
	
# Add adiabatic ramp down to ODT
odtpow = wfm.wave('odtpow', 10.0,ss)
odtpow.extend(ENDUVMOT +  float(report['ODT']['intrap']))
odtpow.linear(2.5,1500.)
#odtpow = odt.odt_adiabaticDown(ss,ENDUVMOT)
	
#Add waveforms to sequence
s.analogwfm_add(ss,[ motpow, repdet, trapdet, bfield, reppow, trappow, uvfppiezo, uvpow, odtpow])
#s.analogwfm_add(ss,[ motpow, repdet, trapdet, bfield, reppow, trappow, uvfppiezo, uvpow])
	
#wait normally rounds down using floor, here the duration is changed before so that
#the wait is rounded up
ENDUVMOT = ss*math.ceil(ENDUVMOT/ss)
	
#insert QUICK pulse  for fast ramping of the field gradient
s.wait(-10.0)
quickval = 1 if gen.bstr('CNC',report) == True else 0
# Add evaporation ramp to ODT
free = float(report['EVAP']['free'])
image = float(report['EVAP']['image'])
buffer = 10.0  #Time needed to re-latch the trigger for the AOUTS
if free < buffer + toENDBFIELD:
    print 'Need at list ' + str(
        buffer) + 'ms of free evap before evaporation can be triggered'
    print 'Currently ramps end at %f , and free is %f' % (toENDBFIELD, free)
    exit(1)
s.wait(free)
odtpow, ENDEVAP, cpowend, ipganalog = odt.odt_evap(image)
evap_ss = float(report['EVAP']['evapss'])
lfdt = float(report['ODT']['lfdt'])
bias = float(report['FESHBACH']['bias'])
bfield = wfm.wave('bfield', bias, evap_ss)
bfield.extend(odtpow.dt() - lfdt)
bfield.linear(0.0, evap_ss)
bfield.extend(odtpow.dt())
s.analogwfm_add(evap_ss, [odtpow, bfield])
# ENDEVAP should be equal to image
s.wait(image)

#Turn off field
s.wait(-lfdt)
s.digichg('field', 0)
s.wait(lfdt)

#RELEASE FROM IR TRAP
s.digichg('odtttl', 0)
odttof = float(report['ODT']['odttof'])
Esempio n. 38
0
sys.path.append('L:/software/apparatus3/seq/utilspy')
sys.path.append('L:/software/apparatus3/seq/seqspy')
sys.path.append('L:/software/apparatus3/convert')

import wfm, numpy

import time

mod_ss = 0.02
cpow = 8.0
moddt = 200.0
moddepth = 40.0

freq_0 = 10
step = 40
freq_f = 7000

odtpow = wfm.wave('odtpow', None, mod_ss, volt=cpow)

set = numpy.arange(freq_0, freq_0 + step * (numpy.fix(
    (freq_f - freq_0) / step) + 1), step)
print set
print

for modfreq in set:
    t0 = time.time()
    print "...Creating SineMod (cpow=%.2f, moddt=%.2f, modfreq=%.2f, moddepth=%.2f" % (
        cpow, moddt, modfreq, moddepth)
    odtpow.SineMod(cpow, moddt, modfreq, moddepth)
    print '...Time used = %.2f seconds\n' % (time.time() - t0)
    print ""
Esempio n. 39
0
def constructLoadRamps(cam):
    global report

    # Initialize channels to MOT SS values and with cncstepsize
    ss = f('CNC', 'cncstepsize')
    motpow = wfm.wave(cnv('motpow', f('MOT', 'motpow')), ss)
    repdet = wfm.wave(cnv('repdet', f('MOT', 'repdetSS')), ss)
    trapdet = wfm.wave(cnv('trapdet', f('MOT', 'trapdetSS')), ss)
    reppow = wfm.wave(cnv('reppow', f('MOT', 'reppowSS')), ss)
    trappow = wfm.wave(cnv('trappow', f('MOT', 'trappowSS')), ss)
    bfield = wfm.wave(cnv('bfield', f('MOT', 'bfield')), ss)

    CNC = False
    #Not doing CNC for photoionization rate measurement

    DURATION = 1.0
    #DURATION = DURATION + ht
    motpow.extend(DURATION)
    repdet.extend(DURATION)
    trapdet.extend(DURATION)
    bfield.extend(DURATION)
    reppow.extend(DURATION)
    trappow.extend(DURATION)
    maxN = int(math.floor((DURATION) / ss)) + 1

    #Up to here you have a Cooled and Compressed MOT
    #

    #Insert bfield imaging value at release
    bfield.linear(cnv('bfield', f(cam, 'imgbfield')), ss)

    #Insert AOM imaging values 30us after release
    imgdt = 0.03
    motpow.appendhold(imgdt)
    repdet.appendhold(imgdt)
    trapdet.appendhold(imgdt)
    reppow.appendhold(imgdt)
    trappow.appendhold(imgdt)

    motpow.linear(cnv('motpow', f(cam, 'imgpow')), 0.0)
    repdet.linear(cnv('repdet', f(cam, 'imgdetrep')), 0.0)
    trapdet.linear(cnv('trapdet', f(cam, 'imgdettrap')), 0.0)
    reppow.linear(cnv('reppow', f(cam, 'imgpowrep')), 0.0)
    trappow.linear(cnv('trappow', f(cam, 'imgpowtrap')), 0.0)

    maxDT = max(motpow.dt(), repdet.dt(), trapdet.dt(), bfield.dt(),
                reppow.dt(), trappow.dt())

    motpow.extend(maxDT)
    repdet.extend(maxDT)
    trapdet.extend(maxDT)
    bfield.extend(maxDT)
    reppow.extend(maxDT)
    trappow.extend(maxDT)

    motpow.fileoutput('L:/software/apparatus3/seq/ramps/motpow.txt')
    repdet.fileoutput('L:/software/apparatus3/seq/ramps/repdet.txt')
    trapdet.fileoutput('L:/software/apparatus3/seq/ramps/trapdet.txt')
    bfield.fileoutput('L:/software/apparatus3/seq/ramps/bfield.txt')
    reppow.fileoutput('L:/software/apparatus3/seq/ramps/reppow.txt')
    trappow.fileoutput('L:/software/apparatus3/seq/ramps/trappow.txt')

    return DURATION
Esempio n. 40
0
def odt_evap_field(image, scale=1.0):
    evap_ss = f('EVAP', 'evapss')

    p0 = f('ODT', 'odtpow')
    p1 = f('EVAP', 'p1')
    t1 = f('EVAP', 't1')
    tau = f('EVAP', 'tau')
    beta = f('EVAP', 'beta')

    offset = f('EVAP', 'offset')
    t2 = f('EVAP', 't2')
    tau2 = f('EVAP', 'tau2')
    smoothdt = f('EVAP', 'smoothdt')

    field_ramp_time = f('EVAP', 'fieldrampt0') * scale
    field_ramp_dt = f('EVAP', 'fieldrampdt') * scale
    field_ramp_start = f('FESHBACH', 'bias')
    field_ramp_final = f('EVAP', 'fieldrampfinal')

    ramp = []
    hashbase = ''
    hashbase = hashbase + '%.8f' % image
    hashbase = hashbase + '%.8f' % evap_ss
    hashbase = hashbase + '%.8f' % field_ramp_time
    hashbase = hashbase + '%.8f' % field_ramp_dt
    hashbase = hashbase + '%.8f' % field_ramp_start
    hashbase = hashbase + '%.8f' % field_ramp_final
    hashbase = hashbase + '%.8f' % scale

    ramphash = seqconf.ramps_dir() + 'Evap_field_withscale' + hashlib.md5(
        hashbase).hexdigest()

    #Here, go ahead and save the trajectory path to the report
    gen.save_to_report('EVAP', 'ramp_field', ramphash)

    bfield = wfm.wave('bfield', field_ramp_start, evap_ss)

    if not os.path.exists(ramphash) or True:
        bfield.extend(field_ramp_time)
        bfield.linear(field_ramp_final, field_ramp_dt)
        if ((field_ramp_time + field_ramp_dt) < image * scale):
            bfield.extend(image * scale)
        else:
            bfield.chop(image * scale)
        ramp = bfield.y
        ramp.tofile(ramphash, sep=',', format="%.4f")
    else:
        print '\t...Recycling previously calculated Evap_field'
        ramp = numpy.fromfile(ramphash, sep=',')
        bfield.y = numpy.append(bfield.y, ramp)

    odtpow = odt_wave('odtpow', p0, evap_ss)
    #~ odtpow_test = odt_wave('NC0', p0, evap_ss)
    #~ odtpow_test2 = odt_wave('NC1', p0, evap_ss)
    #odtpow.Evap(p0, p1, t1, tau, beta, image)
    #odtpow.Evap2(p0, p1, t1, tau, beta, offset, t2, tau2, image)
    #odtpow.Evap3(p0, p1, t1, tau, beta, offset, t2, tau2, image)

    ### SELECT EVAP TRAJECTORY HERE###
    finalcpow = odtpow.Evap8(p0, p1, t1, tau, beta, offset, t2, tau2, smoothdt,
                             image, scale)
    #~ finalcpow2 = odtpow_test.Evap7(p0, p1, t1, tau, beta, offset, t2, tau2,smoothdt,image)
    #~ finalcpow3 = odtpow_test2.Evap7(p0, p1, t1, tau, beta, offset, t2, tau2,smoothdt,image)

    #Here, go ahead and save the finalcpow to the report
    gen.save_to_report('EVAP', 'finalcpow', finalcpow)

    #ipganalog starts out at full power
    ipganalog = ipg_wave('ipganalog', 10., evap_ss)

    if f('ODT', 'use_servo') == 0:
        ipganalog.extend(odtpow.dt())
    elif f('ODT', 'use_servo') == 1:
        ipganalog.follow(odtpow)
    #~ ipganalog.follow( odtpow )

    #~ odtpow.Exponential(pow0,powf,evap_dt,tau)
    #~ odtpow.linear( powf, evap_ss)
    #~ odtpow.appendhold( evap_dt)

    maxDT = odtpow.dt()

    return bfield, odtpow, maxDT, finalcpow, ipganalog  #,odtpow_test,odtpow_test2
s.wait(ramptime)

# Wait after lattice is ramped up
s.wait(LI.inlattice)


#---Go to scattering length zero-crossing
if LI.inlattice < 20:
    buffer = 20.0
else:
    buffer = 0.
s.wait(buffer)


fieldF = EVAP.fieldrampfinal if EVAP.image > EVAP.fieldrampt0 else FB.bias
bfield = wfm.wave('bfield', fieldF, EVAP.evapss)
bfield.linear(ZC.zcbias, ZC.zcrampdt)
bfield.appendhold(ZC.zcdt)
s.analogwfm_add(EVAP.evapss,[bfield])
s.wait(ZC.zcdt + ZC.zcrampdt)


#Testing if field gradient is holding the atoms tightly in the Top/Bottom beam
#~ zcwait = 50.0
#~ zerorampdt = 50.0
#~ zerodt = 50.0
#~ bfield = wfm.wave('bfield',zcbias,evap_ss)
#~ bfield.linear(zcbias,zerorampdt)
#~ bfield.appendhold(zerodt)
#~ bfield.linear(zcbias,zerorampdt)
#~ s.wait(zcwait)
Esempio n. 42
0
ss=float(report['CNC']['cncstepsize'])
	
# Cool and Compress MOT
# ENDCNC is defined as the time up to release from the MOT
motpow, repdet, trapdet, reppow, trappow, bfield, ENDCNC = cnc.cncRamps()
#motpow, repdet, trapdet, reppow, trappow, bfield, ENDCNC = cnc.statetransfer_F32(motpow, repdet, trapdet, reppow, trappow, bfield)
motpow, repdet, trapdet, reppow, trappow, bfield, ENDCNC = cnc.statetransfer_F12(motpow, repdet, trapdet, reppow, trappow, bfield)

#camera='ANDOR'
camera='BASLER'
# Set imaging values
motpow, repdet, trapdet, reppow, trappow, bfield, maxDT = cnc.imagingRamps(motpow, repdet, trapdet, reppow, trappow, bfield, camera)

# Set uv1freq for lightshift probing
freq=float(report['UVLIGHTSHIFT']['freq'])
uv1freq = wfm.wave('uv1freq',cnv('uv1freq',freq),ss)
uv1freq.extend(maxDT)
	
#Add waveforms to sequence
s.analogwfm_add(ss,[motpow,repdet,trapdet,bfield,reppow,trappow,uv1freq])
	
#wait normally rounds down using floor, here the duration is changed before so that
#the wait is rounded up
ENDCNC = ss*math.ceil(ENDCNC/ss)
	
#insert QUICK pulse  for fast ramping of the field gradient
s.wait(-10.0)
quickval = 1 if gen.bstr('CNC',report) == True else 0
s.digichg('quick',quickval)
s.wait(10.0)
	
def rampup( ch, delay, pow, ramp):
    w = wfm.wave( ch, 0., ir_ss)
    w.appendhold( delay)
    w.linear( pow, ramp)
    return w
# Do CNC, UVMOT, and field ramps
s, toENDBFIELD = highfield_uvmot.go_to_highfield(s)

# Evaporate in cross beam trap
s, cpowend = odt.crossbeam_evap(s, toENDBFIELD)

# Go to scattering length zero-crossing
evap_ss = float(report['EVAP']['evapss'])
buffer = 20.0  #Time needed to re-latch the trigger for the AOUTS
s.wait(buffer)
bias = float(report['FESHBACH']['bias'])
zcrampdt = float(report['ZEROCROSS']['zcrampdt'])
zcdt = float(report['ZEROCROSS']['zcdt'])
zcbias = float(report['ZEROCROSS']['zcbias'])
bfield = wfm.wave('bfield', bias, evap_ss)
bfield.linear(zcbias, zcrampdt)
bfield.appendhold(zcdt)
s.analogwfm_add(evap_ss, [bfield])
s.wait(zcdt + zcrampdt)

buffer = 25.0  #Time needed to re-latch the trigger for the AOUTS
s.wait(buffer)

# Ramp up IR and green beams
irramp1 = float(report['LATTICE']['irrampdt1'])
irramp2 = float(report['LATTICE']['irrampdt2'])
irramp3 = float(report['LATTICE']['irrampdt3'])
odtoverlap = float(report['LATTICE']['mantaodtoverlap'])
irdelay1 = float(report['LATTICE']['irdelay1'])
irdelay2 = float(report['LATTICE']['irdelay2'])
Esempio n. 45
0
def cncRamps():
    # Initialize channels to MOT SS values and with cncstepsize
    ss = f('CNC', 'cncstepsize')
    motpow = wfm.wave('motpow', f('MOT', 'motpow'), ss)
    repdet = wfm.wave('repdet', f('MOT', 'repdetSS'), ss)
    trapdet = wfm.wave('trapdet', f('MOT', 'trapdetSS'), ss)
    reppow = wfm.wave('reppow', f('MOT', 'reppowSS'), ss)
    trappow = wfm.wave('trappow', f('MOT', 'trappowSS'), ss)
    bfield = wfm.wave('bfield', f('MOT', 'bfield'), ss)

    CNC = gen.bstr('CNC', report)
    #If CNC is selected in the report then insert necessary linear ramps

    #First ramp bfield
    SINH = gen.bstr('sinh', report)
    if SINH == True:
        bfield.sinhRise(
            f('CNC', 'bfieldf') if CNC == True else f('MOT', 'bfield'),
            f('CNC', 'dtbfield'),
            f('CNC', 'dtbfield') * f('CNC', 'taubfield'))
    else:
        bfield.linear(
            f('CNC', 'bfieldf') if CNC == True else f('MOT', 'bfield'),
            f('CNC', 'dtbfield'))

    #Hold off start of laser ramps
    delay = f('CNC', 'delay')
    motpow.appendhold(delay)
    repdet.appendhold(delay)
    trapdet.appendhold(delay)
    reppow.appendhold(delay)
    trappow.appendhold(delay)

    #Do laser ramps
    motpow.linear(
        f('CNC', 'motpowf') if CNC == True else f('MOT', 'motpow'),
        f('CNC', 'dtmotpow'))
    repdet.linear(
        f('CNC', 'repdetf') if CNC == True else f('MOT', 'repdetSS'),
        f('CNC', 'dtrepdet'))
    trapdet.linear(
        f('CNC', 'trapdetf') if CNC == True else f('MOT', 'trapdetSS'),
        f('CNC', 'dttrapdet'))
    reppow.linear(
        f('CNC', 'reppowf') if CNC == True else f('MOT', 'reppowSS'),
        f('CNC', 'dtreppow'))
    trappow.linear(
        f('CNC', 'trappowf') if CNC == True else f('MOT', 'trappowSS'),
        f('CNC', 'dttrappow'))

    #print motpow.dt()
    #Extend all ramps to match current total duration
    print '...CNC = ' + str(CNC)
    ht = (f('CNC', 'holdtime') if CNC == True else 0.0)
    #print "holdtime = " + str(ht)
    ENDCNC = max(motpow.dt(), repdet.dt(), trapdet.dt(), reppow.dt(),
                 trappow.dt(), bfield.dt()) + ht

    motpow.extend(ENDCNC)
    #print motpow.dt()
    repdet.extend(ENDCNC)
    trapdet.extend(ENDCNC)
    bfield.extend(ENDCNC)
    reppow.extend(ENDCNC)
    trappow.extend(ENDCNC)
    maxN = int(math.floor((ENDCNC) / ss)) + 1

    #print motpow.dt()
    #print reppow.dt()
    #print trappow.dt()
    #print repdet.dt()
    #print trapdet.dt()
    #print bfield.dt()
    #print uvdet.dt()

    #Up to here you have a Cooled and Compressed MOT
    #
    return motpow, repdet, trapdet, reppow, trappow, bfield, ENDCNC
Esempio n. 46
0
def crossbeam_evap_into_lattice(s, toENDBFIELD):
    # Add evaporation ramp to ODT, returns sequence right at the end of evaporation
    free = float(report['EVAP']['free'])
    image = float(report['EVAP']['image'])
    buffer = 10.0  #Time needed to re-latch the trigger for the AOUTS
    if free < buffer + toENDBFIELD:
        print 'Need at list ' + str(
            buffer) + 'ms of free evap before evaporation can be triggered'
        print 'Currently ramps end at %f , and free is %f' % (toENDBFIELD,
                                                              free)
        exit(1)
    s.wait(free)
    odtpow, ENDEVAP, cpowend, ipganalog = odt_evap(image)
    # ENDEVAP should be equal to image
    evap_ss = float(report['EVAP']['evapss'])

    # Set LCR preset value in the begining of evap 1 is lattice 0 is dimple
    lcr_preset = float(report['EVAP']['lcr_preset'])
    lcr1 = lattice.lattice_wave('lcr1', lcr_preset, evap_ss)
    lcr2 = lattice.lattice_wave('lcr2', lcr_preset, evap_ss)
    lcr3 = lattice.lattice_wave('lcr3', lcr_preset, evap_ss)
    lcr1.extend(ENDEVAP)
    lcr2.extend(ENDEVAP)
    lcr3.extend(ENDEVAP)

    # Ramp up IR and green beams
    irramp1 = float(report['INTOLATTICE']['irrampdt1'])
    irramp2 = float(report['INTOLATTICE']['irrampdt2'])
    irramp3 = float(report['INTOLATTICE']['irrampdt3'])
    irdelay1 = float(report['INTOLATTICE']['irdelay1'])
    irdelay2 = float(report['INTOLATTICE']['irdelay2'])
    irdelay3 = float(report['INTOLATTICE']['irdelay3'])

    ir1 = wfm.wave('ir1pow', 0., evap_ss)
    ir2 = wfm.wave('ir2pow', 0., evap_ss)
    ir3 = wfm.wave('ir3pow', 0., evap_ss)

    loadtime = float(report['INTOLATTICE']['loadtime'])

    ir1.appendhold(ENDEVAP - loadtime)
    ir2.appendhold(ENDEVAP - loadtime)
    ir3.appendhold(ENDEVAP - loadtime)

    ir1.appendhold(irdelay1)
    ir2.appendhold(irdelay2)
    ir3.appendhold(irdelay3)

    ir1.linear(float(report['INTOLATTICE']['irpow1']), irramp1)
    ir2.linear(float(report['INTOLATTICE']['irpow2']), irramp2)
    ir3.linear(float(report['INTOLATTICE']['irpow3']), irramp3)

    gr1 = wfm.wave('greenpow1', 0., evap_ss)
    gr2 = wfm.wave('greenpow2', 0., evap_ss)
    gr3 = wfm.wave('greenpow3', 0., evap_ss)

    gr1.appendhold(ENDEVAP - loadtime)
    gr2.appendhold(ENDEVAP - loadtime)
    gr3.appendhold(ENDEVAP - loadtime)

    grdelay1 = float(report['INTOLATTICE']['grdelay1'])
    grdelay2 = float(report['INTOLATTICE']['grdelay2'])
    grdelay3 = float(report['INTOLATTICE']['grdelay3'])

    gr1.appendhold(grdelay1)
    gr2.appendhold(grdelay2)
    gr3.appendhold(grdelay3)

    grramp1 = float(report['INTOLATTICE']['grrampdt1'])
    grramp2 = float(report['INTOLATTICE']['grrampdt2'])
    grramp3 = float(report['INTOLATTICE']['grrampdt3'])
    gr1.linear(float(report['INTOLATTICE']['grpow1']), grramp1)
    gr2.linear(float(report['INTOLATTICE']['grpow2']), grramp2)
    gr3.linear(float(report['INTOLATTICE']['grpow3']), grramp3)

    #end = s.analogwfm_add(evap_ss,[odtpow,ipganalog,ir1,ir2,ir3,gr1,gr2,gr3])
    end = s.analogwfm_add(
        evap_ss, [odtpow, ir1, ir2, ir3, gr1, gr2, gr3, lcr1, lcr2, lcr3])

    s.wait(image - loadtime)

    # Turn on IR lattice beams
    s.wait(irdelay1)
    s.digichg('irttl1', float(report['INTOLATTICE']['ir1']))
    s.wait(-irdelay1 + irdelay2)
    s.digichg('irttl2', float(report['INTOLATTICE']['ir2']))
    s.wait(-irdelay2 + irdelay3)
    s.digichg('irttl3', float(report['INTOLATTICE']['ir3']))
    s.wait(-irdelay3)

    s.wait(grdelay1)
    s.digichg('greenttl1', float(report['INTOLATTICE']['gr1']))
    s.wait(-grdelay1 + grdelay2)
    s.digichg('greenttl2', float(report['INTOLATTICE']['gr2']))
    s.wait(-grdelay2 + grdelay3)
    s.digichg('greenttl3', float(report['INTOLATTICE']['gr3']))
    s.wait(-grdelay3)

    s.wait(loadtime + end - image)

    return s

# Evaporate into the dimple 
s, cpowend = odt.crossbeam_dimple_evap(s, toENDBFIELD)




buffer = 20.
s.wait(buffer)



# Go to scattering length zero-crossing
fieldF = EVAP.fieldrampfinal if DIMPLE.image > EVAP.fieldrampt0 else FB.bias
bfield = wfm.wave('bfield', fieldF, DIMPLE.analogss)
if DIMPLE.zct0 > buffer:
    bfield.appendhold( DIMPLE.zct0 - buffer)
bfield.linear(ZC.zcbias, ZC.zcrampdt)
bfield.appendhold(ZC.zcdt)

#~ shunt = wfm.wave('gradientfield', DIMPLE.finalV, DIMPLE.analogss)
#~ shunt.extend( odtpow.dt() ) 
#~ shunt.appendhold( DIMPLE.zct0 )
#~ shunt.linear( DIMPLE.zcV, ZC.zcrampdt)
#~ shunt.appendhold(ZC.zcdt)

# Add waveforms
gradient = gradient_wave('gradientfield', 0.0, bfield.ss,volt=0)
gradient.follow( bfield)
s.analogwfm_add(DIMPLE.analogss,[bfield,gradient])
Esempio n. 48
0
def  go_to_highfield(s):

	#---Keep ODT on
	odton = gen.bstr('ODT',report)
	if odton == True:
		s.digichg('odtttl',1)
	s.wait(20.0)

	ss = SEQ.analogstepsize

	#---Cool and Compress MOT
	#---ENDCNC is defined as the time up to release from the MOT
	motpow, repdet, trapdet, reppow, trappow, bfield, ENDCNC = cnc.cncRamps()

	#---Load UVMOT from CNCMOT
	uvpow2, uvpow, motpow, bfield, ENDUVMOT = uvmot.uvRamps(motpow, bfield, ENDCNC)

	repdet.extend(ENDUVMOT)
	trapdet.extend(ENDUVMOT)
	reppow.extend(ENDUVMOT)
	trappow.extend(ENDUVMOT)
	
	#---Make sure everything has the same length before setting imaging values
	#--- Set imaging values
	camera = 'ANDOR'
	motpow, repdet, trapdet, reppow, trappow, maxDT = cnc.imagingRamps_nobfield(motpow, repdet, trapdet, reppow, trappow, camera)


	#---Switch bfield to FESHBACH 
	bfield.appendhold(FB.rampdelay)
	bfield.linear( FB.bf, FB.rampbf)
	bfield.appendhold( FB.feshbachdt)
	bfield.linear(0.0, 0.0)
	bfield.appendhold( FB.switchondt + FB.switchdelay + UV.extradt)
	bfield.linear(FB.bias,FB.rampdt)


	#---Set the starting voltage for the ODT
	odtpow0 = odt.odt_wave('odtpow', ODT.odtpow0, ss)
	odtpow0.extend(ENDUVMOT)
	
	#---Change shunt value from motV to hfV before going to highfield
	shunt = wfm.wave('gradientfield', SHUNT.motV, ss, volt = SHUNT.motV)
	shunt.extend(ENDUVMOT + FB.rampdelay + FB.rampbf + FB.feshbachdt + UV.extradt) 
	#shunt.linear(SHUNT.hfV, 0.0,volt =SHUNT.hfV)	
	shunt.linear(SHUNT.hfV, 0.0,volt =0.0)	
	
	
	wfms = [ motpow, repdet, trapdet, bfield, reppow, trappow, uvpow, uvpow2,odtpow0, shunt]

	
	#---Add waveforms to sequence
	s.analogwfm_add(ss,wfms)
	
		
	#wait normally rounds down using floor, here the duration is changed before so that
	#the wait is rounded up
	ENDUVMOT = ss*math.ceil(ENDUVMOT/ss)
	
	#---Insert QUICK pulse for fast ramping of the field gradient during CNC
	s.wait(-10.0)
	quickval = 1 if gen.bstr('CNC',report) == True else 0
	s.digichg('quick',quickval)	
	s.wait(10.0)
	s.wait(ENDCNC)
	s.digichg('quick',0)
	
	#---Go back in time, shut down the UVAOM's 
	#---UVAOM's were on to keep them warm
	s.wait(UV.clearaoms)
	s.digichg('uvaom1',0)
	s.digichg('uvaom2',0)
	s.wait(-UV.clearaoms)
	
	#---Insert ODT overlap 
	s.wait(-ODT.overlapdt-ODT.servodt)
	s.digichg('odt7595',1)
	s.wait(ODT.servodt)
	s.digichg('odtttl',1)
	s.wait(ODT.overlapdt)
	
	#---Turn OFF red light
	s.wait(UV.delay_red)
	s.digichg('motswitch',0) 
	s.digichg('motshutter',1)
	s.wait(-UV.delay_red)
	
	#---Turn ON UVAOM's
	s.wait(UV.delay_uv)
        #---make sure to open the shutter:
        s.wait(UV.openshutter)
	s.digichg('uvshutter',1)
        s.wait(-UV.openshutter)

	s.digichg('uvaom1',1)
	s.digichg('uvaom2',1)
	s.wait(-UV.delay_uv)
	

	#---Go to MOT release time
	s.wait(-ENDCNC)
	s.wait(ENDUVMOT)
	

	#---Go to end of field rampdown and set QUICK back to low
	s.wait(FB.rampdelay+FB.rampbf) 
	s.digichg('quick',0)
	

	#---Wait in the UVMOT and then do optical pumping
	s.wait(UV.extradt) 
	s.wait(-UV.pumptime)
	s.digichg('uvaom2',0)
	s.wait(UV.pumptime)
	#---Turn OFF UVAOM
	s.digichg('uvaom1',0)
	#---Close UV shutter
	waitshutter=UV.closeshutter
	s.wait(waitshutter)
	s.digichg('uvshutter',0)
	s.wait(-waitshutter)

	#---Turn OFF MOT magnetic field and switch it to FESHBACH
	s.digichg('field',0)
	s.wait( FB.feshbachdt )
	s.digichg('feshbach',1)
	s.wait(FB.switchondt)
	do_quick=1
	s.digichg('field',1)
	s.digichg('hfquick',do_quick)
	s.digichg('quick',do_quick)
	#Can't leave quick ON for more than quickmax
	quickmax=100.
	s.wait(quickmax)
	s.digichg('hfquick',0)
	s.digichg('quick',0)
	s.wait(-quickmax)
	#
	s.wait(FB.switchdelay+FB.rampdt)
	s.digichg('quick',0)
	s.wait(-FB.rampdt)
	s.wait(-FB.switchdelay - FB.switchondt - FB.feshbachdt - ss)


	#---At this point the time sequence is at ENDUVMOT
	#---Leave the sequence at the end of the UVMOT, but provide the amount
	#---of time that it needs to wait to go to ENDBFIELD
	toENDBFIELD = FB.rampdt + FB.switchdelay + FB.switchondt + FB.feshbachdt
	
	return s, toENDBFIELD
sys.path.append('L:/software/apparatus3/seq/utilspy')
sys.path.append('L:/software/apparatus3/seq/seqspy')
sys.path.append('L:/software/apparatus3/convert')

import wfm, numpy

import time


mod_ss = 0.02
cpow = 6.0
moddt = 200.0
moddepth = 40.0


freq_0 = 10
step  = 10
freq_f = 15000

odtpow  = wfm.wave('odtpow',  None, mod_ss, volt=cpow)

set = numpy.arange(freq_0 , freq_0 +  step*(numpy.fix((freq_f-freq_0)/step)+1), step)
print set 
print

for modfreq in set:
    t0=time.time()
    print "...Creating SineMod (cpow=%.2f, moddt=%.2f, modfreq=%.2f, moddepth=%.2f" % (cpow, moddt, modfreq, moddepth) 
    odtpow.SineMod( cpow, moddt, modfreq, moddepth)
    print '...Time used = %.2f seconds\n' % (time.time()-t0)
    print ""
Esempio n. 50
0
def go_to_highfield(s):

    #Keep ODT on
    ODT = gen.bstr('ODT', report)
    if ODT == True:
        s.digichg('odtttl', 1)
    s.wait(20.0)

    ss = float(report['SEQ']['analogstepsize'])

    # Cool and Compress MOT
    # ENDCNC is defined as the time up to release from the MOT
    motpow, repdet, trapdet, reppow, trappow, bfield, ENDCNC = cnc.cncRamps()

    # Load UVMOT from CNCMOT
    uvfppiezo, uvpow2, uvpow, motpow, repdet, trapdet, reppow, trappow, bfield, ENDUVMOT = uvcooling_repump.uvcoolRamps_repump(
        motpow, repdet, trapdet, reppow, trappow, bfield, ENDCNC)

    # Set imaging values
    camera = 'ANDOR'
    motpow, repdet, trapdet, reppow, trappow, maxDT = cnc.imagingRamps_nobfield(
        motpow, repdet, trapdet, reppow, trappow, camera)

    # Switch bfield to FESHBACH
    overlapdt = float(report['ODT']['overlapdt'])
    rampdelay = float(report['ODT']['rampdelay'])
    rampbf = float(report['ODT']['rampbf'])
    bf = float(report['ODT']['bf'])
    feshbachdt = float(report['ODT']['feshbachdt'])
    switchondt = float(report['FESHBACH']['switchondt'])
    switchdelay = float(report['FESHBACH']['switchdelay'])
    bias = float(report['FESHBACH']['bias'])
    biasrampdt = float(report['FESHBACH']['rampdt'])

    bfield.chop(ENDUVMOT - overlapdt, 1)
    bfield.appendhold(rampdelay)
    bfield.linear(bf, rampbf)
    bfield.extend(ENDUVMOT + feshbachdt)
    bfield.linear(0.0, 0.0)
    ENDBFIELD = feshbachdt
    bfield.appendhold(switchondt + switchdelay)
    bfield.linear(bias, biasrampdt)

    rampupdt = float(report['ODT']['rampupdt'])
    updt = float(report['ODT']['updt'])
    overshootdt = float(report['ODT']['overshootdt'])

    #~ odtpow0 = wfm.wave('odtpow', 0.0, ss)
    #~ odtpow0.extend(ENDUVMOT-overlapdt-updt-rampupdt)
    #~ odtpow0.odt_linear( 0.0 , f('ODT','odtpow0'), rampupdt)
    #~ odtpow0.appendhold( updt)
    #~ odtpow0.odt_linear(f('ODT','odtpow0'), f('ODT','odtpow'), overshootdt)

    odtpow0 = wfm.wave('odtpow', f('ODT', 'odtpow0'), ss)
    odtpow0.extend(ENDUVMOT - overlapdt)
    odtpow0.odt_linear(f('ODT', 'odtpow0'), f('ODT', 'odtpow'), overshootdt)

    EXTRA = max(
        overshootdt - (bfield.dt() - (ENDUVMOT - overlapdt - updt - rampupdt)),
        0.0)
    print "...EXTRA time to allow for ODT overshoot = %f" % EXTRA

    #Add waveforms to sequence
    s.analogwfm_add(ss, [
        motpow, repdet, trapdet, bfield, reppow, trappow, uvfppiezo, uvpow,
        uvpow2, odtpow0
    ])

    #wait normally rounds down using floor, here the duration is changed before so that
    #the wait is rounded up
    ENDUVMOT = ss * math.ceil(ENDUVMOT / ss)

    #insert QUICK pulse  for fast ramping of the field gradient
    s.wait(-10.0)
    quickval = 1 if gen.bstr('CNC', report) == True else 0
    s.digichg('quick', quickval)
    s.wait(10.0)

    #insert UV pulse
    uvtime = float(report['UV']['uvtime'])
    s.wait(ENDCNC)
    s.digichg('quick', 0)
    s.wait(uvtime)
    #Shut down the UVAOM's and open the shutter
    s.wait(-50.0)
    s.digichg('uvaom1', 0)
    s.digichg('uvaom2', 0)
    s.digichg('uvshutter', 1)
    s.wait(50.0)
    #Turn on UVAOM
    s.digichg('uvaom1', 1)
    s.wait(-uvtime)

    #Turn on UVAOM2
    uvreptime = float(report['UV']['uvreptime'])
    s.wait(uvreptime)
    s.digichg('uvaom2', 1)

    #Tur off RED light
    s.digichg('motswitch', 0)
    s.digichg('motshutter', 1)
    s.wait(-uvreptime)

    s.wait(-ENDCNC)

    #Go to MOT release time and set QUICK back to low
    s.wait(ENDUVMOT)
    s.digichg('quick', 0)

    #Turn OFF UVAOM2 for optical pumping
    pumptime = float(report['UV']['pumptime'])
    uvhold = float(report['UV']['uvhold'])
    s.wait(-pumptime)
    s.digichg('uvaom2', 0)
    s.wait(pumptime)

    #Leave UVMOT on for state transfer
    fstatedt = float(report['ODT']['fstatedt'])
    s.wait(fstatedt)
    s.digichg('uvaom1', 0)
    s.wait(-fstatedt)

    #Close UV shutter
    waitshutter = 5.0
    s.wait(waitshutter)
    s.digichg('uvshutter', 0)
    s.wait(-waitshutter)

    #Turn OFF MOT magnetic field
    s.digichg('field', 0)

    #Insert ODT overlap with UVMOT and switch field to FESHBACH
    overlapdt = float(report['ODT']['overlapdt'])
    servodt = float(report['ODT']['servodt'])
    s.wait(-overlapdt - servodt)
    s.digichg('odt7595', 1)
    s.wait(servodt)
    s.digichg('odtttl', 1)
    #feshbachdt = rampdelay + rampbf + holdbf
    s.wait(overlapdt)
    s.wait(feshbachdt)
    s.digichg('feshbach', 1)
    #s.wait(overlapdt - feshbachdt)
    #s.wait( -feshbachdt)

    #s.wait(offdelay)
    #s.wait(2*switchdt)
    #s.wait(quickdelay)
    s.wait(switchondt)
    do_quick = 1
    s.digichg('field', 1)
    s.digichg('hfquick', do_quick)
    s.digichg('quick', do_quick)
    #Can't leave quick ON for more than quickmax
    quickmax = 100.
    s.wait(quickmax)
    s.digichg('hfquick', 0)
    s.digichg('quick', 0)
    s.wait(-quickmax)
    s.wait(switchdelay + biasrampdt)
    s.digichg('quick', 0)
    s.wait(-biasrampdt)
    #s.wait(-switchdelay-quickdelay-2*switchdt-offdelay)
    s.wait(-switchdelay - switchondt - feshbachdt - ss)

    #At this point the time sequence is at ENDUVMOT

    #This is the time until the end of the bfield ramp
    #toENDBFIELD = biasrampdt + switchdelay + quickdelay + 2*switchdt + offdelay
    toENDBFIELD = biasrampdt + switchdelay + switchondt + feshbachdt

    return s, toENDBFIELD + EXTRA
#Get hfimg ready
s.digichg('hfimg',1)

#If using analoghfimg get it ready
if ANDOR.analoghfimg == 1:
	s.digichg('analogimgttl',1)


# Do CNC, UVMOT, and field ramps
s, toENDBFIELD = highfield_uvmot.go_to_highfield(s)

analoghfimg = []
# THis section used to resolve the issue we have probe or bragg kill in dimple section
if DL.probekill ==1:
    if (-DL.probekilltime) > DL.image:
        analoghfimg = [wfm.wave('analogimg', DL.probekill_hfimg, EVAP.evapss)]
elif DL.braggkill == 1:
    if (-DL.braggkilltime) > DL.image:
        print "...braggkill will be inserted in DIMPLE part of sequence"
        hfimgwfm = wfm.wave('analogimg', DL.braggkill_hfimg, EVAP.evapss)
        
        
        analoghfimg = [hfimgwfm]

    
    
    
# Evaporate into the dimple 
s, cpowend = odt.crossbeam_dimple_evap(s, toENDBFIELD,analoghfimg)

if lbf.bindbfield == 1:
    lbf.bstage2 = lbf.bstage1
    


#This step size is used in all ramps from here on
ir_ss = 0.01
buffer=25.0 #Time needed to re-latch the trigger for the AOUTS
s.wait(buffer)

#########################################
## RAMPS TO INTERMEDIATE VALUES
#########################################

# Ramp B Field to intermediate value 
bfield = wfm.wave('bfield', evap.fieldrampfinal ,ir_ss)
bfield.appendhold( lbf.brampdelay1 )
bfield.linear( lbf.bstage1, lbf.brampdt1 )
# With respect to the start of the sequence, set QUICK2 pulse
s.wait(-lbf.quick2time + lbf.brampdelay1 )
s.digichg('quick2',1)
s.wait( lbf.quick2time - lbf.brampdelay1 )


    
# Ramp up IR and green beams to intermediate value 
ir1  = lattice.lattice_wave('ir1pow', ir_p0, ir_ss,volt=-11)
ir2  = lattice.lattice_wave('ir2pow', ir_p0, ir_ss,volt=-11)
ir3  = lattice.lattice_wave('ir3pow', ir_p0, ir_ss,volt=-11)
ir1.appendhold( lbf.ir1delay1 )
ir2.appendhold( lbf.ir2delay1 )
if lbf.bindbfield == 1:
    lbf.bstage2 = lbf.bstage1
    


#This step size is used in all ramps from here on
ir_ss = 0.01
buffer=25.0 #Time needed to re-latch the trigger for the AOUTS
s.wait(buffer)
 
#########################################
## RAMPS TO INTERMEDIATE VALUES
#########################################

# Ramp B Field to intermediate value 
bfield = wfm.wave('bfield', evap.fieldrampfinal ,ir_ss)
bfield.appendhold( lbf.brampdelay1 )
bfield.linear( lbf.bstage1, lbf.brampdt1 )
# With respect to the start of the sequence, set QUICK2 pulse
s.wait(-lbf.quick2time + lbf.brampdelay1 )
if lbf.usequick2 == 1:
	s.digichg('quick2',1)
else:
	s.digichg('quick2',0)
s.wait( lbf.quick2time - lbf.brampdelay1 )


    
# Ramp up IR and green beams to intermediate value 
ir1  = lattice.lattice_wave('ir1pow', ir_p0, ir_ss,volt=-11)
ir2  = lattice.lattice_wave('ir2pow', ir_p0, ir_ss,volt=-11)
Esempio n. 54
0
def constructUVCoolRamps(cam):
	global report

	# Initialize channels to MOT SS values and with cncstepsize
	ss=f('CNC','cncstepsize')
	motpow   = wfm.wave(cnv('motpow',f('MOT','motpow')), ss)
	repdet   = wfm.wave(cnv('repdet',f('MOT','repdetSS')),ss)
	trapdet  = wfm.wave(cnv('trapdet',f('MOT','trapdetSS')),ss)
	reppow   = wfm.wave(cnv('reppow',f('MOT','reppowSS')),ss)
	trappow  = wfm.wave(cnv('trappow',f('MOT','trappowSS')),ss)
	bfield   = wfm.wave(cnv('bfield',f('MOT','bfield')),ss)
	
	#Ramp down  bfield and trapping beam and motpow
	bfield.linear( cnv('bfield',f('UVCOOL','uvbfield')), ss)
	trappow.linear( cnv('trappow',f('UVCOOL','trapP')),ss)
	motpow.linear( cnv('motpow',f('UVCOOL','motP')),ss)
	bfield.appendhold(f('UVCOOL','cooldt')-ss)

	maxCNCdt = max( motpow.dt(), repdet.dt(), trapdet.dt(), bfield.dt() )

	DURATION = maxCNCdt

	motpow.extend( DURATION)
	repdet.extend( DURATION)
	trapdet.extend(DURATION)
	reppow.extend(DURATION)
	trappow.extend(DURATION)
	bfield.extend( DURATION)

	maxN=int(math.floor( (DURATION)/ss))+1


	#Insert bfield imaging value at release
	bfield.linear(cnv('bfield',f(cam,'imgbfield')),0.0)
	
	#Insert AOM imaging values 50us after release
	imgdt=0.2
	motpow.appendhold(imgdt)
	repdet.appendhold(imgdt)
	trapdet.appendhold(imgdt)
	reppow.appendhold(imgdt)
	trappow.appendhold(imgdt)
	
	motpow.linear(cnv('motpow',f(cam,'imgpow')),0.0)
	repdet.linear(cnv('repdet',f(cam,'imgdetrep')),0.0)
	trapdet.linear(cnv('trapdet',f(cam,'imgdettrap')),0.0)
	reppow.linear(cnv('reppow',f(cam,'imgpowrep')),0.0)
	trappow.linear(cnv('trappow',f(cam,'imgpowtrap')),0.0)


	maxDT = max( motpow.dt(), repdet.dt(), trapdet.dt(), bfield.dt(),\
		reppow.dt(), trappow.dt())

	motpow.extend(maxDT)
	repdet.extend(maxDT)
	trapdet.extend(maxDT)
	bfield.extend(maxDT)
	reppow.extend(maxDT)
	trappow.extend(maxDT)

	
	motpow.fileoutput( 'L:/software/apparatus3/seq/ramps/motpow.txt')
	repdet.fileoutput( 'L:/software/apparatus3/seq/ramps/repdet.txt')
	trapdet.fileoutput('L:/software/apparatus3/seq/ramps/trapdet.txt')
	bfield.fileoutput( 'L:/software/apparatus3/seq/ramps/bfield.txt')
	reppow.fileoutput( 'L:/software/apparatus3/seq/ramps/reppow.txt')
	trappow.fileoutput('L:/software/apparatus3/seq/ramps/trappow.txt')
	return DURATION
import sys, math
sys.path.append('L:/software/apparatus3/seq/utilspy')
sys.path.append('L:/software/apparatus3/seq/seqspy')
sys.path.append('L:/software/apparatus3/convert')
import seq, wfm, gen



stepsize=0.01
s=seq.sequence(stepsize)

s.digichg('field',1)

s.wait(50.0)

bfield   = wfm.wave('bfield',0,stepsize)
bfield.appendhold(10.0)
bfield.linear(2.0,stepsize)
bfield.appendhold(50.0)
bfield.linear(0.0,stepsize)
bfield.appendhold(stepsize)
bfield.fileoutput( 'L:/software/apparatus3/seq/ramps/testcoils.txt')

#Add the load trap waveforms
duration = s.analogwfm(stepsize,[ \
{'name':'bfield',   'path':'L:/software/apparatus3/seq/ramps/testcoils.txt'} ])

dt=30.0
s.wait(-dt)
s.digichg('quick',1)
s.wait(dt+10.+5.)
#Get hfimg ready
s.digichg('hfimg', 1)

#If using analoghfimg get it ready
if ANDOR.analoghfimg == 1:
    s.digichg('analogimgttl', 1)

# Do CNC, UVMOT, and field ramps
s, toENDBFIELD = highfield_uvmot.go_to_highfield(s)

analoghfimg = []
# THis section used to resolve the issue we have probe or bragg kill in dimple section
if DL.probekill == 1:
    if (-DL.probekilltime) > DL.image:
        analoghfimg = [wfm.wave('analogimg', DL.probekill_hfimg, EVAP.evapss)]
elif DL.braggkill == 1:
    if (-DL.braggkilltime) > DL.image:
        print "...braggkill will be inserted in DIMPLE part of sequence"
        hfimgwfm = wfm.wave('analogimg', DL.braggkill_hfimg, EVAP.evapss)

        analoghfimg = [hfimgwfm]

# Evaporate into the dimple
s, cpowend = odt.crossbeam_dimple_evap(s, toENDBFIELD, analoghfimg)

# Ramp up the lattice
s, lastIR = lattice.dimple_to_lattice(s, cpowend)

#########################################
## OTHER TTL EVENTS: probekill, braggkill, rf, quick2
Esempio n. 57
0
def odt_lightshift(image):
    evap_ss = f("EVAP", "evapss")

    p0 = f("ODT", "odtpow")
    p1 = f("EVAP", "p1")
    t1 = f("EVAP", "t1")
    tau = f("EVAP", "tau")
    beta = f("EVAP", "beta")

    waitdt = f("UVLS", "waitdt")
    waitdt2 = f("UVLS", "waitdt2")

    cdt = f("UVLS", "cdt")
    cpow = f("UVLS", "cpow")

    b0 = f("FESHBACH", "bias")
    bf = 0.0
    bdt = f("UVLS", "bdt")
    bpulse = cnv("bfield", f("UVLS", "bpulse"))
    dtpulse = f("UVLS", "pulse")
    bimg = 0.0

    uvfreq = f("UVLS", "uvfreq")
    det = cnv("uvdet", f("UVLS", "uvdet"))
    power = f("UVLS", "uvpow2")

    odtpow = wfm.wave("odtpow", cnv("odtpow", p0), evap_ss)
    bfield = wfm.wave("bfield", cnv("bfield", b0), evap_ss)
    uv1freq = wfm.wave("uv1freq", 5.905, evap_ss)
    uvdet = wfm.wave("uvdet", 2.9, evap_ss)
    uvpow = wfm.wave("uvpow", cnv("uvpow", f("UV", "uvpow")), evap_ss)
    # uvpow2= wfm.wave('uvpow2', power, evap_ss)

    uv1freq.linear(uvfreq, 10.0)
    uvdet.linear(det, 100)
    uvpow.linear(cnv("uvpow", f("UVLS", "lspow")), 10.0)

    odtpow.Evap(p0, p1, t1, tau, beta, image)
    bfield.extend(odtpow.dt())
    bfield.linear(bpulse, bdt)
    bfield.appendhold(waitdt)
    odtpow.extend(bfield.dt())

    odtpow.linear(cnv("odtpow", cpow), cdt)
    odtpow.appendhold(waitdt2)
    bfield.extend(odtpow.dt())

    ENDC = max(odtpow.dt(), bfield.dt())

    hframpdt = f("UVLS", "hframpdt")
    bfield.appendhold(dtpulse)

    bfield.linear(cnv("bfield", b0), hframpdt)
    # bfield.linear( 0.0, evap_ss)

    totalDT = bfield.dt()

    odtpow.extend(totalDT)
    uv1freq.extend(totalDT)
    uvdet.extend(totalDT)

    return odtpow, bfield, uv1freq, uvdet, uvpow, ENDC
Esempio n. 58
0
def odt_lightshift(image):
    evap_ss = f('EVAP', 'evapss')

    p0 = f('ODT', 'odtpow')
    p1 = f('EVAP', 'p1')
    t1 = f('EVAP', 't1')
    tau = f('EVAP', 'tau')
    beta = f('EVAP', 'beta')

    waitdt = f('UVLS', 'waitdt')
    waitdt2 = f('UVLS', 'waitdt2')

    cdt = f('UVLS', 'cdt')
    cpow = f('UVLS', 'cpow')

    b0 = f('FESHBACH', 'bias')
    bf = 0.0
    bdt = f('UVLS', 'bdt')
    bpulse = cnv('bfield', f('UVLS', 'bpulse'))
    dtpulse = f('UVLS', 'pulse')
    bimg = 0.0

    uvfreq = f('UVLS', 'uvfreq')
    det = cnv('uvdet', f('UVLS', 'uvdet'))
    power = f('UVLS', 'uvpow2')

    odtpow = wfm.wave('odtpow', cnv('odtpow', p0), evap_ss)
    bfield = wfm.wave('bfield', cnv('bfield', b0), evap_ss)
    uv1freq = wfm.wave('uv1freq', 5.905, evap_ss)
    uvdet = wfm.wave('uvdet', 2.9, evap_ss)
    uvpow = wfm.wave('uvpow', cnv('uvpow', f('UV', 'uvpow')), evap_ss)
    #uvpow2= wfm.wave('uvpow2', power, evap_ss)

    uv1freq.linear(uvfreq, 10.0)
    uvdet.linear(det, 100)
    uvpow.linear(cnv('uvpow', f('UVLS', 'lspow')), 10.0)

    odtpow.Evap(p0, p1, t1, tau, beta, image)
    bfield.extend(odtpow.dt())
    bfield.linear(bpulse, bdt)
    bfield.appendhold(waitdt)
    odtpow.extend(bfield.dt())

    odtpow.linear(cnv('odtpow', cpow), cdt)
    odtpow.appendhold(waitdt2)
    bfield.extend(odtpow.dt())

    ENDC = max(odtpow.dt(), bfield.dt())

    hframpdt = f('UVLS', 'hframpdt')
    bfield.appendhold(dtpulse)

    bfield.linear(cnv('bfield', b0), hframpdt)
    #bfield.linear( 0.0, evap_ss)

    totalDT = bfield.dt()

    odtpow.extend(totalDT)
    uv1freq.extend(totalDT)
    uvdet.extend(totalDT)

    return odtpow, bfield, uv1freq, uvdet, uvpow, ENDC