### Sc vs. Mag field ###

#Drivers
#from RSZNB20 import instrument as znb20
from keithley2000 import instrument as key2000
from Yoko import instrument as yoko
from dummydriver import instrument as dummy
#Data aquisition instruments
#vna = znb20('TCPIP::169.254.107.192::INSTR')
vm = key2000('GPIB0::29::INSTR')

#Sweep instruments
iBias = yoko('GPIB0::13::INSTR',
           name = 'Yoko V R=14.8KOhm',
           start = 90e-3, 
           stop = -90e-3, 
           pt = 1801 ) #'Yoko V' 
iBias.prepare_v(vrange = 3)  # vrange =2 -- 10mV, 3 -- 100mV, 4 -- 1V, 5 -- 10V, 6 -- 30V

vMag = yoko('GPIB0::10::INSTR',
            name = 'Magnet V R=2.19KOhm',
            start = -0.5, 
            stop = 0.5, 
            pt = 401) #'Yoko M' 
vMag.prepare_v(vrange = 4)

dim_3 = dummy(name = 'Nothing',
                start = 0,
                stop = 0,
                pt = 1)
## TEST IV CURVE AT 8.8mK ! ##

#Drivers
#from RSZNB20 import instrument as znb20
from dummydriver import instrument as dummy
#from AgilentPSG import instrument as APSG
from keithley2000 import instrument as key2000
from Yoko import instrument as yoko

#vna = znb20('TCPIP::169.254.107.192::INSTR')
vm = key2000('GPIB0::29::INSTR')

iBias = yoko('GPIB0::13::INSTR',
           name = 'Yoko V R=14.8KOhm',
           start = -90e-3,
           stop = 90e-3, 
           pt = 181,
           sstep = 5e-3, #def step and step/wait-time in sec for ramping
           stime = 1e-3) 
iBias.prepare_v(vrange = 3)  # vrange =2 -- 10mV, 3 -- 100mV, 4 -- 1V, 5 -- 10V, 6 -- 30V

vMag = yoko('GPIB0::10::INSTR',
            name = 'Magnet V R=2.19KOhm',
            start = -0.5, 
            stop = +0.5, 
            pt = 101,
            sstep = 20e-3,
            stime = 1e-3) #'Yoko M' 
vMag.prepare_v(vrange = 4)

