Repository navigation
ndi.app.oridirtuning is a framework: all five compute methods raise NotImplementedError #134
Description
Part of #90 (PR #61 catch-up), recovered by the triage correction — #90 had recorded this as "already present at the fork point", which it is not.
State on main
src/ndi/app/oridirtuning.py is 198 lines and byte-identical to its version at the fork point ed78f8b — it has never been touched:
$ a=$(git show ed78f8b:src/ndi/app/oridirtuning.py | git hash-object --stdin)
$ b=$(git show origin/main:src/ndi/app/oridirtuning.py | git hash-object --stdin)
$ [ "$a" = "$b" ] && echo IDENTICAL
IDENTICAL
Five methods raise NotImplementedError:
| method | MATLAB source |
|---|---|
calculate_all_tuning_curves |
+ndi/+app/oridirtuning.m:31 |
calculate_tuning_curve |
oridirtuning.m:52 |
calculate_all_oridir_indexes |
oridirtuning.m:82 |
calculate_oridir_indexes |
oridirtuning.m:109 |
plot_oridir_response |
oridirtuning.m:244 |
is_oridir_stimulus_response, struct2doc, find_appdoc and isvalid_appdoc_struct are implemented. MATLAB also has doc2struct (oridirtuning.m:361) and appdoc_description (:378), which the Python skeleton omits entirely.
Why it is worth doing now
ndi.app.stimulus.tuning_response — the layer directly beneath this one — is implemented in #124, so the pipeline now runs as far as tuning curves. oridirtuning is the step that turns those curves into orientation and direction indices, which is what most callers actually want. It is the last gap between "responses computed" and "a result a user reads".
What the implementation involves
catchup/ndi-python-2026-08 has it at 1155 lines. Two families of index:
- Vector indices (OSI/DSI from the circular-variance style computation) — self-contained.
- FIT indices — a double-gaussian fit mirroring vlt's
otfit_carandiniplus thefit2fit*family, producingdouble_gaussian_parametersanddouble_gaussian_fit_angles.
The fit half is the real work, and it is the part to check against the toolbox before starting: as with stimulus_response_scalar in #124 (→ VH-Lab/vhlab-toolbox-python#24), the vlt functions may need porting or fixing first. Do that survey before estimating this, and file against vhlab-toolbox-python whatever is missing rather than reimplementing it here — tuning_response in #124 established the pattern of importing the math from vlt rather than duplicating it.
Notes
- The branch's version is a starting point, not a merge candidate: it predates the DID file-services rewrite and the
ndi.fun.utils.identifierconvention. Port ndi.gui.app.stimulusResponse and the whole stimulus pipeline behind it #124's experience is thatelement.id()vsidentifier(element)is aTypeErrorwaiting for real data (13 call sites there); the same trap applies here. - The bridge contract
src/ndi/app/ndi_matlab_python_bridge.yamlneeds an INTERFACE UPDATE withmatlab_last_sync_hashwhen this lands. - Related: this app's documents are
oridirtuning-typed appdocs; checkndi_commoncarries the document/schema pair before starting (cf. ndi_common re-sync from NDI-matlab: probe-geometry library, missing document/schema pairs, and the probe_geometry matrix invariant #96).
Activity
Implement the oridirtuning index half; depend on vhlab-library-python