pysal.lib.weights.ODW

pysal.lib.weights.ODW(Wo, Wd, transform='r', silence_warnings=True)[source]

Constructs an o*d by o*d origin-destination style spatial weight for o*d flows using standard spatial weights on o origins and d destinations. Input spatial weights must be binary or able to be sutiably transformed to binary.

Parameters:
Wo : W object for origin locations

o x o spatial weight object amongst o origins

Wd : W object for destination locations

d x d spatial weight object amongst d destinations

transform : Transformation for standardization of final OD spatial weight; default

is ‘r’ for row standardized

Returns:
W : spatial contiguity W object for assocations between flows

o*d x o*d spatial weight object amongst o*d flows between o origins and d destinations

Examples

>>> import pysal.lib
>>> O = pysal.lib.weights.lat2W(2,2)
>>> D = pysal.lib.weights.lat2W(2,2)
>>> OD = pysal.lib.weights.spintW.ODW(O,D)
>>> OD.weights[0]
[0.25, 0.25, 0.25, 0.25]
>>> OD.neighbors[0]
array([ 5,  6,  9, 10], dtype=int32)
>>> OD.full()[0][0]
array([0.  , 0.  , 0.  , 0.  , 0.  , 0.25, 0.25, 0.  , 0.  , 0.25, 0.25,
       0.  , 0.  , 0.  , 0.  , 0.  ])