pycsamt.iot.sim#
Synthetic IoT/AMT field-network simulator.
These generators make the IoT subpackage easy to demo, document, and test without hardware. They produce realistic-looking channel time series (with configurable SNR, powerline contamination, and dropouts), station/device configs, telemetry packets, GPS-drift clock pairs, and battery-decay curves.
Randomness is controlled through a seed argument for reproducibility.
Functions
|
Simulate one AMT channel: band-limited signal + noise + artefacts. |
|
Simulate a full AMT station: config, channel data, and packets. |
|
Simulate a monotonic-ish battery discharge curve with noise. |
|
Simulate paired reference/local clocks with drift, jitter, dropout. |
|
Simulate a network of AMT stations across one or more profiles. |
|
Return packets with a fraction randomly dropped. |
|
Return a powerline-noise time series (fundamental + harmonics). |
- pycsamt.iot.sim.simulate_powerline_noise(n_samples, sample_rate, *, mains_hz=50.0, amplitude=1.0, n_harmonics=3, seed=None)[source]#
Return a powerline-noise time series (fundamental + harmonics).
- pycsamt.iot.sim.simulate_amt_channel(n_samples, sample_rate, *, snr_db=20.0, mains_hz=50.0, powerline_amplitude=0.0, dropout_rate=0.0, seed=None)[source]#
Simulate one AMT channel: band-limited signal + noise + artefacts.
- pycsamt.iot.sim.simulate_amt_station(station_id, *, channels=('ex', 'ey', 'hx', 'hy'), sample_rate=128.0, n_samples=1024, mains_hz=50.0, snr_db=20.0, powerline_amplitude=0.2, dropout_rate=0.0, survey_id=None, profile=None, position_m=None, lat=None, lon=None, timestamp=None, seed=None)[source]#
Simulate a full AMT station: config, channel data, and packets.
- Returns:
Keys:
station(StationConfig),device(DeviceConfig),data({channel: ndarray}), andpackets(list ofTelemetryPacket: one health, one QC).- Return type:
- Parameters:
- pycsamt.iot.sim.simulate_iot_network(n_stations=10, *, profiles=('L1',), channels=('ex', 'ey', 'hx', 'hy'), sample_rate=128.0, n_samples=512, mains_hz=50.0, snr_db=20.0, dropout_rate=0.05, survey_id='SIM', station_spacing_m=50.0, seed=None, detail=False)[source]#
Simulate a network of AMT stations across one or more profiles.
- Parameters:
n_stations (int) – Total number of stations to generate.
profiles (sequence of str) – Profile/line labels; stations are round-robin assigned to them.
detail (bool) – When
Truereturn a dict withstationsandpackets. WhenFalse(default) return just the flat list of packets, as in the documented example.sample_rate (float)
n_samples (int)
mains_hz (float)
snr_db (float)
dropout_rate (float)
survey_id (str)
station_spacing_m (float)
seed (int | None)
- Return type:
list of TelemetryPacket, or dict when
detail=True.
- pycsamt.iot.sim.simulate_packet_loss(packets, dropout_rate=0.05, *, seed=None)[source]#
Return packets with a fraction randomly dropped.
- Parameters:
packets (Iterable[TelemetryPacket])
dropout_rate (float)
seed (int | None)
- Return type:
- pycsamt.iot.sim.simulate_gps_drift(n_samples, *, sample_interval_s=1.0, drift_ppm=5.0, jitter_ms=0.2, offset_ms=0.0, dropout_rate=0.0, start_time=1700000000.0, seed=None)[source]#
Simulate paired reference/local clocks with drift, jitter, dropout.
- Returns:
Keys
referenceandlocal(POSIX-second arrays) andgps_lock(bool array). Feedlocal/referencestraight intoestimate_clock_drift_ppm()etc.- Return type:
- Parameters: