generate_test_signal
Generate synthetic vibration test signals for bearing, gear, imbalance, or normal data, then save and auto-register them for immediate analysis, diagnosis, and ISO severity assessment.
Instructions
Generate a synthetic test signal, save it, and load it into the repository.
The signal is written to data/signals/ with a timestamped filename and a
companion _metadata.json declaring sampling_rate and signal_unit='g'
(synthetic acceleration), then auto-registered in the repository — the
returned signal_id is immediately usable by every analysis, diagnosis,
and ISO severity tool with no manual steps.
Signal content: 'bearing_fault' = 10 Hz impacts modulating a 1 kHz
carrier; 'gear_fault' = 200 Hz mesh tone + harmonics; 'imbalance' =
25 Hz (1500 RPM) tone; 'normal' = broadband noise.
Args:
signal_type: Synthetic fault pattern to generate.
duration: Signal duration in seconds (10 s gives 0.1 Hz resolution).
sampling_rate: Sampling frequency in Hz.
noise_level: Additive white-noise amplitude.
random_seed: Seed for reproducible noise (None = non-deterministic).
ctx: MCP context. Unused — see this module's docstring on logging.
Returns:
StoredSignalInfo of the auto-loaded signal (signal_id, declared
sampling_rate and unit 'g').
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| duration | No | ||
| noise_level | No | ||
| random_seed | No | ||
| signal_type | No | bearing_fault | |
| sampling_rate | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| shape | Yes | Shape of the signal array | |
| filepath | Yes | Original file path | |
| signal_id | Yes | Unique identifier for the stored signal | |
| duration_s | No | Duration in seconds | |
| raw_format | No | EFFECTIVE raw-binary decode parameters (sample_format, byte_order, n_channels, channel_index, header_offset, scale_factor) after the explicit > companion > default merge — recorded as provenance so get_signal_info can answer 'how was this file decoded'. None for self-describing formats. | |
| size_bytes | Yes | Approximate memory size in bytes | |
| measurement | No | Normalized measurement identity declared in the companion's "measurement" object: asset_id, measurement_point_id, acquired_at (ISO 8601 normalized to UTC), timezone_declared, timestamp_suspect, rpm, load, operating_state, sensor_id, direction, declared_by, measurement_id (first 16 hex of the SHA-256 of the file bytes plus the channel index), channel_index, content_sha256 (full digest of the file bytes) and size_bytes (file size). This block is AUTHORITATIVE over the verbatim object kept in source_metadata. None when the companion declares no measurement object (the file behaves exactly as before). The value RETURNED BY load_signal carries, in addition, the outcome of the asset-ledger registration: ledger_status ('recorded' | 'already_recorded' | 'superseded' | 'not_recorded'), reason (None, or why the status or the snapshot is not nominal), changed (keys that differ from the previous declaration of the same measurement, 'location' when the file moved), reattributed_from (asset the measurement was recorded under by mistake, or None), declaration_version, snapshot_status ('complete' | 'partial' | 'failed' | 'skipped'), snapshot_id, processing_id (the snapshot lineage), comparability ({grade, qualifications} against the current declaration of the measurement point, informational, never stored) and missing ({block: {reason, remedy}} of the snapshot blocks the declared context could not support). get_signal_info and list_signals show the identity only. | |
| num_samples | Yes | Number of samples | |
| signal_unit | No | DECLARED signal unit — from load_signal(signal_unit=...) or the companion _metadata.json ('signal_unit' field). Never guessed. None means undeclared: ISO severity verdicts will be refused until the unit is declared. | |
| sampling_rate | No | Sampling rate in Hz (must be positive when set) | |
| load_timestamp | Yes | ISO 8601 timestamp when signal was loaded | |
| source_metadata | No | Complete companion _metadata.json of the source file (rpm/shaft_speed, reference frequencies, ...). Empty when the file has no companion metadata. | |
| companion_warning | No | Set when a companion _metadata.json exists but could not be used (not valid JSON, or not a JSON object): names the file and the case, and the signal was loaded exactly as if it had no companion. None when the companion was read fine or is absent. |