unnamed_index += 1
        n = m.numstates - 2   # HTK numstates counts virtual entry and exit states
        hmm = Hmm(n, log_domain)
        gmms = []
        for s_label, state in m.states:
            assert s_label == 'state'
            dc and dc("state.keys() = \n%s" % (state.keys(),))
            num_mixtures = 1
            weights = array((1.0,), dtype = float)
            gmm = GaussianMixtureModel(dim, covar_type, num_mixtures)
            gmm.set_weights(weights)
            gmm.set_model(state.mean, state.var)
            dc and dc("gmm = %s" % (gmm,))
            gmms.append(gmm)

        model_indices = gmm_mgr.add_models(gmms)
        hmm.build_model(gmm_mgr, model_indices, 1, 1, m.transp)
        hmms.append(hmm)
        names.append(name)
    indices = hmm_mgr.add_models(hmms)
    return dict(izip(names, indices)), hmm_mgr, gmm_mgr
    
def logreftest():
    module_dir, module_name = os.path.split(__file__)
    files = tuple(os.path.join(module_dir, mmf_file) for mmf_file in ("start.mmf", 'mmf1.mmf', 'mmf4.mmf'))
    for fname in files:
        with DebugPrint('htkmmf_read'):
            with open(fname) as f:
                models, hmm_mgr, gmm_mgr = read_htk_mmf_file(f)
            print gmm_mgr
            for name, index in models.items():