Skip to content

Pmtunes driver dev #63

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 64 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
0c6af7c
Lantz Setup guide
PeterMintun Nov 18, 2015
563726c
Added Lakeshore 332 and Signal Recovery 7265
PeterMintun Nov 18, 2015
4c03731
Progress on Lakeshore 332 driver based on QTLab original
PeterMintun Nov 18, 2015
0bfd464
Explicit instructions on installing lantz using miniconda3
PeterMintun Nov 18, 2015
c3752f8
added testing section
PeterMintun Nov 18, 2015
0d6a05d
added fix for qt installation failure
PeterMintun Nov 20, 2015
22bdd43
not sure
PeterMintun Nov 21, 2015
6974522
added info for installing National Instruments drivers
PeterMintun Dec 3, 2015
5700a80
add info on DAQ startup
PeterMintun Dec 3, 2015
19b348c
finally getting comm fixed
PeterMintun Dec 6, 2015
2137263
adding commands
PeterMintun Dec 7, 2015
2c6ba68
cleaned up comments
PeterMintun Dec 7, 2015
c68b41c
finished implementing all functionality
PeterMintun Dec 7, 2015
0dc4de5
fixed issue w/ CMODE
PeterMintun Dec 7, 2015
dc391fe
working on lockin and monochromater
PeterMintun Dec 8, 2015
5d3cb5e
adding more functionality to LIA
PeterMintun Dec 8, 2015
36a8d91
testing slack
PeterMintun Dec 8, 2015
58c4740
added sensitivities to SR7265, SP2150 is still derp
PeterMintun Dec 9, 2015
b80c117
adding DAQ_test code
PeterMintun Dec 9, 2015
b52f907
rename DAQ_test to DAQ_info
PeterMintun Dec 9, 2015
8e071e0
added autophase
PeterMintun Dec 11, 2015
abc55c5
adding document describing lantz bug fixes
PeterMintun Dec 11, 2015
4662448
updating on progress re:DAQ
PeterMintun Dec 13, 2015
5a27af2
Acton install guide
PeterMintun Dec 14, 2015
318fd30
DAQ demo code working!
PeterMintun Dec 14, 2015
9a2e971
pushing DAQ changes
PeterMintun Dec 14, 2015
90dff26
Update log.py
PeterMintun Dec 14, 2015
6fbff4d
Merge pull request #1 from PeterMintun/patch-1
kcmiao Dec 14, 2015
a86768c
more fun with the DAQ
PeterMintun Dec 14, 2015
e6d0cac
adding changes to NI Driver
PeterMintun Dec 15, 2015
c3ce9b7
fixing DAQ write/read methods
PeterMintun Dec 15, 2015
614fd4d
Revert "fixing DAQ write/read methods"
PeterMintun Dec 15, 2015
adcabd5
Revert "adding changes to NI Driver"
PeterMintun Dec 15, 2015
a5883e1
finally fixing chaos
PeterMintun Dec 15, 2015
0241628
more DAQ demo codes
PeterMintun Dec 15, 2015
df51ddd
more work on DAQ
PeterMintun Dec 16, 2015
c0ef5e3
Added installation instructions for awsch/lantz
kcmiao Dec 16, 2015
b903dd7
updating on progress for DAQ programming
PeterMintun Jan 4, 2016
9bdc2c7
added slack integration
PeterMintun Jan 8, 2016
d7ba8b9
added image file upload and example python bot
PeterMintun Jan 10, 2016
4cee165
adding updates to mono w/ working communication, added laser and arc …
PeterMintun Jan 15, 2016
7229f10
added more commands to arc lamp control
PeterMintun Jan 18, 2016
2984b59
tested driver commands
PeterMintun Jan 18, 2016
b43139c
initial commit, implements basic functionality
kcmiao Jan 19, 2016
6256e44
Merge pull request #2 from awsch/kepco-bop
kcmiao Jan 19, 2016
271cf13
got communication working nice w/ SP2150
PeterMintun Jan 22, 2016
0eae3e1
added more doc
PeterMintun Jan 22, 2016
f4a7f33
now handles laser parameter setting correctly
PeterMintun Jan 22, 2016
52b0502
Update LantzSetup.md
kcmiao Jan 26, 2016
cc060c6
ITC4020 drivers main functionalities completed
AlexBourassa Feb 3, 2016
6b0a507
testing the removal of one line
AlexBourassa Feb 5, 2016
168f668
original PEM90 commit, adding DAQ code here for posterity
PeterMintun Feb 10, 2016
0551704
added all pmtunes development drivers into a branch? fingers crossed
PeterMintun Feb 10, 2016
ee985b9
changed filenames to be consistent with other drivers
PeterMintun Feb 11, 2016
f2fd706
adding Hinds PEM-90 driver
PeterMintun Feb 22, 2016
d2be56f
added commands to interface with socket communication protocol hosted…
PeterMintun Aug 3, 2016
aeb3e3b
added units and warnings to Montana cryostation driver as per @kmiao'…
PeterMintun Aug 3, 2016
da62bc7
added driver for agilent n51xx vector signal generator series
PeterMintun Sep 1, 2016
d184942
added Newport FSM driver with some hacky DAQ code
PeterMintun Sep 9, 2016
66442f8
added driver for Agilent 33220A function generator
PeterMintun Oct 24, 2016
1ba517a
added code to read counters from daq (daqs vs. counts --JHeremans)
PeterMintun Oct 24, 2016
946c2ea
fixed setuptools and __init__.py to install daqmx files
PeterMintun Oct 25, 2016
1d8d7b5
changed IO_TYPE for counter input task to standardize
PeterMintun Oct 27, 2016
bbe083a
some changes for interfacing with counter input + FSM scan, interface…
PeterMintun Oct 27, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
185 changes: 185 additions & 0 deletions lantz/drivers/acton/sp2150i.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
from lantz import Feat, DictFeat, Action
from lantz.messagebased import MessageBasedDriver

