Form a chunk frequency dictionary from a SAX representation.
        :param str sax: a SAX representation.
        :return dict: frequency dictionary for chunks in the SAX representation.
190453
def _construct_SAX_chunk_dict(self, sax):
        
        frequency = defaultdict(int)
        chunk_size = self.chunk_size
        length = len(sax)
        for i in range(length):
            if i + chunk_size <= length:
                chunk = sax[i: i + chunk_size]
                frequency[chunk] += 1
        return frequency
1311142
def pick_frequency_line(self, filename, frequency, cumulativefield='cumulative_frequency'):
        ''''''
        if resource_exists('censusname', filename):
            with closing(resource_stream('censusname', filename)) as b:
                g = codecs.iterdecode(b, 'ascii')
                return self._pick_frequency_line(g, frequency, cumulativefield)
        else:
            with open(filename, encoding='ascii') as g:
                return self._pick_frequency_line(g, frequency, cumulativefield)
285093
def from_frequency(cls, freq):
        
        if 0 < freq <= 20000:
            return super(Tone, cls).__new__(cls, freq)
        raise ValueError('invalid frequency: %.2f' % freq)
1320628
def frequency_model( self ):
        
        # use a generator in corpus
        for next_letter in self.corpus.next_tamil_letter():
            # update frequency from corpus
            self.letter[next_letter] = self.letter[next_letter] + 1
421144
def from_data(cls, data):
        
        frequencies = collections.Counter(data)
        return cls.from_frequencies(frequencies, concat=_guess_concat(data))
672897
def _freq_parser(self, freq):
        
        freq = freq.lower().strip()
        try:
            if "day" in freq:
                freq = freq.replace("day", "")
                return timedelta(days=int(freq))
            elif "hour" in freq:
                freq = freq.replace("hour", "")
                return timedelta(hours=int(freq))
            elif "min" in freq:
                freq = freq.replace("min", "")
                return timedelta(minutes=int(freq))
            elif "sec" in freq:
                freq = freq.replace("sec", "")
                return timedelta(seconds=int(freq))
            else:
                raise Exception("%s is invalid format. use day, hour, min, sec." % freq)
        except:
            raise Exception("%s is invalid format. use day, hour, min, sec." % freq)
557490
def export_to_crtomo_seit_manager(self, grid):
        
        import crtomo
        g = self.data.groupby('frequency')
        seit_data = {}
        for name, item in g:
            print(name, item.shape, item.size)
            if item.shape[0] > 0:
                seit_data[name] = item[
                    ['a', 'b', 'm', 'n', 'r', 'rpha']
                ].values
        seit = crtomo.eitMan(grid=grid, seit_data=seit_data)
        return seit
303138
def get_chunk_coords(self):
        
        chunks = []
        for x in range(32):
            for z in range(32):
                m = self.metadata[x,z]
                if m.is_created():
                    chunks.append({'x': x, 'z': z, 'length': m.blocklength})
        return chunks
1074641
def word_freqs() -> List[Tuple[str, int]]:
    
    lines = list(get_corpus(_FILENAME))
    listword = []
    for line in lines:
        listindata = line.split("\t")
        listword.append((listindata[0], int(listindata[1])))

    return listword
1016009
def _convert_to_df(in_file, freq, raw_file):
    
    dat = defaultdict(Counter)
    if isinstance(in_file, (str, unicode)):
        with open(in_file) as in_handle:
            for line in in_handle:
                cols = line.strip().split("\t")
                counts = freq[cols[3]]
                dat = _expand(dat, counts, int(cols[1]), int(cols[2]))
    else:
        if raw_file:
            out_handle = open(raw_file, "w")
        for name in in_file:
            counts = freq[name]
            if raw_file:
                print("%s\t%s\t%s\t%s\t%s\t%s" % ("chr", in_file[name][0], in_file[name][1], name, sum(counts.values()), "+"), file=out_handle, end="")
            dat = _expand(dat, counts, in_file[name][0], in_file[name][1])

    for s in dat:
        for p in dat[s]:
            dat[s][p] = mlog2(dat[s][p] + 1)
    return dat
227789
def _create_blocks(self):
        

        obj, index = self._convert_freq()
        if index is not None:
            index = self._on

        # filter out the on from the object
        if self.on is not None:
            if obj.ndim == 2:
                obj = obj.reindex(columns=obj.columns.difference([self.on]),
                                  copy=False)
        blocks = obj._to_dict_of_blocks(copy=False).values()

        return blocks, obj, index
