Add a method for extracting input channels by name.
authorW. Trevor King <wking@drexel.edu>
Tue, 19 Apr 2011 17:11:31 +0000 (13:11 -0400)
committerW. Trevor King <wking@drexel.edu>
Tue, 19 Apr 2011 17:14:41 +0000 (13:14 -0400)
pypiezo/base.py

index 4cffdba51412d2b94abac9b1626a9b1a8bc1d4c5..b80d727704e73cfc5e0df3f4ec788a21c69b89e8 100644 (file)
@@ -455,6 +455,13 @@ class Piezo (object):
                 return axis
         raise ValueError(name)
 
+    def input_channel_by_name(self, name):
+        "Get an input channel by its name."
+        for input_channel in self.input_channels:
+            if input_channel.name == name:
+                return input_channel
+        raise ValueError(name)
+
     def channels(self, direction=None):
         """Iterate through all `(name, channel)` tuples.