<commit_before>"""
The DisasterMCMC example.

"""
from numpy.testing import *
from pymc import MCMC
from pymc.examples import DisasterModel
import nose,  warnings
warnings.simplefilter('ignore', FutureWarning)

try:
    from pymc.Matplot import plot, autocorrelation
except:
    pass

PLOT=True
DIR = 'testresults/'


class test_MCMC(TestCase):

    # Instantiate samplers
    M = MCMC(DisasterModel)
    
    # Sample
    M.sample(4000,2000,verbose=0)
    
    def test_instantiation(self):
             
        # Check stochastic arrays
        assert_equal(len(self.M.stochastics), 3)
        assert_equal(len(self.M.observed_stochastics),1)
        assert_array_equal(self.M.D.value, DisasterModel.disasters_array)
        
    def test_plot(self):
        if not PLOT:
            raise nose.SkipTest
        
        # Plot samples
        plot(self.M.e, path=DIR, verbose=0)
        
    def test_autocorrelation(self):<commit_msg>Fixed test failing due to pylab not being installed.<commit_after>"""
The DisasterMCMC example.

"""
from numpy.testing import *
from pymc import MCMC
from pymc.examples import DisasterModel
import nose,  warnings
warnings.simplefilter('ignore', FutureWarning)
PLOT=True
try:
    from pymc.Matplot import plot, autocorrelation
except:
    PLOT=False
    pass


DIR = 'testresults/'


class test_MCMC(TestCase):

    # Instantiate samplers
    M = MCMC(DisasterModel)
    
    # Sample
    M.sample(4000,2000,verbose=0)
    
    def test_instantiation(self):
             
        # Check stochastic arrays
        assert_equal(len(self.M.stochastics), 3)
        assert_equal(len(self.M.observed_stochastics),1)
        assert_array_equal(self.M.D.value, DisasterModel.disasters_array)
        
    def test_plot(self):
        if not PLOT:
            raise nose.SkipTest
        
        # Plot samples
        plot(self.M.e, path=DIR, verbose=0)
        
    def test_autocorrelation(self):
{'fraction_non_alphanumeric': 0.08902691511387163, 'fraction_numerical': 0.012422360248447204, 'mean_word_length': 2.753398058252427, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3492835', 'n_tokens_mistral': 651, 'n_tokens_neox': 612, 'n_words': 134}