Skip to content

Commit

Permalink
Merge pull request #68 from Galvant/lint_lakeshore
Browse files Browse the repository at this point in the history
lint lakeshore files
  • Loading branch information
scasagrande committed Jan 29, 2016
2 parents e55619e + e8122ad commit 857f034
Show file tree
Hide file tree
Showing 5 changed files with 173 additions and 197 deletions.
2 changes: 1 addition & 1 deletion instruments/.pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ ignore-comments=yes
ignore-docstrings=yes

# Ignore imports when computing similarities.
ignore-imports=no
ignore-imports=yes


[VARIABLES]
Expand Down
3 changes: 3 additions & 0 deletions instruments/instruments/lakeshore/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Module containing Lakeshore instruments
"""

from __future__ import absolute_import

Expand Down
84 changes: 34 additions & 50 deletions instruments/instruments/lakeshore/lakeshore340.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,10 @@
#!/usr/bin/python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
##
# lakeshore340.py: Driver for the Lakeshore 340 cryogenic temp controller.
##
# © 2013-2014 Steven Casagrande (scasagrande@galvant.ca).
#
# This file is a part of the InstrumentKit project.
# Licensed under the AGPL version 3.
##
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
##

## IMPORTS #####################################################################
"""
Provides the support for the Lakeshore 340 cryogenic temperature controller.
"""

# IMPORTS #####################################################################

from __future__ import absolute_import
from __future__ import division
Expand All @@ -33,64 +15,66 @@
from instruments.generic_scpi import SCPIInstrument
from instruments.util_fns import ProxyList

## CLASSES #####################################################################
# CLASSES #####################################################################


class Lakeshore340(SCPIInstrument):

"""
The Lakeshore340 is a multi-sensor cryogenic temperature controller.
Example usage:
>>> import instruments as ik
>>> import quantities as pq
>>> inst = ik.lakeshore.Lakeshore340.open_gpibusb('/dev/ttyUSB0', 1)
>>> print inst.sensor[0].temperature
>>> print inst.sensor[1].temperature
>>> print(inst.sensor[0].temperature)
>>> print(inst.sensor[1].temperature)
"""
## INNER CLASSES ##

# INNER CLASSES ##

class Sensor(object):

"""
Class representing a sensor attached to the Lakeshore 340.
.. warning:: This class should NOT be manually created by the user. It is
.. warning:: This class should NOT be manually created by the user. It is
designed to be initialized by the `Lakeshore340` class.
"""

def __init__(self, parent, idx):
self._parent = parent
self._idx = idx + 1
## PROPERTIES ##

# PROPERTIES ##

@property
def temperature(self):
"""
Gets the temperature of the specified sensor.
:units: Kelvin
:type: `~quantities.quantity.Quantity`
"""
value = self._parent.query('KRDG?{}'.format(self._idx))
return pq.Quantity(float(value), pq.Kelvin)
## PROPERTIES ##

# PROPERTIES ##

@property
def sensor(self):
"""
Gets a specific sensor object. The desired sensor is specified like
one would access a list.
Gets a specific sensor object. The desired sensor is specified like
one would access a list.
For instance, this would query the temperature of the first sensor::
>>> bridge = Lakeshore340.open_serial("COM5")
>>> print bridge.sensor[0].temperature
>>> print(bridge.sensor[0].temperature)
The Lakeshore 340 supports up to 2 sensors (index 0-1).
:rtype: `~Lakeshore340.Sensor`
"""
return ProxyList(self, Lakeshore340.Sensor, range(2))

87 changes: 36 additions & 51 deletions instruments/instruments/lakeshore/lakeshore370.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,10 @@
#!/usr/bin/python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
##
# lakeshore370.py: Driver for the Lakeshore 370 AC resistance bridge.
##
# © 2013-2014 Steven Casagrande (scasagrande@galvant.ca).
#
# This file is a part of the InstrumentKit project.
# Licensed under the AGPL version 3.
##
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
##

## IMPORTS #####################################################################
"""
Provides the support for the Lakeshore 370 AC resistance bridge.
"""

# IMPORTS #####################################################################

from __future__ import absolute_import
from __future__ import division
Expand All @@ -33,68 +15,71 @@
from instruments.generic_scpi import SCPIInstrument
from instruments.util_fns import ProxyList

## CLASSES #####################################################################
# CLASSES #####################################################################


class Lakeshore370(SCPIInstrument):

"""
The Lakeshore 370 is a multichannel AC resistance bridge for use in low
The Lakeshore 370 is a multichannel AC resistance bridge for use in low
temperature dilution refridgerator setups.
Example usage:
>>> import instruments as ik
>>> bridge = ik.lakeshore.Lakeshore370.open_gpibusb('/dev/ttyUSB0', 1)
>>> print inst.channel[0].resistance
>>> print(bridge.channel[0].resistance)
"""

def __init__(self, filelike):
super(Lakeshore370, self).__init__(filelike)
self.sendcmd('IEEE 3,0') # Disable termination characters and enable EOI

## INNER CLASSES ##

# Disable termination characters and enable EOI
self.sendcmd('IEEE 3,0')

# INNER CLASSES ##

class Channel(object):

"""
Class representing a sensor attached to the Lakeshore 370.
.. warning:: This class should NOT be manually created by the user. It is
.. warning:: This class should NOT be manually created by the user. It is
designed to be initialized by the `Lakeshore370` class.
"""

def __init__(self, parent, idx):
self._parent = parent
self._idx = idx + 1
## PROPERTIES ##

# PROPERTIES ##

@property
def resistance(self):
"""
Gets the resistance of the specified sensor.
:units: Ohm
:rtype: `~quantities.quantity.Quantity`
"""
value = self._parent.query('RDGR? {}'.format(self._idx))
return pq.Quantity(float(value), pq.ohm)
## PROPERTIES ##

# PROPERTIES ##

@property
def channel(self):
"""
Gets a specific channel object. The desired channel is specified like
one would access a list.
Gets a specific channel object. The desired channel is specified like
one would access a list.
For instance, this would query the resistance of the first channel::
>>> import instruments as ik
>>> bridge = ik.lakeshore.Lakeshore370.open_serial("COM5")
>>> print bridge.channel[0].resistance
>>> print(bridge.channel[0].resistance)
The Lakeshore 370 supports up to 16 channels (index 0-15).
:rtype: `~Lakeshore370.Channel`
"""
return ProxyList(self, Lakeshore370.Channel, range(16))

0 comments on commit 857f034

Please sign in to comment.