LOG_RAMPS = False
LOG_DIR = '/home/wking/rsrch/data/z_piezo'
+# Hackish defaults for the calibcant.config module
+DEFAULT_GAIN = 20 # Vpiezo / Voutput
+DEFAULT_SENSITIVITY = 7.41 # nm_surface/Volt_piezo
+DEFAULT_ZERO_PHOTODIODE_BITS = 2**15
+DEFAULT_VPHOTO_IN_2_VOLTS = lambda vbits : (vbits-DEFAULT_ZERO_PHOTODIODE_BITS)/3276.8
+DEFAULT_VZP_OUT_2_VOLTS = lambda vbits : (vbits-DEFAULT_ZERO_PHOTODIODE_BITS)/3276.8
+
DEFAULT_ZP_CHAN = 0
DEFAULT_ZP_MON_CHAN = 1
DEFAULT_DEF_CHAN = 0
# C D
# looking in along the laser
-import pycomedi.single_aio as single_aio
-import pycomedi.simult_aio as simult_aio
+class NoComedi (ImportError):
+ "Missing comedi. Don't initialize a z_piezo instance."
+ pass
+
+try:
+ import pycomedi.single_aio as single_aio
+ import pycomedi.simult_aio as simult_aio
+ HAS_COMEDI = True
+except ImportError, e:
+ HAS_COMEDI = False
from numpy import array, arange, ones, zeros, linspace, uint16, float, sin, pi
from scipy.stats import linregress
def __init__(self, zp_chan=DEFAULT_ZP_CHAN,
zp_mon_chan=DEFAULT_ZP_MON_CHAN,
def_chan=DEFAULT_DEF_CHAN) :
- self.sensitivity = 7.41 # nm_surface/Volt_piezo
- self.gain = 20 # Vpiezo / Voutput
+ if HAS_COMEDI is not True:
+ raise NoComedi
+ self.sensitivity = DEFAULT_SENSITIVITY
+ self.gain = DEFAULT_GAIN
self.nm2Vout = self.sensitivity * self.gain # nm_surface / V_output
self.chan_info = _chan_info(zp_chan, zp_mon_chan, def_chan)