From: W. Trevor King Date: Tue, 19 Apr 2011 17:11:31 +0000 (-0400) Subject: Add a method for extracting input channels by name. X-Git-Tag: 0.5~13 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d9e10235030370ec57db961c28d7d7191d534711;p=pypiezo.git Add a method for extracting input channels by name. --- diff --git a/pypiezo/base.py b/pypiezo/base.py index 4cffdba..b80d727 100644 --- a/pypiezo/base.py +++ b/pypiezo/base.py @@ -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.