/
testt2.py
executable file
·51 lines (45 loc) · 1.76 KB
/
testt2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import pysal
import numpy as np
'''
y=np.arange(9)
weight1=[
[0.1111111,0.1111111,0.1111111,0.1111111,0.1111111,0.1111111,0,0,0.1111111,0,0,0.1111111,0.1111111,0.1111111],
[0.1111111,0,0.1111111,0,0.1111111,0.1111111,0.1111111,0,0,0.1111111,0,0.1111111,0.1111111,0.1111111],
[0.1111111,0.1111111,0,0,0.1111111,0.1111111,0.1111111,0,0,0.1111111,0,0.1111111,0.1111111,0.1111111],
[0.25,0,0,0,0.25,0,0,0.25,0,0.25,0,0,0,0],
[0.125,0.125,0.125,0.125,0,0.125,0,0.125,0,0.125,0,0,0,0.125],
[0.1,0.1,0.1,0,0.1,0,0.1,0,0,0.1,0.1,0.1,0.1,0.1],
[0.125,0.125,0.125,0,0,0.125,0,0,0.125,0,0,0.125,0.125,0.125],
[0,0,0,0.3333333,0.3333333,0,0,0,0,0.3333333,0,0,0,0],
[0,0,0,0,0,0,1,0,0,0,0,0,0,0],
[0.125,0.125,0.125,0.125,0.125,0.125,0,0.125,0,0,0,0,0,0.125],
[0,0,0,0,0,0.3333333,0,0,0,0,0,0.3333333,0.3333333,0],
[0,0.1428571,0.1428571,0,0,0.1428571,0.1428571,0,0,0,0.1428571,0,0.1428571,0.1428571],
[0.125,0.125,0.125,0,0,0.125,0.125,0,0,0,0.125,0.125,0,0.125],
[0.1111111,0.1111111,0.1111111,0,0.1111111,0.1111111,0.1111111,0,0,0.1111111,0,0.1111111,0.1111111,0]]
yy=[
[1,2,3,4,5,6,7,8,9,10,11,12,13,14],
[1,2,3,4,5,6,7,8,9,10,11,12,13,14],
[1,2,3,4,5,6,7,8,9,10,11,12,13,14],
[1,2,3,4,5,6,7,8,9,10,11,12,13,14],
[1,2,3,4,5,6,7,8,9,10,11,12,13,14],
[1,2,3,4,5,6,7,8,9,10,11,12,13,14],
[1,2,3,4,5,6,7,8,9,10,11,12,13,14],
[1,2,3,4,5,6,7,8,9,10,11,12,13,14],
[1,2,3,4,5,6,7,8,9,10,11,12,13,14],
[1,2,3,4,5,6,7,8,9,10,11,12,13,14],
[1,2,3,4,5,6,7,8,9,10,11,12,13,14],
[1,2,3,4,5,6,7,8,9,10,11,12,13,14],
[1,2,3,4,5,6,7,8,9,10,11,12,13,14],
[1,2,3,4,5,6,7,8,9,10,11,12,13,14],
]
npy=np.arange(196)
npy.shape=(14,14)
weight1=np.array(weight1)
y1=pysal.lag_spatial(weight1,npy)
print(y1)
'''
w = pysal.lat2W(5, 5)
w2=pysal.higher_order(w,2)
print(w)
print(w2)