pysal.explore.spaghetti.Network.simulate_observations

Network.simulate_observations(count, distribution='uniform')[source]

Generate a simulated point pattern on the network.

Parameters:
count : int

The number of points to create or mean of the distribution if not ‘uniform’.

distribution : str

{‘uniform’, ‘poisson’} distribution of random points. If poisson if the distrubtion the poisson is calculated from half the total network length

Returns:
random_pts : dict

Keys are the edge tuple. Values are lists of new point coordinates.

Examples

>>> import pysal.explore.spaghetti as spgh
>>> ntw = spgh.Network(examples.get_path('streets.shp'))
>>> ntw.snapobservations(examples.get_path('crimes.shp'),
...                                        'crimes',
...                                         attribute=True)
>>> npts = ntw.pointpatterns['crimes'].npoints
>>> sim = ntw.simulate_observations(npts)
>>> isinstance(sim, spgh.network.SimulatedPointPattern)
True