From: W. Trevor King Date: Thu, 15 Mar 2012 21:21:01 +0000 (-0400) Subject: Add `default-temperature` option to AFMConfig. X-Git-Tag: v0.4~26 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d87be975a582f003b268629f014a4d6fdd47ecf2;p=pyafm.git Add `default-temperature` option to AFMConfig. --- diff --git a/pyafm/afm.py b/pyafm/afm.py index a68b772..cac6269 100644 --- a/pyafm/afm.py +++ b/pyafm/afm.py @@ -147,11 +147,14 @@ class AFM (object): device: /dev/ttyS0 baudrate: 9600 max-current: 0.0 + fallback-temperature: 295.15 far: 3e-05 >>> pyafm.storage.save_afm(afm=afm, filename=filename) >>> pprint_HDF5(filename=filename) # doctest: +REPORT_UDIFF / + + 295.15 3e-05 @@ -314,6 +317,7 @@ class AFM (object): """ if hasattr(self.temperature, 'get_temperature'): return self.temperature.get_temperature() + return self.config['default-temperature'] def move_just_onto_surface(self, depth=-50e-9, setpoint=2, min_slope_ratio=10, far=200, steps=20, diff --git a/pyafm/config.py b/pyafm/config.py index c3af39a..dca08a0 100644 --- a/pyafm/config.py +++ b/pyafm/config.py @@ -169,6 +169,11 @@ class AFMConfig (_config.Config): help='Configure the underlying temperature sensor.', config_class=TemperatureConfig, default=None), + _config.FloatSetting( + name='fallback-temperature', + help=('Temperature in Kelvin to use if no temperature sensor is ' + 'configured.'), + default=295.15), _config.FloatSetting( name='far', help=('Approximate distance in meters to move away to get "far" '