In [ ]:
from Initialization import *
In [2]:
station.pulsar.update_channel_settings()
In [3]:
station.components
Out[3]:
In [ ]:
station.AWG
In [1]:
AWG.ch1_amp.get()
In [ ]:
import pyvisa
rm = pyvisa.ResourceManager()
rm.list_resources()
In [5]:
bla = rm.open_resource('TCPIP0::192.168.1.27::1234::SOCKET', read_termination='\r\n')
In [6]:
bla.query("*IDN?")
Out[6]:
In [7]:
import visa
global_rs = visa.ResourceManager('@py')
# global_rs.list_resources()
In [8]:
awg=global_rs.open_resource('TCPIP0::192.168.1.27::1234::SOCKET', read_termination='\r\n')
In [ ]:
awg.query("*IDN?")
In [ ]:
In [ ]:
In [ ]:
devAWG.id()
devAWG.set_run_mode('ENH')
In [ ]:
devSGS = RS_SGS100A('TCPIP::192.168.1.37::INSTR')
In [ ]:
devFSV = RS_FSV('TCPIP::192.168.1.37::INSTR')
In [ ]:
devSGS.setCWfrequency(6.0e9)
devSGS.setCWpower(-10)
devSGS.RFon()
devSGS.IQon()
In [ ]:
devSGS.setCWpower(-10)
In [ ]:
devOsc = Rigol_DS1054('TCPIP::192.168.1.25::INSTR')
devOsc.id()
In [ ]:
AWG.define_channels(id='ch1', name='RF1', type='analog',
high=0.541, low=-0.541,
offset=0., delay=0, active=True)
AWG.define_channels(id='ch2', name='RF2', type='analog',
high=0.541, low=-0.541,
offset=0., delay=0, active=True)
AWG.define_channels(id='ch1_marker1', name='MW_pulsemod', type='marker',
high=1.0, low=0, offset=0.,
delay=0, active=True)
AWG.define_channels(id='ch2_marker1', name='trigger', type='marker',
high=1, low=0,
offset=0., delay=0, active=True)
#-------------------------------------------------------
#-------------------------------------------------------
# define some bogus pulses.
# We use an element to configure and store the pulse
# For now we have defined some standard pulses but will
# increase our library in the future
sin_pulse = pulse.CosPulse(channel='RF1', name='A sine pulse on RF')
sin_pulse_2 = pulse.CosPulse(channel='RF2', name='A sine pulse on RF')
SSB_pulse = pulse.MW_IQmod_pulse(I_channel ='RF2', Q_channel='RF1', name='SSB pulse')
# train = pulse.clock_train(channel='trigger', name='A sine pulse on RF')
sq_pulse = pulse.SquarePulse(channel='trigger',
name='A square pulse on MW pmod')
sq_pulse_ch1 = pulse.SquarePulse(channel='RF1',
name='A square pulse on MW pmod')
sq_pulse_ch2 = pulse.SquarePulse(channel='RF2',
name='A square pulse on MW pmod')
test_element1 = element.Element('blub_element1', pulsar = AWG)#, ignore_offset_correction=True)
test_element2 = element.Element('blub_element2', pulsar = AWG)#, ignore_offset_correction=True)
# we copied the channel definition from out global pulsar
# create a few of those
# create a few of those
test_element1.add(pulse.cp(sq_pulse, amplitude=0., length=10.0e-6), start = 0.2e-6,
name='first pulse', refpoint='start')
test_element1.add(pulse.cp(sq_pulse, amplitude=1., length=0.5e-6), start = 0.2e-6,
name='second pulse', refpulse = 'first pulse', refpoint='start')
test_element1.add(pulse.cp(SSB_pulse, mod_frequency=-50e6, amplitude=0.5, length=5.0e-6), start = 1.0e-6,
name='third pulse', refpulse = 'second pulse', refpoint='start')
test_element2.add(pulse.cp(sq_pulse, amplitude=0., length=10.0e-6), start = 0.2e-6,
name='first pulse', refpoint='start')
test_element2.add(pulse.cp(sq_pulse, amplitude=1., length=0.5e-6), start = 0.2e-6,
name='second pulse', refpulse = 'first pulse', refpoint='start')
test_element2.add(pulse.cp(SSB_pulse, mod_frequency=-50e6, amplitude=0.5, length=5.0e-6), start = 1.0e-6,
name='third pulse', refpulse = 'second pulse', refpoint='start')
print('Channel definitions: ')
test_element1.print_overview()
test_element2.print_overview()
# -------------------------continue-------------------------------
# -------------------------------------------------------
# viewing of the sequence for second check of timing etc
viewer.show_element_stlab(test_element1, delay = False, channels = 'all', ax = None)
viewer.show_element_stlab(test_element2, delay = False, channels = 'all', ax = None)
# --------------------------------------------------------
In [ ]:
devAWG.get_all()
In [ ]:
devAWG.init_dir()
In [ ]:
#-------------------------------------------------------
# now to send everything to the AWG, we have perform the last step by putting everything
# into a sequence
seq = sequence.Sequence('blub')
seq.append(name='first_element', wfname='blub_element1', trigger_wait=True,
goto_target='second element')
seq.append(name='second_element', wfname='blub_element2', trigger_wait=True,
goto_target='first_element')
AWG.program_awg(seq,test_element1, test_element2, verbose = True)#, test_element2)
AWG.AWGrun()
In [ ]:
In [ ]:
seq = sequence.Sequence('phase_sweep')
phases = np.linspace(0, 360, 37)
print(phases)
elements = []
for i, phase in enumerate(phases):
elem = element.Element('phase_%d' %phase, pulsar = AWG)#, ignore_offset_correction=True)
# create a few of those
elem.add(pulse.cp(sq_pulse, amplitude=1., length=0.5e-6), start = 0.2e-6,
name='first pulse', refpoint='start')
elem.add(pulse.cp(SSB_pulse, mod_frequency=-50e6, amplitude=0.5, length=20.0e-6, phase=phase), start = 5.0e-6,
name='second pulse', refpulse = 'first pulse', refpoint='end')
elements.append(elem)
if phase == 360:
seq.append(name='phase_%d' %phase, wfname='phase_%d' %phase, trigger_wait=True,
goto_target='phase_%d' %0.)
else:
seq.append(name='phase_%d' %phase, wfname='phase_%d' %phase, trigger_wait=True,
goto_target='phase_%d' %phases[i+1])
print('Channel definitions: ')
test_element1.print_overview()
test_element2.print_overview()
In [ ]:
viewer.show_element_stlab(elements[20], delay = False, channels = 'all', ax = None)
viewer.show_element_stlab(elements[0], delay = False, channels = 'all', ax = None)
In [ ]:
In [ ]:
devAWG.start()
In [ ]:
RS_FSV.prepare_TD()
In [ ]:
AWG.define_channels(id='ch1', name='RF1', type='analog',
high=0.541, low=-0.541,
offset=0., delay=0, active=True)
AWG.define_channels(id='ch2', name='RF2', type='analog',
high=0.541, low=-0.541,
offset=0., delay=0, active=True)
AWG.define_channels(id='ch1_marker1', name='MW_pulsemod', type='marker',
high=1.0, low=0, offset=0.,
delay=0, active=True)
AWG.define_channels(id='ch2_marker1', name='trigger', type='marker',
high=1, low=0,
offset=0., delay=0, active=True)
SSB_pulse = pulse.MW_IQmod_pulse(I_channel ='RF2', Q_channel='RF1', name='SSB pulse')
sq_pulse = pulse.SquarePulse(channel='trigger',
name='A square pulse on MW pmod')
phases = np.linspace(0, 360, 37)
for i, phase in enumerate(phases):
devAWG.init_dir()
seq = sequence.Sequence('phase_%d' %phase)
phases = np.linspace(0, 360, 37)
print(phases)
elements = []
elem = element.Element('phase_%d' %phase, pulsar = AWG)#, ignore_offset_correction=True)
# create a few of those
elem.add(pulse.cp(sq_pulse, amplitude=1., length=0.5e-6), start = 0.2e-6,
name='first pulse', refpoint='start')
elem.add(pulse.cp(SSB_pulse, mod_frequency=-50e6, amplitude=0.5, length=20.0e-6, phase=phase), start = 5.0e-6,
name='second pulse', refpulse = 'first pulse', refpoint='end')
elements.append(elem)
if phase == 360:
seq.append(name='phase_%d' %phase, wfname='phase_%d' %phase, trigger_wait=True,
goto_target='phase_%d' %0.)
else:
seq.append(name='phase_%d' %phase, wfname='phase_%d' %phase, trigger_wait=True,
goto_target='phase_%d' %phases[i+1])
print('Channel definitions: ')
elem.print_overview()
AWG.program_awg(seq, *elements, verbose = True)#, test_element2)
In [ ]:
"%d" %10
In [ ]:
In [ ]: