Esempio n. 1
0
# Lucas J. Koerner
# 10/2021
# [email protected]
# University of St. Thomas

from instrbuilder.instrument_opening import open_by_name
print('Warning ... The address to the serial adapter \n (E.g. /dev/tty.USA19H141113P1.1) can change ')

# GW instek 6300 LCR meter
# need to pass in baudrate, reading eol, and writing terminator
# using a TrippLite USB to RS-232

lcr = open_by_name(name='gw_lcr', baudrate=115200, eol=b'\n', 
					terminator='')   # name within the configuration file (config.yaml)
lcr.get('freq')
lcr.set('freq', 100e3)
from instrbuilder.instrument_opening import open_by_name

RE = RunEngine({})
db = Broker.named('local_file')  # a broker poses queries for saved data sets

# Insert all metadata/data captured into db.
RE.subscribe(db.insert)

# ------------------------------------------------
#           Lock-In Amplifier
# ------------------------------------------------
print(
    'Warning ... The address to the serial adapter \n (E.g. /dev/tty.USA19H141113P1.1) can change '
)
scpi_lia = open_by_name(
    name='srs_lockin')  # name within the configuration file (config.yaml)
LIA, component_dict = generate_ophyd_obj(name='LockIn', scpi_obj=scpi_lia)
lia = LIA(name='lockin')
lia.reset.set(0)
RE.md['lock_in'] = lia.id.get()

# setup lock-in
# similar to a stage, but specific to this experiment
test_frequency = 5e6 / 512 / 8
lia.reset.set(None)
lia.fmode.set('Ext')
lia.in_gnd.set('float')
lia.in_config.set('A')
lia.in_couple.set('DC')
lia.freq.set(test_frequency)
lia.sensitivity.set(20e-6)  # 20 uV RMS full-scale
    print(
        '  $ python -m pip install git+https://github.com/lucask07/ophyd@master#egg=ophyd'
    )

from instrbuilder.instrument_opening import open_by_name
from instrbuilder.instruments import create_ada2200

RE = RunEngine({})
db = Broker.named('local_file')  # a broker poses queries for saved data sets
# Insert all metadata/data captured into db.
RE.subscribe(db.insert)

# ------------------------------------------------
#           Multimeter
# ------------------------------------------------
scpi_dmm = open_by_name(name='my_multi')
scpi_dmm.name = 'dmm'
DMM, component_dict = generate_ophyd_obj(name='Multimeter', scpi_obj=scpi_dmm)
dmm = DMM(name='multimeter')

# configure for fast burst reads
dmm.volt_autozero_dc.set(0)
dmm.volt_aperture.set(20e-6)
dmm.volt_range_auto_dc.set(0)  # turn off auto-range
dmm.volt_range_dc.set(10)  # set range

# create an object that returns statistics calculated on the arrays returned by read_buffer
# the name is derived from the parent
# (e.g. lockin and from the signal that returns an array e.g. read_buffer)
dmm_burst_stats = BasicStatistics(name='', array_source=dmm.burst_volt_timer)
dmm_filter_stats = FilterStatistics(name='', array_source=dmm.burst_volt_timer)
Esempio n. 4
0
# Lucas J. Koerner
# 05/2018
# [email protected]
# University of St. Thomas
'''
Demonstrate the function generator within instrbuilder
As an example of the automated testing of the command lists run 'test_all'
'''
from instrbuilder.instrument_opening import open_by_name

# fg = open_by_name(name='new_function_gen')   # name within the configuration file (config.yaml)
fg = open_by_name(
    name='old_fg')  # name within the configuration file (config.yaml)

fg.set('offset', 0.5)
fg.set('load', 'INF')

test_results = fg.test_all(skip_commands=[])
fg.set('reset')
fg.set('clear_status')
Esempio n. 5
0

RE = RunEngine({})
bec = BestEffortCallback()
# Send all metadata/data captured to the BestEffortCallback.
# RE.subscribe(bec) # in this demo we will explicitly define LiveTables and Plots

db = Broker.named('local_file')  # a broker poses queries for saved data sets

# Insert all metadata/data captured into db.
RE.subscribe(db.insert)

# ------------------------------------------------
#           Multimeter
# ------------------------------------------------
scpi_dmm = open_by_name(name='my_multi')
DMM, component_dict = generate_ophyd_obj(name='Multimeter', scpi_obj=scpi_dmm)
dmm = DMM(name='multimeter')

# configure for fast burst reads
dmm.volt_autozero_dc.set(0)
dmm.volt_aperture.set(20e-6)
dmm.volt_range_auto_dc.set(0)  # turn off auto-range
dmm.volt_range_dc.set(10)      # set range

# create an object that returns statistics calculated on the arrays returned by read_buffer
# the name is derived from the parent
# (e.g. lockin and from the signal that returns an array e.g. read_buffer)
dmm_burst_stats = BasicStatistics(name='', array_source=dmm.burst_volt_timer)
dmm_filter_stats = FilterStatistics(name='', array_source=dmm.burst_volt_timer)
Esempio n. 6
0
# Lucas J. Koerner
# 05/2018
# [email protected]
# University of St. Thomas
from instrbuilder.instrument_opening import open_by_name

dmm = open_by_name(
    name='my_multi')  # name within the configuration file (config.yaml)

v = dmm.get('meas_volt', configs={'ac_dc': 'DC'})
print('Measured voltage of {} [V]'.format(v))
dmm.save_hardcopy(filename='test55', filetype='png')

# certain commands fail during test_all, not due to communication errors but due to
# incompatible configurations
"""
test_results = dmm.test_all(
    skip_commands=['fetch', 'reset', 'initialize', 'hardcopy'])
"""

# Check the trigger source command 'trig_source'
print('Test trigger source:')
dmm.test_command('trig_source')
print('Communication register status: {}'.format(
    dmm.get('comm_error_details')))

# samples at 1 kHz with the 34465A
num_reads = 100
voltage_burst = dmm.burst_volt(reads_per_trigger=num_reads,
                               aperture=200e-6)  # trigger count default is 1
Esempio n. 7
0
# Lucas J. Koerner
# 05/2018
# [email protected]
# University of St. Thomas

from instrbuilder.instrument_opening import open_by_name
import time

KEYSIGHT = False
RIGOL = True

if KEYSIGHT:
    osc = open_by_name(
        name='msox_scope')  # name within the configuration file (config.yaml)

    osc.set('time_range', 1e-3)
    osc.set('chan_scale', 0.8, configs={'chan': 1})
    osc.set('chan_offset', -0.2, configs={'chan': 1})

    osc.set('single_acq')
    time.sleep(0.1)

    # save a PNG screen-shot to host computer
    t = osc.save_display_data('test')

if RIGOL:
    # rigol_ds is the name in my YAML file
    osc = open_by_name(name='rigol_ds')

    osc.set('time_range', 1e-3)
    osc.set('chan_scale', 0.8, configs={'chan': 1})
Esempio n. 8
0
    print(
        '  $ python -m pip install git+https://github.com/lucask07/ophyd@master#egg=ophyd'
    )

from instrbuilder.instrument_opening import open_by_name

RE = RunEngine({})
db = Broker.named('temp')  # a broker poses queries for saved data sets

# Insert all metadata/data captured into db.
RE.subscribe(db.insert)

# ------------------------------------------------
#           Function Generator
# ------------------------------------------------
fg_scpi = open_by_name(
    name='old_fg')  # name within the configuration file (config.yaml)
fg_scpi.name = 'fg'
FG, component_dict = generate_ophyd_obj(name='fg', scpi_obj=fg_scpi)
fg = FG(name='fg')
RE.md['fg'] = fg.id.get()

# setup control of the amplitude sweep
fg.v.delay = 0.05

# configure the function generator
fg.reset.set(None)  # start fresh
fg.function.set('SIN')
fg.load.set('INF')
fg.freq.set(1000)
fg.v.set(1.6)
fg.offset.set(0)
Esempio n. 9
0
except ModuleNotFoundError:
    print('Ophyd fork is not installed')
    print('First, (if needed) uninstall base ophyd:')
    print('  $ python -m pip uninstall ophyd')
    print('Next, install the fork:')
    print(
        '  $ python -m pip install git+https://github.com/lucask07/ophyd@master#egg=ophyd'
    )

from instrbuilder.instrument_opening import open_by_name
from instrbuilder.instruments import create_ada2200

# ------------------------------------------------
#           Multimeter
# ------------------------------------------------
scpi_dmm = open_by_name(name='my_multi')
DMM, component_dict = generate_ophyd_obj(name='Multimeter', scpi_obj=scpi_dmm)
dmm = DMM(name='multimeter')

# ------------------------------------------------
#           ADA2200 SPI Control with Aardvark
# ------------------------------------------------
ada2200_scpi = create_ada2200()
SPI, component_dict = generate_ophyd_obj(name='ada2200_spi',
                                         scpi_obj=ada2200_scpi)
ada2200 = SPI(name='ada2200')

ada2200.serial_interface.set(0x18)  # enables SDO (bit 4,3 = 1)
ada2200.demod_control.set(0x10)  # bit 3: 0 = SDO to RCLK

time.sleep(0.1)
Esempio n. 10
0
# Lucas J. Koerner
# 05/2018
# [email protected]
# University of St. Thomas

from instrbuilder.instrument_opening import open_by_name
import time

pwr = open_by_name(
    name='rigol_pwr1')  # name within the configuration file (config.yaml)

pwr.get('v', configs={'chan': 1})
pwr.get('i', configs={'chan': 1})

pwr.get('v', configs={'chan': 2})
pwr.get('i', configs={'chan': 2})

pwr.set('v', 0.1, configs={'chan': 2})
pwr.set('ovp', 1.5, configs={'chan': 2})

pwr.set('ocp', 0.07, configs={'chan': 2})

pwr.set('out_state', 'ON', configs={'chan': 1})
time.sleep(2)
pwr.set('out_state', 'OFF', configs={'chan': 1})

pwr.get('meas_i', configs={'chan': 1})

pwr.get('meas_v', configs={'chan': 1})
Esempio n. 11
0
# Lucas J. Koerner
# 05/2018
# [email protected]
# University of St. Thomas

from instrbuilder.instrument_opening import open_by_name

print(
    'Warning ... The address to the serial adapter \n (E.g. /dev/tty.USA19H141113P1.1) can change '
)
lia = open_by_name(
    name='srs_lockin')  # name within the configuration file (config.yaml)

print()
lia.get('phase')
lia.set('phase', 0.1)

print()
lia.help('phase')
print()

# A more complex Lock-in Amplifier set; requires input dictionary configs
# Set the display to show "R" -- magnitude
lia.set(name='ch1_disp', value=1, configs={'ratio': 0})

# Read the value of the display
disp_val = lia.get('disp_val')
print('Value of the display = {}'.format(disp_val))