PSG = dummy('GPIB0::18::INSTR',
folder = 'data\\'

# Drivers
# from RSZNB20 import instrument as znb20
from dummydriver import instrument as dummy
# from AgilentPSG import instrument as APSG
from keithley2000 import instrument as key2000
from Yoko import instrument as yoko

# vna = znb20('TCPIP::169.254.107.192::INSTR')
vm = key2000('GPIB0::29::INSTR')

iBias = yoko('GPIB0::13::INSTR',
           name = 'Yoko V R=(998.83+14.24)KOhm',
           start = -4,
           stop = 4,
           pt = 201,
           sstep = 0.2, #def max voltage steps it can take
           stime = 0)
iBias.prepare_v(vrange = 6)  # vrange =2 -- 10mV, 3 -- 100mV, 4 -- 1V, 5 -- 10V, 6 -- 30V

vMag = yoko('GPIB0::10::INSTR',
            name = 'Magnet V R=2.19KOhm',
            start = -280e-3,
            stop = -190e-3,
            pt = 20,
            sstep = 5e-3,
            stime = 1e-6) #'Yoko M'
vMag.prepare_v(vrange = 4)

# PSG = APSG('GPIB0::11::INSTR',
Noticed that this changed my LP filtering
'''

# Driver
from dummydriver import instrument as dummy
from keithley2000 import instrument as key2000
from Yoko import instrument as yoko
from DataStorer import DataStoreSP


vm = key2000('GPIB0::29::INSTR')

iBias = yoko('GPIB0::1::INSTR',
           name = 'Yoko V R=(998.83+14.24)KOhm',
           start = -8e-6,
           stop = 8e-6,
           pt = 3201,
           sstep = 0.1e-6, # def max step it can take
           stime = 1e-6)
#iBias.prepare_v(vrange = 5)  # vrange =2 -- 10mV, 3 -- 100mV, 4 -- 1V, 5 -- 10V, 6 -- 30V
iBias.prepare_i(vrange = 4)  #  vrange =4 -- 1mA, 5 -- 10mA, 6 -- 100mA
iBias.UD = True

vMag = yoko('GPIB0::10::INSTR',
            name = 'Magnet V R=2.19KOhm',
            start = -600e-3,
            stop = 600e-3,
            pt = 401,
            sstep = 10e-3,
            stime = 1e-6)
vMag.prepare_v(vrange = 4)
folder = 'data\\'

#Drivers
#from RSZNB20 import instrument as znb20
#from dummydriver import instrument as dummy
from AgilentPSG import instrument as APSG
from keithley2000 import instrument as key2000
from Yoko import instrument as yoko

#vna = znb20('TCPIP::169.254.107.192::INSTR')
vm = key2000('GPIB0::29::INSTR')

iBias = yoko('GPIB0::13::INSTR',
           name = 'Yoko V R=14.24KOhm',
           start = 65e-6,
           stop = 65e-6, 
           pt = 1,
           sstep = 5e-3, #def max voltage steps it can take
           stime = 1e-3) 
iBias.prepare_v(vrange = 2)  # vrange =2 -- 10mV, 3 -- 100mV, 4 -- 1V, 5 -- 10V, 6 -- 30V

vMag = yoko('GPIB0::10::INSTR',
            name = 'Magnet V R=2.19KOhm',
            start = -280e-3,
            stop = 360e-3, 
            pt = 321,
            sstep = 50e-3,
            stime = 1e-6) #'Yoko M' 
vMag.prepare_v(vrange = 4)

PSG = APSG('GPIB0::11::INSTR',
## GROUND LOOP TESTS inc VNA and Hempt ##

#Drivers
#from RSZNB20 import instrument as znb20
#from dummydriver import instrument as dummy
from AgilentPSG import instrument as APSG
from keithley2000 import instrument as key2000
from Yoko import instrument as yoko

#vna = znb20('TCPIP::169.254.107.192::INSTR')
vm = key2000('GPIB0::29::INSTR')

iBias = yoko('GPIB0::13::INSTR',
           name = 'Yoko V R=14.24KOhm',
           start = -30e-3,
           stop = 30e-3, 
           pt = 1201,
           sstep = 5e-3, #def step and step/wait-time in sec for ramping
           stime = 1e-3) 
iBias.prepare_v(vrange = 4)  # vrange =2 -- 10mV, 3 -- 100mV, 4 -- 1V, 5 -- 10V, 6 -- 30V

vMag = yoko('GPIB0::10::INSTR',
            name = 'Magnet V R=2.19KOhm',
            start = 31e-3,
            stop = 31e-3, 
            pt = 1,
            sstep = 20e-3,
            stime = 1e-3) #'Yoko M' 
vMag.prepare_v(vrange = 4)

PSG = APSG('GPIB0::11::INSTR',
           adressLo='3010D2',
           LoPosAB=1,
           LoRef=2,
           name='D2 Lags (sec)',
           cfreq = 4.8e9,
           inputlvl = -15,
           start=(-lags/BW),
           stop=(lags/BW),
           pt=(lags*2-1),
           nSample=lsamples,
           sampFreq=BW)

iBias = yoko('GPIB0::13::INSTR',
           name = 'Yoko V R=(998.83+14.24)KOhm',
           start = -1-2e-3,
           stop = 1-2e-3,
           pt = 5,
           sstep = 0.1, # def max voltage steps it can take
           stime = 0.05)
iBias.prepare_v(vrange = 6)  # vrange =2 -- 10mV, 3 -- 100mV, 4 -- 1V, 5 -- 10V, 6 -- 30V
iBias.UD = False
#iBias.sweep_v(-6, 6)
iBias.sweep_v(iBias.start, 10)  # sweep Ibias to its position

vMag = yoko('GPIB0::10::INSTR',
            name = 'Magnet V R=2.19KOhm',
            start = 27e-3,  # -300e-3,
            stop = 27e-3,  # 300e-3,
            pt = 1,
            sstep = 10e-3,
            stime = 1e-6)