nstat.simulate_point_process
- nstat.simulate_point_process(time, rate_hz, *, seed=None, uniform_values=None)[source]
Simulate one spike train from a sampled rate by per-bin Bernoulli sampling.
In each time bin the spike probability is
1 - exp(-rate_hz * dt)(dtis the local bin width; the last bin reuses the previous width). A spike is emitted, stamped at the bin’s time value, when a uniform draw falls below that probability.- Parameters:
time (array_like, shape (n,)) – Monotonic time grid in seconds.
rate_hz (array_like, shape (n,)) – Conditional intensity in Hz on the same grid. Negative values are treated as zero.
seed (int, optional) – Seed for
numpy.random.default_rngwhenuniform_valuesis not given.uniform_values (array_like, shape (n,), optional) – Pre-drawn uniform variates in
[0, 1), for deterministic reproduction. When given,seedis ignored.
- Returns:
Bundle with the time grid, rate, realised
spikes, per-bin spike probabilitylambda_delta, binaryspike_indicatorand theuniform_valuesactually used. When fewer than two time samples are given, the spike train is empty.- Return type:
- Raises:
ValueError – If
timeandrate_hzdiffer in length, oruniform_valuesdoes not match the length oftime.