← Về thư mục
tests/neuropixels-analysis/test_scripts.py
- metrics_table · function · L62-L65 — def metrics_table(*units: dict) -> pd.DataFrame
- CurationLabelTests · class · L68-L158 — class CurationLabelTests(unittest.TestCase)
- label · method · L71-L72 — def label(self, method: str, **overrides) -> str
- test_an_exemplary_unit_is_good_under_every_preset · method · L74-L79 — def test_an_exemplary_unit_is_good_under_every_preset(self) -> None: # The permissive direction: a validator that rejected this unit would # reject every real single unit too.
- test_low_snr_is_noise_whatever_else_the_unit_scores · method · L81-L87 — def test_low_snr_is_noise_whatever_else_the_unit_scores(self) -> None: # The noise gate runs before the presets and short-circuits, so a unit # with perfect refractory behaviour and no amplitude clipping is still # noise if there is no signal to speak of.
- test_the_noise_threshold_excludes_its_own_boundary · method · L89-L92 — def test_the_noise_threshold_excludes_its_own_boundary(self) -> None: #
row['snr'] < 1.5, so exactly 1.5 is not noise.
- test_allen_tolerates_refractory_violations_that_ibl_calls_multi_unit · method · L94-L98 — def test_allen_tolerates_refractory_violations_that_ibl_calls_multi_unit(self) -> None: # This is the documented difference between the two standards: Allen # accepts isi_violations_ratio < 0.5, IBL only < 0.1.
- test_the_allen_refractory_boundary_is_strict_on_both_sides · method · L100-L105 — def test_the_allen_refractory_boundary_is_strict_on_both_sides(self) -> None
- test_presence_ratio_is_a_strict_minimum · method · L107-L111 — def test_presence_ratio_is_a_strict_minimum(self) -> None: #
presence_ratio > 0.9: a unit present for exactly 90% of the # recording is not automatically good.
- test_amplitude_clipping_downgrades_without_calling_the_unit_multi_unit · method · L113-L117 — def test_amplitude_clipping_downgrades_without_calling_the_unit_multi_unit(self) -> None: # A truncated amplitude distribution means missed spikes, which is a # completeness problem, not contamination -- so it must not be labelled # 'mua' when the refractory period is clean.
- test_ibl_additionally_requires_a_minimum_firing_rate · method · L119-L124 — def test_ibl_additionally_requires_a_minimum_firing_rate(self) -> None: # A unit that fires a handful of times cannot support a rate estimate.
- test_strict_demands_high_snr_and_a_nearly_clean_refractory_period · method · L126-L131 — def test_strict_demands_high_snr_and_a_nearly_clean_refractory_period(self) -> None
- test_every_unit_gets_exactly_one_label · method · L133-L146 — def test_every_unit_gets_exactly_one_label(self) -> None: # A unit missing from the returned mapping disappears from the export # rather than being reported as rejected.
- test_an_unknown_method_raises_instead_of_dropping_units · method · L148-L154 — def test_an_unknown_method_raises_instead_of_dropping_units(self) -> None: # Silently returning a partial mapping would make export_results() # report zero good units from a perfectly good sorting.
- test_an_empty_metrics_table_yields_no_labels · method · L156-L158 — def test_an_empty_metrics_table_yields_no_labels(self) -> None
- CurationCriteriaTests · class · L161-L232 — class CurationCriteriaTests(unittest.TestCase)
- test_the_presets_are_the_three_the_cli_offers · method · L164-L165 — def test_the_presets_are_the_three_the_cli_offers(self) -> None
- test_every_preset_carries_the_same_criteria · method · L167-L174 — def test_every_preset_carries_the_same_criteria(self) -> None: # The curation loop reads each threshold with
criteria.get(name), so a # renamed or missing key silently disables that criterion instead of # failing loudly.
- test_no_threshold_is_zero_or_none · method · L176-L183 — def test_no_threshold_is_zero_or_none(self) -> None: # Same truthiness trap:
if criteria.get('snr') treats 0.0 and None as # "no threshold set", so a legitimate-looking 0 would be ignored.
- test_the_allen_thresholds_are_the_documented_visual_coding_ones · method · L185-L189 — def test_the_allen_thresholds_are_the_documented_visual_coding_ones(self) -> None
- test_the_ibl_thresholds_are_the_documented_reproducible_ephys_ones · method · L191-L195 — def test_the_ibl_thresholds_are_the_documented_reproducible_ephys_ones(self) -> None
- test_the_presets_are_ordered_from_permissive_to_strict · method · L197-L215 — def test_the_presets_are_ordered_from_permissive_to_strict(self) -> None: # snr and presence_ratio are minima, so stricter means larger; the other # two are maxima, so stricter means smaller. Swapping two presets' names # -- the kind of edit that looks harmless -- breaks this ordering.
- test_the_two_scripts_agree_on_which_standard_is_stricter · method · L217-L232 — def test_the_two_scripts_agree_on_which_standard_is_stricter(self) -> None: # neuropixels_pipeline.curate_units hardcodes its refractory thresholds # rather than reading this table, so they can drift apart. Prove the # relationship holds in both: a unit Allen calls good, IBL calls mua.
- SorterDefaultTests · class · L235-L264 — class SorterDefaultTests(unittest.TestCase)
- test_the_presets_match_the_sorters_the_cli_offers · method · L236-L240 — def test_the_presets_match_the_sorters_the_cli_offers(self) -> None
- test_every_sorter_that_can_preprocess_has_it_switched_off · method · L242-L250 — def test_every_sorter_that_can_preprocess_has_it_switched_off(self) -> None: # run_sorting.py consumes an already filtered, referenced, bad-channel # removed recording. Letting a sorter filter or re-reference it a second # time distorts the waveforms it then tries to cluster.
- test_the_kilosort4_thresholds_are_positive_spike_amplitudes · method · L252-L259 — def test_the_kilosort4_thresholds_are_positive_spike_amplitudes(self) -> None
- test_an_unlisted_sorter_gets_no_parameters_rather_than_a_wrong_set · method · L261-L264 — def test_an_unlisted_sorter_gets_no_parameters_rather_than_a_wrong_set(self) -> None: #
SORTER_DEFAULTS.get(sorter, {}) -- a sorter with no entry must fall # back to that sorter's own upstream defaults, never to another one's.
- TracePlotTests · class · L267-L312 — class TracePlotTests(unittest.TestCase)
- setUpClass · method · L271-L274 — def setUpClass(cls) -> None
- setUp · method · L276-L280 — def setUp(self) -> None
- recording · method · L282-L285 — def recording(self, channels: int)
- drawn_lines · method · L287-L294 — def drawn_lines(self, channels: int) -> int
- test_a_wide_probe_is_subsampled_to_twenty_traces · method · L296-L297 — def test_a_wide_probe_is_subsampled_to_twenty_traces(self) -> None
- test_a_narrow_probe_draws_every_channel_it_has · method · L299-L302 — def test_a_narrow_probe_draws_every_channel_it_has(self) -> None: # min(20, n) -- with fewer than 20 channels nothing is dropped, and the # linspace must not produce duplicate indices.
- test_the_time_axis_covers_the_requested_duration · method · L304-L312 — def test_the_time_axis_covers_the_requested_duration(self) -> None