1 # Copyright (C) 2011-2012 W. Trevor King <wking@tremily.us>
3 # This file is part of pypiezo.
5 # pypiezo is free software: you can redistribute it and/or modify it under the
6 # terms of the GNU General Public License as published by the Free Software
7 # Foundation, either version 3 of the License, or (at your option) any later
10 # pypiezo is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License along with
15 # pypiezo. If not, see <http://www.gnu.org/licenses/>.
19 import h5config.config as _config
20 import h5config.tools as _h5config_tools
22 import pycomedi.constant as _constant
25 class PackageConfig (_h5config_tools.PackageConfig):
26 "Configure `pypiezo` module operation"
27 settings = _h5config_tools.PackageConfig.settings + [
28 _config.BooleanSetting(
30 help='Plot piezo motion using `matplotlib`.',
32 _config.BooleanSetting(
33 name='surface-matplotlib',
34 help='Plot surface positiong fit using `matplotlib`.',
39 class ChannelConfig (_config.Config):
40 "Configure a single DAC/ADC channel"
44 help="Channel name (so the user will know what it's used for).",
48 help='Comedi device.',
49 default='/dev/comedi0'),
50 _config.IntegerSetting(
52 help='Comedi subdevice index. -1 for automatic detection.',
54 _config.IntegerSetting(
56 help='Subdevice channel index.',
58 _config.IntegerSetting(
60 help="Channel's maximum bit value."),
61 _config.IntegerSetting(
63 help="Channel's selected range index.",
65 _config.ChoiceSetting(
66 name='analog-reference',
67 help="Channel's selected analog reference index.",
68 choices=[(x.name, x) for x in _constant.AREF]),
69 _config.FloatListSetting(
70 name='conversion-coefficients',
71 help=('Bit to physical unit conversion coefficients starting with '
72 'the constant coefficient.')),
74 name='conversion-origin',
75 help=('Origin (bit offset) of bit to physical polynomial '
77 _config.FloatListSetting(
78 name='inverse-conversion-coefficients',
79 help=('Physical unit to bit conversion coefficients starting with '
80 'the constant coefficient.')),
82 name='inverse-conversion-origin',
83 help=('Origin (physical unit offset) of physical to bit '
84 'polynomial expansion.')),
88 class OutputChannelConfig (ChannelConfig):
92 class InputChannelConfig (ChannelConfig):
96 class AxisConfig (_config.Config):
97 "Configure a single piezo axis"
102 'Volts applied at piezo per volt output from the DAQ card '
103 '(e.g. if your DAQ output is amplified before driving the '
105 _config.FloatSetting(
107 help='Meters of piezo deflection per volt applied to the piezo.'),
108 _config.FloatSetting(
110 help='Set a lower limit on allowed output voltage',
112 _config.FloatSetting(
114 help='Set an upper limit on allowed output voltage',
116 _config.ConfigSetting(
118 help='Configure the underlying DAC channel.',
119 config_class=OutputChannelConfig,
121 _config.ConfigSetting(
123 help='Configure the underlying (optional) ADC monitoring channel.',
124 config_class=InputChannelConfig,
129 class PiezoConfig (_config.Config):
130 "Configure a piezo experiment"
134 help="Piezo name (so the user will know what it's used for).",
136 _config.ConfigListSetting(
138 help='Configure the underlying axes.',
139 config_class=AxisConfig,
141 _config.ConfigListSetting(
143 help='Configure the underlying (optional) ADC monitoring channels.',
144 config_class=InputChannelConfig,
149 class WiggleConfig (_config.Config):
150 "Configure an interference wiggle"
154 help="Name of the axis to wiggle.",
158 help="Name of the channel to watch.",
159 default='deflection'),
160 _config.FloatSetting(
162 help="Frequency for a full wiggle cycle (hertz).",
164 _config.IntegerSetting(
166 help='Number of samples in a full wiggle cycle.',
168 _config.IntegerSetting(
170 help='Center of the wiggle position (bits)',
172 _config.IntegerSetting(
174 help='Amplitude of the wiggle sinusoid (bits)',
176 _config.IntegerSetting(
178 help=('Instead of giving an explicit amplitude, you can specify '
179 'the laser wavelength in meters. The amplitude will then '
180 'be set to contain about two interference cycles.'),