Skip to content

Commit

Permalink
Put connection in the constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
ALiOz committed May 8, 2014
1 parent bc5db6d commit 6a8c818
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions concert/devices/monochromators/newport.py
Expand Up @@ -14,30 +14,26 @@ class NewPort74000(base.Monochromator):

def __init__(self, host, port):

self._host = host
self._port = port
self._connection = SocketConnection(host, port)
super(NewPort74000, self).__init__()
self._wavelength = 0 * q.nm

def shutter_open(self):
"""
Open the shutter
"""
self._connection = SocketConnection(self._host, self._port)
self._connection.send('SHUTTER O\r\n')

def shutter_close(self):
"""
Close the shutter
"""
self._connection = SocketConnection(self._host, self._port)
self._connection.send('SHUTTER C\r\n')

def shutter_status(self):
"""
Get the shutter status
"""
self._connection = SocketConnection(self._host, self._port)
self._connection.send('SHUTTER?\r\n')
time.sleep(0.1)
status = self._connection.recv()[11]
Expand All @@ -47,15 +43,15 @@ def _set_wavelength(self, wave):
"""
Set the wavelength
"""
self._connection = SocketConnection(self._host, self._port)
self._connection.send('GOWAVE ' + wave + '\r\n')

def _get_wavelength(self):
"""
Get the current wavelength
"""
self._connection = SocketConnection(self._host, self._port)
self._connection.send('WAVE?\r\n')
time.sleep(0.1)
self._wavelength = self._connection.recv()[8:]
return self._wavelength


0 comments on commit 6a8c818

Please sign in to comment.