@@ -0,0 +1,2209 @@
+# -*- coding: utf-8 -*-%0A%0A# Copyright (c) 2015-2016 MIT Probabilistic Computing Project%0A%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A%0A#    http://www.apache.org/licenses/LICENSE-2.0%0A%0A# Unless required by applicable law or agreed to in writing, software%0A# distributed under the License is distributed on an %22AS IS%22 BASIS,%0A# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A# See the License for the specific language governing permissions and%0A# limitations under the License.%0A%0Aimport os%0A%0Aimport matplotlib.pyplot as plt%0Aimport numpy as np%0Aimport pandas as pd%0Aimport pytest%0A%0Afrom cgpm.crosscat.engine import Engine%0Afrom cgpm.utils import general as gu%0Afrom cgpm.utils import plots as pu%0Afrom cgpm.utils import test as tu%0Afrom cgpm.utils import render_utils as ru%0A%0Aanimals = pd.read_csv('resources/animals/animals.csv', index_col=0)%0Aanimal_values = animals.values%0Aanimal_names = animals.index.values%0Aanimal_features = animals.columns.values%0A%0Adef launch_analysis():%0A    engine = Engine(%0A        animals.values.astype(float),%0A        num_states=64,%0A        cctypes=%5B'categorical'%5D*len(animals.values%5B0%5D),%0A        distargs=%5B%7B'k':2%7D%5D*len(animals.values%5B0%5D),%0A        rng=gu.gen_rng(7))%0A%0A    engine.transition(N=900)%0A    with open('resources/animals/animals.engine', 'w') as f:%0A        engine.to_pickle(f)%0A%0A    engine = Engine.from_pickle(open('resources/animals/animals.engine','r'))%0A    D = engine.dependence_probability_pairwise()%0A    pu.plot_clustermap(D)%0A%0A%0Adef render_states_to_disk(filepath, prefix):%0A    engine = Engine.from_pickle(filepath)%0A    for i in range(engine.num_states()):%0A        print '%5Cr%25d' %25 (i,)%0A        savefile = '%25s-%25d' %25 (prefix, i)%0A        state = engine.get_state(i)%0A        ru.viz_state(%0A            state, row_names=animal_names, col_names=animal_features,%0A            savefile=savefile)%0A%0A# render_states_to_disk(%0A#     'resources/animals/animals-normal.engine',%0A#     'resources/animals/normal/cc-normal')%0A# render_states_to_disk(%0A#     'resources/animals/animals-normal-lovecat.engine',%0A#     'resources/animals/normal/lv-normal')%0A%0A

Add the animals testing harness.