Read channels from an acclaim file.
174397
def read_channels(self, fid):
        """"""
        bones = [[] for i in self.vertices]
        num_channels = 0
        for vertex in self.vertices:
            num_channels = num_channels + len(vertex.meta['channels'])

        lin = self.read_line(fid)
        while lin != ':DEGREES':
            lin = self.read_line(fid)
            if lin == '':
                raise ValueError('Could not find :DEGREES in ' + fid.name)

        counter = 0
        lin = self.read_line(fid)
        while lin:
            parts = lin.split()
            if len(parts)==1:
                frame_no = int(parts[0])
                if frame_no:
                    counter += 1
                    if counter != frame_no:
                        raise ValueError('Unexpected frame number.')
                else:
                    raise ValueError('Single bone name  ...')
            else:
                ind = self.get_index_by_name(parts[0])
                bones[ind].append(np.array([float(channel) for channel in parts[1:]]))
            lin = self.read_line(fid)

        num_frames = counter

        channels = np.zeros((num_frames, num_channels))

        end_val = 0
        for i in range(len(self.vertices)):
            vertex = self.vertices[i]
            if len(vertex.meta['channels'])>0:                
                start_val = end_val
                end_val = end_val + len(vertex.meta['channels'])
                for j in range(num_frames):
                    channels[j, start_val:end_val] = bones[i][j]
            self.resolve_indices(i, start_val)

        self.smooth_angle_channels(channels)
        return channels
194406
def channel_names(fn, usecols=None):
    """"""

    with open(fn, 'rb') as fo:
        names = dbfreader(fo).next()

    return usecols and [names[i] for i in usecols] or names
976823
def get(self, channel):
        """"""
        checked_channel = self._check_channel_no(channel)
        self.i2c.write_raw8(checked_channel  | self._dac_enabled)
        reading = self.i2c.read_raw8() 
        reading = self.i2c.read_raw8() 
        return reading / 255.0
165386
def fetch_entries(self):
        """"""
        data = []
        for row in self.get_rows():
            # Stop fetching data if limit has been met
            if exceeded_limit(self.limit, len(data)):
                break

            entry = row.find_all('td')
            entry_dict = {}

            show = entry[0].string
            net = entry[1].string
            if not self._match_query(show, net):
                continue

            entry_dict['show'] = show
            entry_dict['net'] = net
            entry_dict['time'] = entry[2].string

            if ',' in entry[3].string:
                entry_dict['viewers'] = entry[3].string.replace(',', '.')
            else:
                entry_dict['viewers'] = '0.' + entry[3].string
            entry_dict['rating'] = entry[4].string

            # Add data to create cable entry
            data.append(Entry(**entry_dict))

        return data
684546
def to_array(self, channels=2):
        """"""
        return np.linspace(self.volume, self.volume,
            self.duration * channels).reshape(self.duration, channels)
933879
def add_channel_cb(self, viewer, channel):
        """"""
        chname = channel.name

        # add old highlight set to channel external data
        channel.extdata.setdefault('contents_old_highlight', set([]))

        # Add the channel to the treeview
        file_dict = {}
        self.name_dict.setdefault(chname, file_dict)

        if not self.gui_up:
            return False

        tree_dict = {chname: {}}
        if self.gui_up:
            self.treeview.add_tree(tree_dict)

        self._rebuild_channels()
1048161
def get_channel_names(self):
        """"""
        names_s, names_n = self.channel_names_s, self.channel_names_n

        # Figure out which channel names to use
        if self._channel_naming == '$PnS':
            channel_names, channel_names_alternate = names_s, names_n
        else:
            channel_names, channel_names_alternate = names_n, names_s

        if len(channel_names) == 0:
            channel_names = channel_names_alternate

        if len(set(channel_names)) != len(channel_names):
            msg = (u'The default channel names (defined by the {} '
                   u'parameter in the FCS file) were not unique. To avoid '
                   u'problems in downstream analysis, the channel names '
                   u'have been switched to the alternate channel names '
                   u'defined in the FCS file. To avoid '
                   u'seeing this warning message, explicitly instruct '
                   u'the FCS parser to use the alternate channel names by '
                   u'specifying the channel_naming parameter.')
            msg = msg.format(self._channel_naming)
            warnings.warn(msg)
            channel_names = channel_names_alternate

        return channel_names
1298707
async def get_reader(self, source=FFMPEG_STDOUT) -> asyncio.StreamReader:
        """"""
        reader = asyncio.StreamReader(loop=self._loop)
        reader_protocol = asyncio.StreamReaderProtocol(reader)

        # Attach stream
        if source == FFMPEG_STDOUT:
            await self._loop.connect_read_pipe(
                lambda: reader_protocol, self._proc.stdout
            )
        else:
            await self._loop.connect_read_pipe(
                lambda: reader_protocol, self._proc.stderr
            )

        # Start reader
        return reader
