Repository navigation
Add validation workflow orchestration for MEModel - #957
Conversation
…me to TestResult - Strip WorkflowContext to generic fields, add MEModelWorkflowContext subclass - Rename ValidationOutcome to TestResult for clarity alongside ValidationResult - Rename outcomes parameter to test_results for consistency
- Add depolarization_block, rebound_burst, and tonic_firing presets (rebound_burst and tonic_firing compute Rin-based currents for thalamic cells) - Add tests.py with ValidationTest subclasses that don't fit the composable pattern: Hyperpolarization, Rin, AIS spiking, BPAP, IV curve, FI curve - tonic_firing_preset reuses the spiking validation name as the thalamic variant
Matches the renamed bluecellulab SequenceProtocol API (absolute_amplitudes bool -> amplitude_mode Literal).
darshanmandge
left a comment
There was a problem hiding this comment.
The framework looks good and fits the BlueCelluLab framework. I have put some items to change/verify.
Also:
bluecellulab>=2.6.99doesn't include the validation framework. The pin needs
bumping to the release that ships PR #90, so this can't merge before that.MEModelValidationTaskisn't registered inTASK_MAPor the unions, so it can't be
launched as a task yet. Is that a planned follow-up?register_outcomesturns every failure intoentity_id=None, and
ValidationTask.executedoesn't surface that. A run where every registration
fails still finishes without an error.- De-duplication matches on the validation name only. If the default profile and then the
thalamic profile run on the same entity, the second "Spiking Validation" is silently skipped
even though its protocol is different, unlessoverwrite_existing=True. Worth documenting.
Add TaskType.memodel_validation, its TASK_MAP entry, and include MEModelValidationTask in TasksUnion so the validation workflow can be launched as a task.
Raise ValidationRegistrationError from ValidationTask.execute when any ValidationResult fails to register, so a run where every registration fails no longer finishes silently. Log skipped (already-existing) results explicitly, and document that de-duplication matches on validation name and entity only (one verdict per model).
DownloadedMEModel exposes a single morphology_path (Path), not a morphology_paths list. Read the field directly via a _select_morphology_path helper that raises InvalidValidationContextError when the downloaded morphology file is missing, instead of crashing with AttributeError.
….4 nA Thalamic tonic firing and depolarization block pre-hold the cell at -60 mV, then inject a 0.4 nA (400 pA) step, matching the source ephys protocol (Hartley et al., Cell Reports 2024, Fig 2O-R). The holding current to reach -60 mV is derived per model via bluecellulab's search_hyp_current. Rheobase is recomputed at the HOC conditions for percentage-scaled step protocols. The default (non-thalamic) presets are unchanged. Adds tests for the morphology path, the derived holding current, the thalamic depol-block preset, and the rheobase recomputation.
…on names Shorten the ValidationName vocabulary (e.g. 'Spiking Validation' instead of 'Simulatable Neuron Spiking Validation'). ION_CHANNEL_MODEL_BUILD is unchanged.
entitysdk latest (0.19.34) renamed DownloadedMEModel.morphology_path to morphology_paths (list[Path]); read the first entry. Requires bumping the entitysdk lock to latest. Guard test asserts the field is morphology_paths.
…submodules Bump the entitysdk and bluecellulab pins to the latest releases (which ship the validation framework) and relock. Published bluecellulab no longer re-exports the validation classes from the package root, so import them from their submodules (bluecellulab.validation.measurement / .criterion / .protocol / .parametric_validation).
morphology_paths stages every format the entity carries (asc, swc, h5). The HOC loads .asc or .swc, so pick by suffix instead of taking the first entry, which was only accidentally correct.
|
Thanks for the review — addressed the items:
|
The thalamic tonic-firing step is now configurable via tonic_step_current (default 0.4 nA, the paper's 400 pA for Ecel1 to avoid depolarization block). Spp and Spp_runaway have higher input resistance and use ~0.8 nA to show sustained tonic firing rather than an initial rebound burst. Also corrects stale -65 mV references in the thalamic hold comments to the -60 mV the profile actually targets (verified: derived holding current reaches -60 mV at the soma).
…mic pre-held tests The tonic-firing and depolarization-block presets previously baked a separately derived holding current into their phase amplitudes (add_hypamp=False). The derivation searched steady-state voltage with a too-short settle window, which undershot for high-Rin thalamic cells and gave an unreliable hold. Use the model's calibrated holding current (emodel_properties.holding_current) applied via add_hypamp=True instead: the presets now carry only the step on top of that baseline. build_tests raises if the calibrated hold is zero/missing, so a model with an unpopulated calibration fails loudly rather than validating at its bare resting potential. Removes _derive_profile_holding_current and the context holding_current field. Verified on the three thalamic TRN models (Spp_runaway, Spp, Ecel): the calibrated hold settles the cell at ~-65 mV quietly, then the step produces sustained tonic firing; 8/9 tests pass (AIS the accepted structural fail).
|
On the codecov patch coverage: I have added unit tests for the parts with real logic, the profiles (guards + The remaining gap is almost all in |
|
@ilkilic I don't think the new tests are running in CI, which would explain why Codecov still shows 30.2% patch coverage on the head commit (
This probably started with the lib/app CI split in #1183. Could you move both test files into Once they run in CI we can see what is actually left uncovered. Other files have gaps too, e.g. |
|
Good catch, that was it. Moved both files into tests/obi_one/scientific/validations/ (pushed). Patch coverage is now 68%! |
|
Pushed more tests, profiles is now 94% and registration 90%, so patch coverage is up again. |
|
Correcting my earlier comment, I was too pessimistic about setup(). Added tests that mock the client and patch the Cell/rheobase/Rin calls so workflow.py is now 82% and the validation subsystem ~88%. The remaining uncovered part is the live NEURON calls. |
darshanmandge
left a comment
There was a problem hiding this comment.
LGTM. Thanks @ilkilic !
Summary
Introduces the validation workflow architecture in OBI-One, with MEModel validation as the first implementation. This provides entity-agnostic workflow orchestration, MEModel-specific validation profiles, and
ValidationResultregistration with persisted-result handling and asset upload.Motivation
Validation execution was previously handled by BlueNaaS as a thin orchestration layer calling BlueCelluLab's hardcoded
run_validations(). As we move away from BlueNaaS, OBI-One takes ownership of:ValidationResultregistration and asset uploadThe workflow is decoupled from the execution backend and uses BlueCelluLab's composable validation framework for protocol, measurement, and criterion handling.
What's added
Architecture
Usage
From a standalone process or OBI-One Task
From a notebook
Profiles
-60 mVand uses a0.4 nA(400 pA) tonic-firing step, matching the source ephys protocol (Hartley et al., Cell Reports 2024, Fig. 2O-R).500 mshyperpolarization phase.30.0and supports model-specific holding-current overrides.Key Behaviors
AssetLabel.validation_result_figure; validation details are uploaded as text usingAssetLabel.validation_result_details.Dependencies
Requires BlueCelluLab with the composable parametric validation framework:
BlueCelluLab validation framework PR