1138010
def welch(timeseries, segmentlength, noverlap=None, **kwargs):
    
    # calculate PSD
    freqs, psd_ = scipy.signal.welch(
        timeseries.value,
        noverlap=noverlap,
        fs=timeseries.sample_rate.decompose().value,
        nperseg=segmentlength,
        **kwargs
    )
    # generate FrequencySeries and return
    unit = scale_timeseries_unit(
        timeseries.unit,
        kwargs.get('scaling', 'density'),
    )
    return FrequencySeries(
        psd_,
        unit=unit,
        frequencies=freqs,
        name=timeseries.name,
        epoch=timeseries.epoch,
        channel=timeseries.channel,
    )
533091
def as_dict(self):
        
        d = {"@module": self.__class__.__module__,
             "@class": self.__class__.__name__,
             "structure": self.structure.as_dict(),
             "frequencies": list(self.frequencies),
             "densities": list(self.densities),
             "pdos": []}
        if len(self.pdos) > 0:
            for at in self.structure:
                d["pdos"].append(list(self.pdos[at]))
        return d
207528
def generate_corpus(n_issuers,
                    n_tracks_per_issuer,
                    n_utts_per_track,
                    n_ll_per_utt,
                    n_label_per_ll,
                    rand=None):
    
    corpus = audiomate.Corpus()

    for issuer in generate_issuers(n_issuers, rand):
        corpus.import_issuers(issuer)

        n_tracks = rand.randint(*n_tracks_per_issuer)
        tracks = generate_tracks(n_tracks, rand)
        corpus.import_tracks(tracks)

        n_utts = rand.randint(*n_utts_per_track)
        for track in tracks:
            utts = generate_utterances(
                track,
                issuer,
                n_utts,
                n_ll_per_utt,
                n_label_per_ll,
                rand
            )

            corpus.import_utterances(utts)

    return corpus
1311423
def get_term_category_frequencies(self, scatterchartdata):
		'''
		
		'''

		df = self.term_category_freq_df.rename(
			columns={c: c + ' freq' for c in self.term_category_freq_df}
		)
		df.index.name = 'term'
		return df
360483
def frequency_app(parser, cmd, args):  # pragma: no cover
    

    parser.add_argument('value', help='the value to analyse, read from stdin if omitted', nargs='?')
    args = parser.parse_args(args)
    data = frequency(six.iterbytes(pwnypack.main.binary_value_or_stdin(args.value)))
    return '\n'.join(
        '0x%02x (%c): %d' % (key, chr(key), value)
        if key >= 32 and chr(key) in string.printable else
        '0x%02x ---: %d' % (key, value)
        for key, value in data.items()
    )
577868
def export_freq_band(xfreq, bands, filename):
    """"""
    heading_row_1 = ['Segment index',
                   'Start time',
                   'End time',
                   'Duration',
                   'Stitches',
                   'Stage',
                   'Cycle',
                   'Event type',
                   'Channel',
                   ]
    spacer = [''] * (len(heading_row_1) - 1)
    band_hdr = [str(b1) + '-' + str(b2) for b1, b2 in bands]
    xband = xfreq.copy()

    for seg in xband:
        bandlist = []

        for i, b in enumerate(bands):
            pwr, _ = band_power(seg['data'], b)
            bandlist.append(pwr)

        seg['band'] = bandlist

    as_matrix = asarray([
            [x['band'][y][chan] for y in range(len(x['band']))] \
            for x in xband for chan in x['band'][0].keys()])
    desc = get_descriptives(as_matrix)

    with open(filename, 'w', newline='') as f:
        lg.info('Writing to ' + str(filename))
        csv_file = writer(f)
        csv_file.writerow(['Wonambi v{}'.format(__version__)])
        csv_file.writerow(heading_row_1 + band_hdr)
        csv_file.writerow(['Mean'] + spacer + list(desc['mean']))
        csv_file.writerow(['SD'] + spacer + list(desc['sd']))
        csv_file.writerow(['Mean of ln'] + spacer + list(desc['mean_log']))
        csv_file.writerow(['SD of ln'] + spacer + list(desc['sd_log']))
        idx = 0

        for seg in xband:

            for chan in seg['band'][0].keys():
                idx += 1

                cyc = None
                if seg['cycle'] is not None:
                    cyc = seg['cycle'][2]

                data_row = list(
                        [seg['band'][x][chan] for x in range(
                                len(seg['band']))])
                csv_file.writerow([idx,
                                   seg['start'],
                                   seg['end'],
                                   seg['duration'],
                                   seg['n_stitch'],
                                   seg['stage'],
                                   cyc,
                                   seg['name'],
                                   chan,
                                   ] + data_row)