From a7291e0a38b3470eae93ccbd385c33e79d5b3b23 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 19 Apr 2011 19:42:17 -0400 Subject: [PATCH] Add optional temperature controller attribute. --- pyafm.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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. -- 2.26.2