spaghetti.Network.simulate_observations

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

Generate a simulated point pattern on the network.

Parameters
countint

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

distributionstr

{'uniform', 'poisson'} distribution of random points. If "poisson", the distribution is calculated from half the total network length.

Returns
random_ptsdict

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

Examples

>>> import 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