add config defaults inheritance and startup validation#11
Open
jl33-ai wants to merge 2 commits into
Open
Conversation
lets you run the pipeline end to end without an acquisition rig. useful for smoke testing a fresh install, working on a laptop, and CI. - realtime_decoder/synthetic.py: SyntheticDataReceiver and SyntheticClient that match the surface of TrodesDataReceiver and TrodesClient. drop in replacements. non-blocking __next__ semantics so the polling loops in encoder/decoder/ripple work unchanged. - runscript.py picks the data source via config['datasource']. defaults to 'trodes' so every existing config keeps working. - config/demo_synthetic.yml is a 5 rank demo wired to the synthetic source. - README adds a 'running without acquisition hardware' section. spikes are poisson, marks gaussian, position walks a triangle wave along a single segment. not biologically realistic, the point is to exercise the data path and message plumbing. to try it: mpiexec -np 5 python -u runscript.py config/demo_synthetic.yml
most of the per-animal yamls duplicate the same sampling rates, ripple filter, gui colors, kinematics smoothing filter, mua, etc. drift is real and 'what is the canonical value of X' is currently unanswerable. - configs can declare `_extends: defaults.yml` and only override what is actually different. nested dicts deep merge key by key, lists and scalars replace. - config/defaults.yml holds the values stable across the SC*/fred/ginny configs. - runscript routes config loading through a new config_loader module that runs a small validator on the resolved dict. catches missing rank.supervisor, unknown algorithm, missing encoder.mark_dim, decoder ranks with no assignment, encoder.mark_dim != synthetic.mark_dim, etc. errors print one readable message and exit 2 before MPI workers spawn, instead of surfacing as IndexError deep in a rank. - config/demo_synthetic.yml now uses _extends, drops about 80 lines. - loader uses stdlib pyyaml instead of oyaml since python 3.7+ dicts preserve order. one fewer dep. backward compatible. verified all 16 existing per-animal configs still load and validate unchanged. follow up not in this PR: the SC*/fred/ginny configs can each be rewritten as _extends + overrides which would shrink them by roughly half. left as a separate diff so per-config behavior changes are auditable on their own.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
stacked on top of #10 (synthetic data source). until that one merges the diff here will include both commits. once #10 lands, GitHub will collapse this to just the config_loader / defaults.yml changes.
most of the per-animal yamls in `config/` duplicate the same sampling rates, ripple filter coefficients, gui colors, kinematics smoothing filter, mua thresholds, etc. drift across them is real and 'what is the canonical value of X' is currently unanswerable. this PR introduces a small loader so configs can share defaults.
configs can declare `_extends: defaults.yml` at the top and only override what is actually different. nested dicts deep merge key by key, lists and scalars replace (operator-intuitive: 'override X' means 'replace X').
`config/defaults.yml` holds the values that are stable across the SC* / fred / ginny configs.
`runscript.py` routes config loading through a new `realtime_decoder.config_loader` module that runs a small validator on the resolved config. catches things like:
errors print one readable message and exit cleanly with code 2 before MPI workers spawn, instead of surfacing as `IndexError` / `KeyError` deep inside a rank's main loop.
`config/demo_synthetic.yml` is rewritten as `_extends: defaults.yml` + overrides. drops about 80 lines.
loader uses stdlib pyyaml instead of oyaml. python 3.7+ dicts already preserve insertion order so the oyaml dep was load-bearing-by-accident only. one fewer install dep.
backward compatible: I ran the loader against all 16 existing per-animal configs and they all load and pass validation unchanged. configs without `_extends` behave exactly as before.
follow up not in this PR: the SC* / fred / ginny configs can each be rewritten as `_extends: defaults.yml` + only-the-overrides which would shrink them roughly in half. left as a separate diff so per-config behavior changes are auditable on their own.