pysal.explore.pointpats.
PoissonPointProcess
(window, n, samples, conditioning=False, asPP=False)[源代码]¶泊松点过程包括 \(N\) -条件CSR过程和 \(\lambda\) -有条件的企业社会责任流程。
参数: |
|
---|
实例
>>> import pysal.lib as ps
>>> import numpy as np
>>> from pointpats import Window
>>> from pysal.lib.cg import shapely_ext
打开弗吉尼亚多边形形状文件
>>> va = ps.io.open(ps.examples.get_path("virginia.shp"))
从县形状的并集为va创建外部多边形
>>> polys = [shp for shp in va]
>>> state = shapely_ext.cascaded_union(polys)
从弗吉尼亚州边界创建窗口
>>> window = Window(state.parts)
1.模拟 \(N\) -同一窗口中的条件CSR流程(10分,2次实现)
>>> np.random.seed(5)
>>> samples1 = PoissonPointProcess(window, 10, 2, conditioning=False, asPP=False)
>>> samples1.realizations[0] # the first realized event points
array([[-81.80326547, 36.77687577],
[-78.5166233 , 37.34055832],
[-77.21660795, 37.7491503 ],
[-79.30361037, 37.40467853],
[-78.61625258, 36.61234487],
[-81.43369537, 37.13784646],
[-80.91302108, 36.60834063],
[-76.90806444, 37.95525903],
[-76.33475868, 36.62635347],
[-79.71621808, 37.27396618]])
2.第二步。模拟 \(\lambda\) -同一窗口中的条件CSR流程(10分,2次实现)
>>> np.random.seed(5)
>>> samples2 = PoissonPointProcess(window, 10, 2, conditioning=True, asPP=True)
>>> samples2.realizations[0].n # the size of first realized point pattern
10
>>> samples2.realizations[1].n # the size of second realized point pattern
13
属性: |
|
---|
方法
draw \(参数) |
在给定窗口内生成一系列点坐标。 |
realize (n) |
在“窗口”的最小边界框中生成随机独立分布的n个点。 |
setup () |
为每个实现生成事件数。 |
方法
__init__ \(窗口,n,示例[, conditioning, ...] ) |
初始化自身。 |
draw \(参数) |
在给定窗口内生成一系列点坐标。 |
realize (n) |
在“窗口”的最小边界框中生成随机独立分布的n个点。 |
setup () |
为每个实现生成事件数。 |