pymc-devs/pymc — Issue #90: when creating an MCMC model using an existing db the traces are not loaded to individual nodes.
Author: isofer
Created: 2012-01-31 18:16:01+00:00
State: open

when creating an MCMC model using an existing db the traces are loaded to the model but not to individual nodes.

```
import pymc as pm

#create a model
x = pm.Normal('x',0,1)
mc = pm.MCMC([x],db='pickle', dbname='testing.db')

#sample
mc.sample(200)

#print trace
print "printing the trace from x before closeing the db"
print x.trace()[:10]

#close the db
mc.db.close()

#now, let's load the db again
db = pm.database.pickle.load('testing.db')

#create a new model
x = pm.Normal('x',0,1)
mc2 = pm.MCMC([x], db=db)

#print trace from mcmc
print "printing the trace of x from mc2"
print mc2.trace('x')[:10]

#print trace
"printing the trace of x from x"
print x.trace()
```

This is the ouptut:

```
In [41]: execfile('/Users/imrisofer/PySchizo/bla2.py')
Sampling: 100% [000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000] Iterations: 200
printing the trace from x before closeing the db
[-1.30381504 0.54872208 0.17317576 0.88309938 -0.3897846 -0.51572362
-0.706447 0.10687589 -2.07283465 1.18359088]
printing the trace of x from mc2
[-1.30381504 0.54872208 0.17317576 0.88309938 -0.3897846 -0.51572362
-0.706447 0.10687589 -2.07283465 1.18359088]
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/Users/imrisofer/Documents/Projects/rapid/alz/ in ()
----> 1 execfile('/Users/imrisofer/PySchizo/bla2.py')

/Users/imrisofer/PySchizo/bla2.py in ()
30 #print trace

31 "printing the trace of x from x"
---> 32 print x.trace()
33
34

TypeError: 'bool' object is not callable
```

this kind of bug creates problems when trying to plot a single node or when using any other function that's try to excess the node's trace.