Guides
Replay a sample as a live stream
Send a sample’s weeks of data into your own project as a live stream, in minutes, and see its alerts in History, your notifications and the Supervisor.
A sample opened in the browser shows its alerts as marks on the charts. To see what a customer sees on a real line (the alert history, the emails and messages, and the Supervisor’s judgements), replay the sample as a live stream into a project of yours. One command sends its data from your computer, faster than real time, and the sample’s alerts run on your computer as they would on a customer’s sending machine. Allow fifteen minutes.
Step 1: Install the Python package
Python 3.9 or later. The rules extra adds numpy, which the alerts need:
pip install "kymoscope[rules]"Step 2: Save the sample’s alerts in your project
- Open a workbook of the project, press Sample data (the flask in the left rail) and open Batch reactor.
- Open the Alerts panel (the bell), then Rules. The sample’s six alerts are listed there; press Save to my rules on each one.
- Open each saved alert, tick The sending machine (collector or Python sender) under Where it runs, and press Save alert. The replay runs only the alerts ticked this way.
The alerts are yours from then on: they count towards your plan’s alerts, and you can change or delete them like any other. See Alerts with nobody watching.
Step 3: Create an API key for the project
Open the project → API keys → create one and copy it. The API key decides where the stream goes: the replay lands in that project, with nothing else to choose. In an end-to-end encrypted project, a project member approves the new sender the first time it connects, as for any publisher.
Step 4: Replay the sample
python -m kymoscope.replay batch-reactor --api-key kymoscope_... --speed 3600The file is downloaded once (it is kept under ~/.kymoscope/samples), then sent at 3,600 times real time: the reactor’s 28 days take about 11 minutes. It prints where it is:
r101-batches-28d.csv: 80760 rows, 15 channels, 28.0 days of data; at 3600x it takes 11.2 min
Kymoscope: 'r101-batches-28d' admitted (live, 120 Hz × 15 ch = 155 kbit/s).
Streaming 'r101-batches-28d' (id 7d3c1f00-…). In Kymoscope: Browse live streams -> Connect. Ctrl+C to stop.
0.7 % day 0.21
1.5 % day 0.42It plays the file once and stops; it waits up to three minutes at the end for the last alerts and judgements to go. Stop it any time with Ctrl+C. Run it again and it reuses the same stream.
Step 5: See the alerts
- History. Open the project → Alerts. Each alert appears in History as the replay reaches it, marked Collector (flagged by a sending machine, with nobody’s browser open); Coverage lists your computer.
- Notifications. The alerts notify their channels as usual: email, Slack, Teams or a webhook, as set in each alert’s Notify. A replay at high speed sends many in a few minutes, so point them at a channel of your own while you try it.
- The Supervisor. With the Supervisor in your plan, each alert gets its judgement (Real, Noise or Expected) and its explanation in the history, and the project’s Supervisor tab counts it. See The Supervisor. Each judgement takes 1 AI credit; the reactor’s 28 days raise about 80 alerts.
- The data. To watch the stream while it plays: Browse live streams → the stream → Connect.
Samples that replay
| Name to pass | What it sends |
|---|---|
batch-reactor | Jacketed reactor R-101: 149 batches in 28 days, every 30 s |
process-unit | Feed cooler E-201: 28 days of historian data, every minute |
imm-check-ring | Injection moulding machine IMM 2: one row per shot over 20 working days |
press-die-wear | Stamping press 2: one row per stroke over 22 working days |
fan-bearing | Process fan: a bearing run to failure over 35 days, every 10 minutes |
retort | Steam retort 3: one production day, every second |
cell-aging | 21700 cell 06 on a cycler: 165 cycles |
The other samples are MDF, TDMS, HDF5 and other formats, which the replay doesn’t read: it takes CSV only. Pass a sample’s file name (retort-batches-4w.csv), any URL of a CSV, or a CSV on your computer to replay it. The time column is t, ElapsedTime or Test_Time(s), in seconds, else the first column of dates and times; every other column of numbers becomes a channel, with its unit when a row of units sits under the header.
Options
| Option | What it does |
|---|---|
--speed N | Data seconds sent per real second. 1 (the default) is real time; 3600 plays an hour of data each second. |
--loop | Start again at the end of the file, until Ctrl+C. Without it, the file plays once. |
--api-key | The project’s API key; or set KYMOSCOPE_API_KEY once. |
--name | The stream’s name (default: the file’s name). |
--password | A stream password of 12 characters or more for the people who watch it. See Who can watch a stream. |
--state | Where the stream’s identity is kept, so a second replay reuses the stream (default: .kymoscope_replay_state.json in the current folder). |
How the times work
Each row is sent with its own time in the file, counted from the file’s start, whatever the speed. So an alert that must hold for 5 minutes (forS: 300) waits for 5 minutes of the sample’s data, which at --speed 3600 is a twelfth of a second: the alerts fire exactly where they would on the real line.
The alert history dates each alert by the clock, when the replay reaches it, so at high speed an episode that lasted twenty minutes in the sample lasts about a second there. The stream’s time axis counts the seconds of the sample from its start.