Return statistics calculated for all samples of each utterance in the corpus.

        Returns:
            dict: A dictionary containing a DataStats object for each utt.
491539
def stats_per_utterance(self):
        

        all_stats = {}

        for utterance in self.utterances.values():
            data = utterance.read_samples()
            all_stats[utterance.idx] = stats.DataStats(float(np.mean(data)),
                                                       float(np.var(data)),
                                                       np.min(data),
                                                       np.max(data),
                                                       data.size)

        return all_stats
626673
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self, 'voices') and self.voices is not None:
            _dict['voices'] = [x._to_dict() for x in self.voices]
        return _dict
661972
def spectra(
            self):
        
        specResultsList = []
        specResultsList[:] = [dict(l) for l in self.specResultsList]
        return specResultsList
1222327
def rc_stats(stats):
    
    rc_nucs = {'A':'T', 'T':'A', 'G':'C', 'C':'G', 'N':'N'}
    rcs = []
    for pos in reversed(stats):
        rc = {}
        rc['reference frequencey'] = pos['reference frequency']
        rc['consensus frequencey'] = pos['consensus frequency']
        rc['In'] = pos['In']
        rc['Del'] = pos['Del']
        rc['ref'] = rc_nucs[pos['ref']]
        rc['consensus'] = (rc_nucs[pos['consensus'][0]], pos['consensus'][1])
        for base, stat in list(pos.items()):
            if base in rc_nucs:
                rc[rc_nucs[base]] = stat
        rcs.append(rc)
    return rcs
584068
def get_dataset(corpora):
    
    # TODO: make filter methods for the files

    def make_posix_path(dirpath, filename):
        dirpath = posixpath.sep.join(dirpath.split(os.sep))
        return posixpath.join(dirpath, filename)

    wav_files_in_corpora = filter(
        lambda x: x.endswith('.wav'),
        sum(
            [list(map(lambda x: make_posix_path(corpus, x), os.listdir(corpus))) for corpus in corpora],
            []
        ),
    )

    dataset = {}
    for wav_file in wav_files_in_corpora:
        subjectID = os.path.split(wav_file)[-1].split('.')[0].split('_')[0]

        if subjectID in dataset:
            dataset[subjectID].append(wav_file)
        else:
            dataset[subjectID] = [wav_file]

    return dataset
321582
def stats(self):
        
        response = self.requester.get(
            '/{endpoint}/{id}/stats',
            endpoint=self.endpoint, id=self.id
        )
        return response.json()
827591
def make_speaker_utters(utterances: List[Utterance]) -> Dict[str, List[Utterance]]:
    

    speaker_utters = defaultdict(list) # type: DefaultDict[str, List[Utterance]]
    for utter in utterances:
        speaker_utters[utter.speaker].append(utter)

    return speaker_utters
696833
def stats(self):
        
        res = {}
        db = self._collection.database
        res['dbstats'] = db.command('dbstats')
        res['data'] = db.command('collstats', self._collection.name)
        res['totals'] = {'count': res['data']['count'],
                         'size': res['data']['size']
                         }
        return res
1369594
def to_dict(self):
        
        d = {}
        for word, idx in self.vocab.iteritems():
            d[word] = self.array[idx].tolist()
        return d
1169753
def get_data_iters_and_vocabs(args: argparse.Namespace,
                              model_folder: Optional[str]) -> Tuple['data_io.BaseParallelSampleIter',
                                                                    List[vocab.Vocab], vocab.Vocab, model.ModelConfig]:
    

    model_config = model.SockeyeModel.load_config(os.path.join(args.model, C.CONFIG_NAME))

    if args.max_seq_len is None:
        max_seq_len_source = model_config.config_data.max_seq_len_source
        max_seq_len_target = model_config.config_data.max_seq_len_target
    else:
        max_seq_len_source, max_seq_len_target = args.max_seq_len

    batch_num_devices = 1 if args.use_cpu else sum(-di if di < 0 else 1 for di in args.device_ids)

    # Load the existing vocabs created when starting the training run.
    source_vocabs = vocab.load_source_vocabs(model_folder)
    target_vocab = vocab.load_target_vocab(model_folder)

    sources = [args.source] + args.source_factors
    sources = [str(os.path.abspath(source)) for source in sources]

    score_iter = data_io.get_scoring_data_iters(
        sources=sources,
        target=os.path.abspath(args.target),
        source_vocabs=source_vocabs,
        target_vocab=target_vocab,
        batch_size=args.batch_size,
        batch_num_devices=batch_num_devices,
        max_seq_len_source=max_seq_len_source,
        max_seq_len_target=max_seq_len_target)

    return score_iter, source_vocabs, target_vocab, model_config
1143855
def stats(self):
        
        self.raise_error_if_not_open()

        per_key_stats = self.stats_per_key()

        return stats.DataStats.concatenate(per_key_stats.values())
682517
def speaker_durations(utterances: List[Utterance]) -> List[Tuple[str, int]]:
    

    speaker_utters = make_speaker_utters(utterances)

    speaker_duration_tuples = [] # type: List[Tuple[str, int]]
    for speaker in speaker_utters:
        speaker_duration_tuples.append((speaker, total_duration(speaker_utters[speaker])))

    return speaker_duration_tuples
309957
def read_stats(self):
        

        stats_with_captions = OrderedDict()
        for stat_name in self.stats_captions.keys():
            stats_with_captions[stat_name] = self.read_stat(self.stats_captions[stat_name], stat_name)
        return stats_with_captions
971437
def getIfStats(self):
        
        info_dict = {}
        try:
            fp = open(ifaceStatsFile, 'r')
            data = fp.read()
            fp.close()
        except:
            raise IOError('Failed reading interface stats from file: %s'
                          % ifaceStatsFile)
        for line in data.splitlines():
            mobj = re.match('^\s*([\w\d:]+):\s*(.*\S)\s*$', line)
            if mobj:
                iface = mobj.group(1)
                statline = mobj.group(2)
                info_dict[iface] = dict(zip(
                    ('rxbytes', 'rxpackets', 'rxerrs', 'rxdrop', 'rxfifo',
                     'rxframe', 'rxcompressed', 'rxmulticast',
                     'txbytes', 'txpackets', 'txerrs', 'txdrop', 'txfifo',
                     'txcolls', 'txcarrier', 'txcompressed'),
                    [int(x) for x in statline.split()]))
                    
        return info_dict
207269
def get_all_stats(self):
        

        all_stats = OrderedDict()
        for obj_name in self.statistics:
            all_stats[obj_name] = dict(zip(self.captions, self.statistics[obj_name]))
        return all_stats
541220
def state_fluents(self) -> Dict[str, PVariable]:
        ''''''
        return { str(pvar): pvar for pvar in self.pvariables if pvar.is_state_fluent() }
1257756
def read_stats(self):
        

        self.tx_statistics = TgnObjectsDict()
        for port in self.session.ports.values():
            for stream in port.streams.values():
                self.tx_statistics[stream] = stream.read_stats()

        tpld_statistics = XenaTpldsStats(self.session).read_stats()

        self.statistics = TgnObjectsDict()
        for stream, stream_stats in self.tx_statistics.items():
            self.statistics[stream] = OrderedDict()
            self.statistics[stream]['tx'] = stream_stats
            self.statistics[stream]['rx'] = OrderedDict()
            stream_tpld = stream.get_attribute('ps_tpldid')
            for tpld, tpld_stats in tpld_statistics.items():
                if tpld.id == stream_tpld:
                    self.statistics[stream]['rx'][tpld] = tpld_stats
        return self.statistics