Network time-delay simulation with statistical analysis and plotting
Project description
pydelay
pydelay is a Python package for simulating and analysing network time delays. It supports two statistical delay models, a Gaussian long-distance model and an exponential short-distance model, and produces publication-ready plots of the delay distribution and signal pulse train.
Installation
pip install pydelay
Quick Start
As a library
import pydelay
# Run a long-distance (Gaussian) delay simulation
result = pydelay.delay("l", n_packets=5000, simulation_time=120.0, seed=42)
print(f"Mean delay : {result.mean_delay:.3f} s")
print(f"Std delay : {result.std_delay:.3f} s")
print(f"Min delay : {result.min_delay:.3f} s")
# Plot the results
fig, axes = pydelay.plot(result, show=True)
# Save the figure
pydelay.plot(result, save="delay_plot.png")
As a command-line tool
# Long-distance model, default settings
pydelay l
# Short-distance model, custom packet count and seed
pydelay s --npack 10000 --stime 60 --seed 0
# Skip writing the CSV output file
pydelay l --no-csv
Delay Models
| Flag | Model | Distribution |
|---|---|---|
l |
Long-distance | Gaussian μ = 1.50 s, σ = 0.50 s |
s |
Short-distance | Exponential min ≈ 1 ms, mean ≈ 2 ms |
API Reference
pydelay.delay(model, *, n_packets, simulation_time, seed, output_csv)
Run the delay simulation and return a SimulationResult.
| Parameter | Type | Default | Description |
|---|---|---|---|
model |
"l" or "s" |
— | Delay model |
n_packets |
int |
5000 |
Number of packets to simulate |
simulation_time |
float |
120.0 |
Time horizon in seconds |
seed |
int | None |
None |
Random seed for reproducibility |
output_csv |
str | Path | None |
"delay_data.csv" |
Path to save CSV; None to skip |
pydelay.plot(result, *, zoom_start, zoom_stop, show, save)
Plot the pulse train and delay distributions.
Returns (fig, (ax_signal, ax_dist, ax_dist2)).
SimulationResult
| Attribute | Description |
|---|---|
.send_time |
Packet send timestamps (ndarray) |
.simulated_delay |
Sampled delays (ndarray) |
.pulse_time / .pulse_values |
Pulse train arrays |
.min_delay |
Minimum delay |
.mean_delay |
Mean delay |
.std_delay |
Standard deviation of delay |
.simdelay |
Dict of {time, signals} for external use |
Requirements
- Python ≥ 3.10
- numpy ≥ 1.24
- matplotlib ≥ 3.7
- scipy ≥ 1.10
License
MIT © Parham Kebria
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pydelay-0.1.0.tar.gz.
File metadata
- Download URL: pydelay-0.1.0.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67d8c7655e657fe942602429df0cda8c03d40f00ad0afa675cce8f6415da4fbb
|
|
| MD5 |
67183a140e84758878fb264cb9576bf7
|
|
| BLAKE2b-256 |
1cba575a76aee50d824d9579452aed693dec43b1e7f33c6b577c98425609ef5c
|
Provenance
The following attestation bundles were made for pydelay-0.1.0.tar.gz:
Publisher:
publish.yml on parhamkebria/pydelay
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pydelay-0.1.0.tar.gz -
Subject digest:
67d8c7655e657fe942602429df0cda8c03d40f00ad0afa675cce8f6415da4fbb - Sigstore transparency entry: 2015817297
- Sigstore integration time:
-
Permalink:
parhamkebria/pydelay@abcf1ac26aa8b990e498d73ed50e0a9b73a52b1e -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/parhamkebria
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@abcf1ac26aa8b990e498d73ed50e0a9b73a52b1e -
Trigger Event:
push
-
Statement type:
File details
Details for the file pydelay-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pydelay-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
301553587c7db391e22b27a5da9a600543279a801e251d60225d25b5c36400d5
|
|
| MD5 |
5c4918c2e694b6202c09fcdf5658cc2f
|
|
| BLAKE2b-256 |
6c548f7442b80787ea3694f3610fb041add383663e1f37742922aef598903ea7
|
Provenance
The following attestation bundles were made for pydelay-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on parhamkebria/pydelay
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pydelay-0.1.0-py3-none-any.whl -
Subject digest:
301553587c7db391e22b27a5da9a600543279a801e251d60225d25b5c36400d5 - Sigstore transparency entry: 2015817333
- Sigstore integration time:
-
Permalink:
parhamkebria/pydelay@abcf1ac26aa8b990e498d73ed50e0a9b73a52b1e -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/parhamkebria
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@abcf1ac26aa8b990e498d73ed50e0a9b73a52b1e -
Trigger Event:
push
-
Statement type: