From: W. Trevor King Date: Wed, 14 Mar 2012 19:16:00 +0000 (-0400) Subject: If neither the wavelength or amplitude are given for wiggling, use half the max. X-Git-Tag: 0.6~22 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=57eb7bcba750ed011d21e757b3851793a886bfec;p=pypiezo.git If neither the wavelength or amplitude are given for wiggling, use half the max. --- diff --git a/pypiezo/afm.py b/pypiezo/afm.py index f19ee39..21d0186 100644 --- a/pypiezo/afm.py +++ b/pypiezo/afm.py @@ -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)