From: W. Trevor King Date: Tue, 19 Apr 2011 23:42:17 +0000 (-0400) Subject: Add optional temperature controller attribute. X-Git-Tag: v0.3~5 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a7291e0a38b3470eae93ccbd385c33e79d5b3b23;p=pyafm.git Add optional temperature controller attribute. --- diff --git a/pyafm.py b/pyafm.py index 6248c56..c46e47b 100644 --- a/pyafm.py +++ b/pyafm.py @@ -42,12 +42,24 @@ class AFM (object): Fine positioning and deflection measurements. stepper | stepper.Stepper instance Coarse positioning. + temperature | temperature.Controller instance or None + Optional temperature monitoring and control. """ - def __init__(self, piezo, stepper, axis_name='z'): + def __init__(self, piezo, stepper, temperature=None, axis_name='z'): self.piezo = piezo self.stepper = stepper + self.temperature = temperature self.axis_name = axis_name + def get_temperature(self): + """Measure the sample temperature. + + Return the sample temperature in Kelvin or `None` if such a + measurement is not possible. + """ + if hasattr(self.temperature, 'get'): + return self.temperature.get_temperature() + def move_just_onto_surface(self, depth=-50e-9, setpoint=2, far=200): """Position the AFM tip close to the surface.