If neither the wavelength or amplitude are given for wiggling, use half the max.
authorW. Trevor King <wking@drexel.edu>
Wed, 14 Mar 2012 19:16:00 +0000 (15:16 -0400)
committerW. Trevor King <wking@drexel.edu>
Wed, 14 Mar 2012 19:16:00 +0000 (15:16 -0400)
pypiezo/afm.py

index f19ee390e8a7842ccc556041687e7a0bc47dc8ef..21d0186ea4cb4a4ede78c1dce7eed8b9d72812ca 100644 (file)
@@ -321,10 +321,13 @@ class AFMPiezo (_base.Piezo):
                     max_amplitude = int(maxdata-offset)
                 offset_meters = _base.convert_bits_to_meters(
                     output_axis.config, offset)
-                bit_wavelength = _base.convert_meters_to_bits(
-                    output_axis.config, offset_meters + laser_wavelength
-                    ) - offset
-                amplitude = 2*bit_wavelength
+                if laser_wavelength is None:
+                    amplitude = 0.5*max_amplitude
+                else:
+                    bit_wavelength = _base.convert_meters_to_bits(
+                        output_axis.config, offset_meters + laser_wavelength
+                        ) - offset
+                    amplitude = 2*bit_wavelength
                 log_string = (
                     'generated amplitude for interference wiggle: %g'
                     % amplitude)