STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
backend.test_series Namespace Reference

Functions

 test_decimate_preserves_spikes_and_bounds ()
 test_decimate_discrete_keeps_only_transitions ()
 test_decimate_discrete_caps_pathological ()
 test_decimate_noop_when_small ()
 test_slice_inclusive_bounds ()
 test_classify_families_and_kinds ()
 test_classify_labjack_t7 ()
 test_wide_csv_union_and_ffill (monkeypatch)
 test_wide_csv_role_row_aligns_with_the_columns (monkeypatch, tmp_path)
 clock_run (tmp_path, monkeypatch)
 _write (dir_, name, db_times, values)
 test_sensor_clock_replaces_the_bursty_db_write_time (clock_run)
 test_boot_relative_clock_is_reanchored_not_discarded (clock_run)
 test_reanchored_rows_never_land_after_their_own_db_write (clock_run)
 test_reanchoring_a_single_row_degrades_to_the_db_time (clock_run)
 test_an_epoch_clock_is_not_shifted (clock_run)
 test_missing_sibling_falls_back_to_db_time (clock_run)
 test_row_count_mismatch_falls_back_rather_than_mispairing (clock_run)
 test_series_are_sorted_by_whichever_clock_is_in_use (clock_run)
 test_index_extent_covers_channels_on_both_clocks (clock_run, monkeypatch)
 test_throttle_paces_throughput ()
 test_throttle_disabled_is_passthrough ()

Variables

list BURSTY_DB = [1000.0, 1000.00004, 1000.00008, 1000.1, 1000.10004, 1000.10008]
list EVEN_SENSOR = [1000.0, 1000.01, 1000.02, 1000.1, 1000.11, 1000.12]

Detailed Description

Unit tests for the data-shaping logic (no elodin-db / real run needed).

Run: cd webviewer && .venv/bin/python -m pytest backend/test_series.py -q

Function Documentation

◆ _write()

◆ clock_run()

backend.test_series.clock_run ( tmp_path,
monkeypatch )
A one-entity run on disk, with both clocks. Caches cleared so each test's fixture
data is actually read (load_series/sensor_clock memoise on run id).

Definition at line 142 of file test_series.py.

◆ test_an_epoch_clock_is_not_shifted()

backend.test_series.test_an_epoch_clock_is_not_shifted ( clock_run)

Definition at line 224 of file test_series.py.

References _write().

◆ test_boot_relative_clock_is_reanchored_not_discarded()

backend.test_series.test_boot_relative_clock_is_reanchored_not_discarded ( clock_run)
The sequencer and heartbeat router stamp steady_clock — nanoseconds since boot,
not since 1970. Taken literally that lands them 56 years off; but the clock itself is
good, so it is shifted onto the epoch by the median write latency. That keeps their
precise relative timing instead of falling back to the jittery DB write time.

Definition at line 179 of file test_series.py.

References _write().

◆ test_classify_families_and_kinds()

backend.test_series.test_classify_families_and_kinds ( )

Definition at line 63 of file test_series.py.

◆ test_classify_labjack_t7()

backend.test_series.test_classify_labjack_t7 ( )

Definition at line 75 of file test_series.py.

◆ test_decimate_discrete_caps_pathological()

backend.test_series.test_decimate_discrete_caps_pathological ( )

Definition at line 41 of file test_series.py.

◆ test_decimate_discrete_keeps_only_transitions()

backend.test_series.test_decimate_discrete_keeps_only_transitions ( )

Definition at line 28 of file test_series.py.

◆ test_decimate_noop_when_small()

backend.test_series.test_decimate_noop_when_small ( )

Definition at line 49 of file test_series.py.

◆ test_decimate_preserves_spikes_and_bounds()

backend.test_series.test_decimate_preserves_spikes_and_bounds ( )

Definition at line 14 of file test_series.py.

◆ test_index_extent_covers_channels_on_both_clocks()

backend.test_series.test_index_extent_covers_channels_on_both_clocks ( clock_run,
monkeypatch )
The run extent is a union across entities, each on its own clock. Command and
heartbeat channels start at boot, ~3.7 s before the first sensor packet on a real
run; measuring only the sensor-clocked ones clipped the start of every one of them.

Definition at line 260 of file test_series.py.

References _write().

◆ test_missing_sibling_falls_back_to_db_time()

backend.test_series.test_missing_sibling_falls_back_to_db_time ( clock_run)

Definition at line 234 of file test_series.py.

References _write().

◆ test_reanchored_rows_never_land_after_their_own_db_write()

backend.test_series.test_reanchored_rows_never_land_after_their_own_db_write ( clock_run)
Write delay is one-sided — the DB cannot write a row before it was stamped — so the
offset estimate is the floor of the observed delays, and every re-anchored row must
end up at or before its own write time. A median estimate breaks this for about half
the rows, which then read as though the DB wrote them before they happened.

Definition at line 199 of file test_series.py.

References _write().

◆ test_reanchoring_a_single_row_degrades_to_the_db_time()

backend.test_series.test_reanchoring_a_single_row_degrades_to_the_db_time ( clock_run)

Definition at line 215 of file test_series.py.

References _write().

◆ test_row_count_mismatch_falls_back_rather_than_mispairing()

backend.test_series.test_row_count_mismatch_falls_back_rather_than_mispairing ( clock_run)

Definition at line 240 of file test_series.py.

References _write().

◆ test_sensor_clock_replaces_the_bursty_db_write_time()

backend.test_series.test_sensor_clock_replaces_the_bursty_db_write_time ( clock_run)

Definition at line 167 of file test_series.py.

References _write().

◆ test_series_are_sorted_by_whichever_clock_is_in_use()

backend.test_series.test_series_are_sorted_by_whichever_clock_is_in_use ( clock_run)

Definition at line 249 of file test_series.py.

References _write().

◆ test_slice_inclusive_bounds()

backend.test_series.test_slice_inclusive_bounds ( )

Definition at line 56 of file test_series.py.

◆ test_throttle_disabled_is_passthrough()

backend.test_series.test_throttle_disabled_is_passthrough ( )

Definition at line 291 of file test_series.py.

◆ test_throttle_paces_throughput()

backend.test_series.test_throttle_paces_throughput ( )

Definition at line 280 of file test_series.py.

◆ test_wide_csv_role_row_aligns_with_the_columns()

backend.test_series.test_wide_csv_role_row_aligns_with_the_columns ( monkeypatch,
tmp_path )
The second header row names what each column IS. The component name stays the
column key (every analysis script keys on it); the role rides
underneath, blank where the run's config names nothing.

Definition at line 112 of file test_series.py.

◆ test_wide_csv_union_and_ffill()

backend.test_series.test_wide_csv_union_and_ffill ( monkeypatch)

Definition at line 88 of file test_series.py.

References split().

Variable Documentation

◆ BURSTY_DB

list backend.test_series.BURSTY_DB = [1000.0, 1000.00004, 1000.00008, 1000.1, 1000.10004, 1000.10008]

Definition at line 163 of file test_series.py.

◆ EVEN_SENSOR

list backend.test_series.EVEN_SENSOR = [1000.0, 1000.01, 1000.02, 1000.1, 1000.11, 1000.12]

Definition at line 164 of file test_series.py.