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)

origins = ps.weights.lat2W(4,4)
dests = ps.weights.lat2W(4,4)

origins.n

16
dests.n

16
ODw = ODW(origins, dests)

print ODw.n, 16*16

256 256
ODw.full()[0].shape

(256, 256)

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

origins = ps.weights.lat2W(3,3)

dests = ps.weights.lat2W(5,5)

origins.n

9
dests.n

25
ODw = ODW(origins, dests)

print ODw.n, 9*25

225 225
ODw.full()[0].shape

(225, 225)