690758
def data_from_file(file):
    """"""
    fp = wave.open(file, 'r')
    data = fp.readframes(fp.getnframes())
    channels = fp.getnchannels()
    freq = fp.getframerate()
    bits = fp.getsampwidth()

    # Unpack bytes -- warning currently only tested with 16 bit wavefiles. 32
    # bit not supported.
    data = struct.unpack(('%sh' % fp.getnframes()) * channels, data)

    # Only use first channel
    channel1 = []
    n = 0
    for d in data:
        if n % channels == 0:
            channel1.append(d)
        n += 1
    fp.close()
    return (channel1, freq, bits)
472712
def channels(self, topic):
        """"""
        nsq.assert_valid_topic_name(topic)
        return self._request('GET', '/channels', fields={'topic': topic})
276544
def get_channels(self):
        
        selectedItems = self.idx_chan.selectedItems()
        selected_chan = [x.text().split('—')[0] for x in selectedItems]
        chan_in_order = []
        for chan in self.one_grp['chan_to_plot']:
            if chan in selected_chan:
                chan_in_order.append(chan)

        return chan_in_order
379289
def channel(self):
        """"""
        if not self._channel:
            self._channel_ref = weakref.ref(self.connection.get_channel())
        return self._channel
1325910
def clip(self, channels=True):
        """"""
        if not isinstance(channels, (tuple, list)):
            channels = [channels] * len(self.channels)

        for i in range(len(self.channels)):
            if channels[i]:
                self.channels[i] = np.ma.clip(self.channels[i], 0.0, 1.0)
1298596
def to_array(self, channels=2):
        """"""
        if self.fade_type == "linear":
            return np.linspace(self.in_volume, self.out_volume,
                self.duration * channels)\
                .reshape(self.duration, channels)
        elif self.fade_type == "exponential":
            if self.in_volume < self.out_volume:
                return (np.logspace(8, 1, self.duration * channels,
                    base=.5) * (
                        self.out_volume - self.in_volume) / 0.5 + 
                        self.in_volume).reshape(self.duration, channels)
            else:
                return (np.logspace(1, 8, self.duration * channels, base=.5
                    ) * (self.in_volume - self.out_volume) / 0.5 + 
                    self.out_volume).reshape(self.duration, channels)
        elif self.fade_type == "cosine":
            return
1307321
def channel_view(x:Tensor)->Tensor:
    ""
    return x.transpose(0,1).contiguous().view(x.shape[1],-1)
774144
def read_meta(self, **kwargs):
        '''
        
        '''
        # TODO Try to rewrite the code to be more logical
        # The reason the equivalent statement is not in the read_data method
        # above is because self.readdata_kwargs are passed
        # as **kwargs to the read_data function.
        if 'channel_naming' in self.readdata_kwargs:
            kwargs['channel_naming'] = self.readdata_kwargs['channel_naming']
        meta = parse_fcs(self.datafile,
                         reformat_meta=True,
                         meta_data_only=True, **kwargs)
        return meta
700698
def load_channels(self, checked=False, test_name=None):
        
        chan_name = self.parent.labels.chan_name

        if self.filename is not None:
            filename = self.filename
        elif self.parent.info.filename is not None:
            filename = (splitext(self.parent.info.filename)[0] +
                        '_channels.json')
        else:
            filename = None

        if test_name is None:
            filename, _ = QFileDialog.getOpenFileName(self,
                                                      'Open Channels Montage',
                                                      filename,
                                                      'Channels File (*.json)')
        else:
            filename = test_name

        if filename == '':
            return

        self.filename = filename
        with open(filename, 'r') as outfile:
            groups = load(outfile)

        s_freq = self.parent.info.dataset.header['s_freq']
        no_in_dataset = []
        for one_grp in groups:
            no_in_dataset.extend(set(one_grp['chan_to_plot']) -
                                 set(chan_name))
            chan_to_plot = set(chan_name) & set(one_grp['chan_to_plot'])
            ref_chan = set(chan_name) & set(one_grp['ref_chan'])

            group = ChannelsGroup(chan_name, one_grp['name'], one_grp, s_freq)
            group.highlight_channels(group.idx_l0, chan_to_plot)
            group.highlight_channels(group.idx_l1, ref_chan)
            self.tabs.addTab(group, one_grp['name'])

        if no_in_dataset:
            msg = 'Channels not present in the dataset: ' + ', '.join(no_in_dataset)
            self.parent.statusBar().showMessage(msg)
            lg.debug(msg)

        self.apply()