def all(self): """ :class:`nidaqmx._task_modules.channels.channel.Channel`: Specifies a channel object that represents the entire list of virtual channels on this channel collection. """ # Passing a blank string means all channels. return Channel._factory(self._handle, '')
def channels(self): """ :class:`nidaqmx._task_modules.channels.channel.Channel`: Specifies a channel object that represents the entire list of virtual channels in this task. """ return Channel._factory( self._handle, flatten_channel_string(self.channel_names))
def __getitem__(self, index): """ Indexes a subset of virtual channels on this channel collection. Args: index: The value of the index. The following index types are supported: - str: Name of the virtual channel. You also can specify a string that contains a list or range of names to this input. If you have a list of names, use the DAQmx Flatten Channel String function to convert the list to a string. - int: Index/position of the virtual channel in the collection. - slice: Range of the indexes/positions of virtual channels in the collection. Returns: nidaqmx._task_modules.channels.channel.Channel: Indicates a channel object representing the subset of virtual channels indexed. """ if isinstance(index, six.integer_types): channel_names = self.channel_names[index] elif isinstance(index, slice): channel_names = flatten_channel_string(self.channel_names[index]) elif isinstance(index, six.string_types): channel_names = index else: raise DaqError( 'Invalid index type "{0}" used to access channels.'.format( type(index)), DAQmxErrors.UNKNOWN) if channel_names: return Channel._factory(self._handle, channel_names) else: raise DaqError( 'You cannot specify an empty index when indexing channels.\n' 'Index used: {0}'.format(index), DAQmxErrors.UNKNOWN)
def __reversed__(self): channel_names = self.channel_names channel_names.reverse() for channel_name in channel_names: yield Channel._factory(self._handle, channel_name)
def __iter__(self): for channel_name in self.channel_names: yield Channel._factory(self._handle, channel_name)