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`.',
35 class ChannelConfig (_config.Config):
36 "Configure a single DAC/ADC channel"
40 help="Channel name (so the user will know what it's used for).",
44 help='Comedi device.',
45 default='/dev/comedi0'),
46 _config.IntegerSetting(
48 help='Comedi subdevice index. -1 for automatic detection.',
50 _config.IntegerSetting(
52 help='Subdevice channel index.',
54 _config.IntegerSetting(
56 help="Channel's maximum bit value."),
57 _config.IntegerSetting(
59 help="Channel's selected range index.",
61 _config.ChoiceSetting(
62 name='analog-reference',
63 help="Channel's selected analog reference index.",
64 choices=[(x.name, x) for x in _constant.AREF]),
65 _config.FloatListSetting(
66 name='conversion-coefficients',
67 help=('Bit to physical unit conversion coefficients starting with '
68 'the constant coefficient.')),
70 name='conversion-origin',
71 help=('Origin (bit offset) of bit to physical polynomial '
73 _config.FloatListSetting(
74 name='inverse-conversion-coefficients',
75 help=('Physical unit to bit conversion coefficients starting with '
76 'the constant coefficient.')),
78 name='inverse-conversion-origin',
79 help=('Origin (physical unit offset) of physical to bit '
80 'polynomial expansion.')),
84 class OutputChannelConfig (ChannelConfig):
88 class InputChannelConfig (ChannelConfig):
92 class AxisConfig (_config.Config):
93 "Configure a single piezo axis"
98 'Volts applied at piezo per volt output from the DAQ card '
99 '(e.g. if your DAQ output is amplified before driving the '
101 _config.FloatSetting(
103 help='Meters of piezo deflection per volt applied to the piezo.'),
104 _config.FloatSetting(
106 help='Set a lower limit on allowed output voltage',
108 _config.FloatSetting(
110 help='Set an upper limit on allowed output voltage',
112 _config.ConfigSetting(
114 help='Configure the underlying DAC channel.',
115 config_class=OutputChannelConfig,
117 _config.ConfigSetting(
119 help='Configure the underlying (optional) ADC monitoring channel.',
120 config_class=InputChannelConfig,
125 class PiezoConfig (_config.Config):
126 "Configure a piezo experiment"
130 help="Piezo name (so the user will know what it's used for).",
132 _config.ConfigListSetting(
134 help='Configure the underlying axes.',
135 config_class=AxisConfig,
137 _config.ConfigListSetting(
139 help='Configure the underlying (optional) ADC monitoring channels.',
140 config_class=InputChannelConfig,
145 class WiggleConfig (_config.Config):
146 "Configure an interference wiggle"
150 help="Name of the axis to wiggle.",
154 help="Name of the channel to watch.",
155 default='deflection'),
156 _config.FloatSetting(
158 help="Frequency for a full wiggle cycle (hertz).",
160 _config.IntegerSetting(
162 help='Number of samples in a full wiggle cycle.',
164 _config.IntegerSetting(
166 help='Center of the wiggle position (bits)',
168 _config.IntegerSetting(
170 help='Amplitude of the wiggle sinusoid (bits)',
172 _config.IntegerSetting(
174 help=('Instead of giving an explicit amplitude, you can specify '
175 'the laser wavelength in meters. The amplitude will then '
176 'be set to contain about two interference cycles.'),