In [4]:
import sys
sys.path.append('/Users/toshan/dev/pysal/pysal/weights')
from pysal.model.spintW import ODW
import pysal as ps

With an equal number of origins and destinations (n=16)


In [33]:
origins = ps.weights.lat2W(4,4)
dests = ps.weights.lat2W(4,4)

In [34]:
origins.n


Out[34]:
16

In [35]:
dests.n


Out[35]:
16

In [36]:
ODw = ODW(origins, dests)

In [37]:
print ODw.n, 16*16


256 256

In [38]:
ODw.full()[0].shape


Out[38]:
(256, 256)

With non-equal number of origins (n=9) and destinations (m=25)


In [39]:
origins = ps.weights.lat2W(3,3)

In [40]:
dests = ps.weights.lat2W(5,5)

In [41]:
origins.n


Out[41]:
9

In [42]:
dests.n


Out[42]:
25

In [43]:
ODw = ODW(origins, dests)

In [44]:
print ODw.n, 9*25


225 225

In [45]:
ODw.full()[0].shape


Out[45]:
(225, 225)

In [ ]: