Skip to content

Commit

Permalink
External control of piezo sweep
Browse files Browse the repository at this point in the history
Added control parameters for letting the scan output be directed to an
external port and the piezo sweep be controlled from an internal port;
the purpose is to tee off the scan signal for triggering.
  • Loading branch information
dchristle committed May 20, 2016
1 parent fccad0a commit 1cad3cf
Showing 1 changed file with 91 additions and 11 deletions.
102 changes: 91 additions & 11 deletions instrument_plugins/TOPTICA_DLPro.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ def __init__(self, name, address, reset = False):
units = 's',
minval = 0 )


self.add_parameter('tc_current',
flags = Instrument.FLAG_GETSET,
type = types.FloatType,
Expand Down Expand Up @@ -123,6 +122,28 @@ def __init__(self, name, address, reset = False):
flags = Instrument.FLAG_GET,
type = types.StringType)

# enables external input as the control voltage for the piezo
self.add_parameter('external_input',
flags = Instrument.FLAG_GETSET,
type = types.BooleanType)

# output channel for the scan voltage
self.add_parameter('external_input_signal',
flags = Instrument.FLAG_GETSET,
type = types.IntType)

# analog multiplier for external control
self.add_parameter('external_input_factor',
flags = Instrument.FLAG_GETSET,
type = types.FloatType,
minval = 0.0, maxval = 17.5)

# output channel for the scan voltage
self.add_parameter('scan_output',
flags = Instrument.FLAG_GETSET,
type = types.IntType)


self.add_function('on')
self.add_function('off')
self.add_function('test_buzzer')
Expand Down Expand Up @@ -260,12 +281,11 @@ def do_set_idle_timeout(self, setting):
logging.error(__name__ + ': set idle timeout returned string:%r' % ret)
return False
def do_get_idle_timeout(self):

ret = self.query(('(param-ref \'display:idle-timeout)'))
return int(ret)

def do_set_feedforward(self, setting):

def do_set_feedforward(self, setting):
if setting == True:
set_string = '#t'
elif setting == False:
Expand All @@ -279,10 +299,10 @@ def do_set_feedforward(self, setting):
else:
logging.error(__name__ + ': set feedforward returned string:%r' % ret)
return False
def do_get_feedforward(self):

ret = self.query(('(param-ref \'laser1:dl:cc:feedforward-enabled)'))

def do_get_feedforward(self):
ret = self.query(('(param-ref \'laser1:dl:cc:feedforward-enabled)'))
if ret == '\n#t\r':
return True
elif ret == '\n#f\r':
Expand All @@ -291,6 +311,7 @@ def do_get_feedforward(self):
logging.error(__name__ + (': received unknown reply %s from get_feedforward' % ret))
return


def do_set_feedforward_factor(self, ff):
ret = self.query(('(param-set! \'laser1:dl:cc:feedforward-factor %.3f)' % ff))
if ret == '\n0\r':
Expand All @@ -302,6 +323,7 @@ def do_get_feedforward_factor(self):
ret = self.query('(param-ref \'laser1:dl:cc:feedforward-factor)')
return float(ret)


def do_set_t_loop(self, setting):

if setting == True:
Expand All @@ -318,9 +340,7 @@ def do_set_t_loop(self, setting):
logging.error(__name__ + ': set temperature PID loop returned string:%r' % ret)
return False
def do_get_t_loop(self):

ret = self.query(('(param-ref \'laser1:dl:tc:enabled)'))

if ret == '\n#t\r':
return True
elif ret == '\n#f\r':
Expand Down Expand Up @@ -348,6 +368,7 @@ def do_set_igain(self, current):
else:
logging.error(__name__ + ': set i gain returned string:%r' % ret)
return False

def do_get_igain(self):
ret = self.query('(param-ref \'laser1:dl:tc:t-loop:i-gain)')
return float(ret)
Expand All @@ -359,6 +380,7 @@ def do_set_dgain(self, current):
else:
logging.error(__name__ + ': set d gain returned string:%r' % ret)
return False

def do_get_dgain(self):
ret = self.query('(param-ref \'laser1:dl:tc:t-loop:d-gain)')
return float(ret)
Expand All @@ -370,12 +392,12 @@ def do_set_tec_current(self, current):
else:
logging.error(__name__ + ': set TEC current returned string:%r' % ret)
return False

def do_get_tec_current(self):
ret = self.query('(param-ref \'laser1:dl:tc:current-act)')
return float(ret)

def do_set_piezo(self, setting):

if setting == True:
set_string = '#t'
elif setting == False:
Expand All @@ -389,10 +411,9 @@ def do_set_piezo(self, setting):
else:
logging.error(__name__ + ': set feedforward returned string:%r' % ret)
return False
def do_get_piezo(self):

def do_get_piezo(self):
ret = self.query(('(param-ref \'laser1:dl:pc:enabled)'))

if ret == '\n#t\r':
return True
elif ret == '\n#f\r':
Expand Down Expand Up @@ -420,7 +441,6 @@ def do_set_tc_current(self, current):
else:
logging.error(__name__ + ': set tc current returned string:%r' % ret)
return False
return

def do_get_tc_current(self):
ret = self.query(('(param-ref \'laser1:dl:tc:current-set)'))
Expand All @@ -430,6 +450,66 @@ def do_get_tc_current_actual(self):
ret = self.query(('(param-ref \'laser1:dl:tc:current-act)'))
return float(ret)

def do_set_external_input_factor(self, ff):
ret = self.query(('(param-set! \'laser1:dl:cc:external-input:factor %.3f)' % ff))
if ret == '\n0\r':
return True
else:
logging.error(__name__ + ': set feedforward factor string:%r' % ret)
return False

def do_get_external_input_factor(self):
ret = self.query('(param-ref \'laser1:dl:cc:external-input:factor)')
return float(ret)

def do_set_external_input(self, setting):
if setting == True:
set_string = '#t'
elif setting == False:
set_string = '#f'
else:
logging.error(__name__ + ': received improper set string when trying to set external input enabled/disabled.')
set_string = '#f'
ret = self.query(('(param-set! \'laser1:dl:cc:external-input:enabled %s)' % set_string))
if ret == '\n0\r':
return True
else:
logging.error(__name__ + ': set external input returned string:%r' % ret)
return False

def do_get_external_input(self):
ret = self.query(('(param-ref \'laser1:dl:cc:external-input:enabled)'))
if ret == '\n#t\r':
return True
elif ret == '\n#f\r':
return False
else:
logging.error(__name__ + (': received unknown reply %s from get_external_input' % ret))
return

def do_set_external_input_signal(self, ff):
ret = self.query(('(param-set! \'laser1:dl:cc:external-input:signal %d)' % int(ff)))
if ret == '\n0\r':
return True
else:
logging.error(__name__ + ': set scan output channel string: %r' % ret)
return False

def do_get_external_input_signal(self):
ret = self.query('(param-ref \'laser1:dl:cc:external-input:signal)')
return int(ret)

def do_set_scan_output(self, ff):
ret = self.query(('(param-set! \'laser1:scan:output-channel %d)' % int(ff)))
if ret == '\n0\r':
return True
else:
logging.error(__name__ + ': set scan output channel string: %r' % ret)
return False

def do_get_scan_output(self):
ret = self.query('(param-ref \'laser1:scan:output-channel)')
return int(ret)



Expand Down

0 comments on commit 1cad3cf

Please sign in to comment.