from pyvisa import constants

from numpy import abs, ceil

from time import sleep


class SP2150i(MessageBasedDriver):
"""
Implements controls for the Princeton Instruments Acton Series SP2150i
Monochromater over the internal USB virtual serial port.

Communication with the device is a little finnicky, so if you run into
problems, I would suggest adding more buffer clears to avoid garbage
accumulating in the buffer and messing up your commands.

Author: Peter Mintun ([email protected])
Date: 1/21/2016
"""
DEFAULTS = {'ASRL': {'write_termination': '\r',
'read_termination': 'ok\r\n',
'baud_rate': 9600,
'data_bits': 8,
'parity': constants.Parity.none,
'stop_bits': constants.StopBits.one,
'encoding': 'latin-1',
'timeout': 2000}}

max_speed = 100
wavelength_min = 380
wavelength_max = 520

num_gratings = 8

def initialize(self):
"""
"""
super().initialize()
self.clear_buffer()

def clear_buffer(self):
"""
This function sends an empty query just to clear any junk from the read
buffer...This could probably be done more elegantly...but it works, for
now at least.
"""
return self.query('')

@Feat(limits=(wavelength_min, wavelength_max))
def nm(self):
"""
Returns current wavelength of monochromater.
"""
self.clear_buffer()
read = self.query('?NM')
wavelength = read.replace('nm', '')
return float(wavelength)

@nm.setter
def nm(self, wavelength):
"""
Sets output to specified wavelength, traveling at the current scan
rate.
"""
curr_wavelength = self.nm
scan_rate = self.scan_speed
delta_lambda = abs(curr_wavelength - wavelength)
if delta_lambda > 0.1:
scan_time = ceil(delta_lambda / scan_rate * 60) + 2 # need seconds
self.clear_buffer()
print('Scanning from {}nm to {}nm, will take {}sec'.format(
curr_wavelength, wavelength, scan_time))
return self.write_message_wait('{0:.1f} NM'.format(wavelength),
scan_time)
else:
return


@Feat(limits=(0, max_speed))
def scan_speed(self):
"""
Get scan rate in nm/min.
"""
self.clear_buffer()
read = self.query('?NM/MIN')
speed = read.replace('nm/min', '')
return float(speed)

@scan_speed.setter
def scan_speed(self, speed):
"""
Sets current scan speed in nm/min.
"""
return self.write_message_wait('{0:.1f} NM/MIN'.format(speed), 0.1)

@Feat(limits=(1, 2, 1))
def grating(self):
"""
Returns the current grating position
"""
response = self.query('?GRATING')
return int(response)

@grating.setter
def grating(self, grating_num):
"""
Changes the current grating to be the one in slot grating_num.
"""
print('Warning: Untested code! No other gratings were installed.')
print('Changing grating, please wait 20 seconds...')
return self.write_message_wait('{} GRATING'.format(grating_num), 20)

@Feat(limits=(1, 3, 1))
def turret(self):
"""
Returns the selected turret number.
"""
response = self.query('?TURRET')
return int(response.replace(' ok', ''))

@turret.setter
def turret(self, turr_set):
"""
Selects the parameters for the grating on turret turr_set
"""
print('Warning: untested. No other turrets were installed.')
return self.write_message_wait('{} TURRET'.format(turr_set), 1)

@Feat()
def turret_spacing(self):
"""
Returns the groove spacing of the grating for each turret.
"""
print('Warning: This command does\'t do anything?')
return self.write_message_wait('?TURRETS', 0.5)

@Feat()
def grating_settings(self):
"""
Returns the groove spacing and blaze wavelength of grating positions
for all possible gratings.
"""
gratings = []
self.write('?GRATINGS')
self.read()
for i in range(0, self.num_gratings):
gratings.append(self.read())
self.read()
return gratings

def write_message_wait(self, message, wait_time):
self.write(message)
sleep(wait_time)
return self.read()

if __name__ == '__main__':
with SP2150i('ASRL4::INSTR') as inst:
print('== Monochromater Wavelength ==')
print('Wavelength:{}nm'.format(inst.nm))
print('Scan rate:{}nm/min'.format(inst.scan_speed))

print('== Monochromater Information ==')
print('Selected turret:{}'.format(inst.turret))
print('Selected grating:{}'.format(inst.grating))
# inst.turret = 3
# inst.grating = 2
print('Selected turret:{}'.format(inst.turret))
print('Selected grating:{}'.format(inst.grating))
print('Turret Spacing:{}'.format(inst.turret_spacing))
print('Gratings:{}'.format(inst.grating_settings))

for i in range(1, 20):
inst.scan_speed = 100.0
print('Scan rate:{}nm/min'.format(inst.scan_speed))
print('Wavelength:{}nm'.format(inst.nm))
inst.nm = 400.0
print('Wavelength:{}nm'.format(inst.nm))
inst.scan_speed = 50.0
print('Scan rate:{}nm/min'.format(inst.scan_speed))
inst.nm = 500.0
print('Wavelength:{}nm'.format(inst.nm))
print('Cycle {} complete.'.format(i))
19 changes: 19 additions & 0 deletions lantz/drivers/agilent/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
"""
lantz.drivers.aeroflex
~~~~~~~~~~~~~~~~~~~~~~

:company: Aeroflex
:description: Test and measurement equipment and microelectronic solutions.
:website: http://www.aeroflex.com/

----

:copyright: 2015 by Lantz Authors, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""

from .n51xx import N51xx
from .ag33220A import Ag33220A

__all__ = ['N51xx', 'Ag33220A']
Loading