Add ndtypes from ndx-pose, ndx-photometry, ndx-fiber-photometry - #1665
Add ndtypes from ndx-pose, ndx-photometry, ndx-fiber-photometry#1665rly wants to merge 28 commits into
Conversation
|
@satra pointed me to: I did not find a generic controlled vocabulary for techniques. Are you using https://github.com/BICCN/TMN/blob/main/templates/SPARC%20Modalities.csv ? |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1665 +/- ##
=======================================
Coverage 77.33% 77.33%
=======================================
Files 89 89
Lines 13325 13325
=======================================
Hits 10305 10305
Misses 3020 3020
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@rly - this is a lot less formal at this point. if you see the module list you will see how we were approaching the classification for that. the main thing this is being used for is the summary info in the dandiset and for the CLI to generate meaningful suffices when disambiguating. if you have suggestions for changes to the others, please make them. for example ndx-spectrum seems off, and incorrect. the modality field should be on alphabetical only without any dashes. i believe we did this by taking all the dandisets we had 4+ years ago and extending this list. |
| "PoseTraining": { | ||
| "module": "ndx-pose", | ||
| "neurodata_type": "PoseTraining", | ||
| "technique": "pose estimation technique", | ||
| "approach": "behavioral approach", |
There was a problem hiding this comment.
on a more general note, i'm a bit confused about why pose training is a data type, as that doesn't seem to reflect behavior per se, and also why it is a pose estimation technique.
some of these are direct measurement techniques or estimation techniques, but this one seems odd.
There was a problem hiding this comment.
PoseTraining is a group consisting of training frames and source videos. A training frame refers to a frame from a source video and an the locations of each node of 1 or more skeletons, often from human labeling. So PoseTraining isn't exactly a data type but indicative of the NWB file containing training data for pose estimation methods. Should I pick out a different data type to detect instead?
There was a problem hiding this comment.
we should consider data type as a broad umbrella of what data is generated from or used for (for example there is fourier analysis above). it could be associated with a "pose estimation training technique"
There was a problem hiding this comment.
got it. that makes sense
There was a problem hiding this comment.
@rly here we have 2 extensions listed to assist with importing https://github.com/dandi/dandi-cli/blob/HEAD/dandi/metadata/nwb.py#L99 -- should we also add extension information into this 'registry' and use it there too? or may be it is no longer even needed?
There was a problem hiding this comment.
so -- what was the verdict on this one -- remove this entirely or just adjust technique or ... ?
There was a problem hiding this comment.
@rly here we have 2 extensions listed to assist with importing
HEAD/dandi/metadata/nwb.py#L99 -- should we also add extension information into this 'registry' and use it there too? or may be it is no longer even needed?
That very limited registry is no longer needed, because not long after NWB 2 was released, the NWB APIs started caching the specs used, including extensions, by default in the file, which makes those files readable without external packages. I sampled from the 20 lowest-numbered dandisets and found only two that do not have cached schema: 000004 and 000019. Neither uses extensions. Other extensions in those dandisets (ndx-dandi-icephys, ndx-aibs-ecephys, ndx-mies, ndx-grayscalevolume, ndx-icephys-meta, ndx-spectrum, ndx-events) have the extension cached, so an extra import is not necessary.
I think we should remove the registry and loop there.
Also, ndx-hed and ndx-events can be removed from pyproject.toml. They should not be needed unless dandi-cli is using convenience functions from them.
There was a problem hiding this comment.
I adjusted the PoseTraining mapping "technique" to "pose estimation training technique". That's good to me.
yarikoptic
left a comment
There was a problem hiding this comment.
agreeing with @satra on avoiding - and also overall we should aim to make them shorter
Co-authored-by: Yaroslav Halchenko <debian@onerussian.com>
Co-authored-by: Yaroslav Halchenko <debian@onerussian.com>
Co-authored-by: Yaroslav Halchenko <debian@onerussian.com>
Co-authored-by: Yaroslav Halchenko <debian@onerussian.com>
|
It's probably worthwhile also to reindex all the neurodata types observed on DANDI and add those to the map, but this PR is a start and addresses the issue raised over Slack. |
|
there are errors from docker compose but also smth which is relevant to this PR to be addressed re @rly's
do we have enough extracted in @magland's lindi's to just grep through them? |
|
From https://neurosift.app/dandi > "Neurodata Types Search", you can see a dropdown menu of all of the parsed neurodata types. That is populated from parsing https://lindi.neurosift.org/dandi/neurodata_types_index.json.gz Generated by https://github.com/magland/neurosift-kerchunker/blob/main/workflow_scripts/create_neurodata_types_index.py I believe these come from the first 100 assets of each dandiset, only from dandisets where at least one of the first 20 assets is NWB, and only if LINDI files have been generated for the NWB files (and other edge case handling). |
|
I'll try having an AI generate the name {
"module": x,
"neurodata_type": x,
"technique": x,
"approach" x
}mappings tomorrow and see how it goes. |
|
I added a new neurodata_type_map.py file with a more complete mapping of neurodata types (as detected by neurosift, as described above). Before I integrate it, update tests, etc., please take a look and let me know what you think. It should probably be its own file because it's so big. Should it be a python dictionary? JSON? Also, what is the difference between the key and the value of "neurodata_type"? |
Added new neurodata types for image series and eye tracking metadata while removing deprecated types.
yarikoptic
left a comment
There was a problem hiding this comment.
dandi/metadata/neurodata_typemap.py seems ot be note used, then what is it for?
type checking seems to fail.
I will move it to draft for now, but I would love for us to finalize and merge this notable improvement!!
|
@rly with an interest in physio recordings and thus potentially in https://github.com/BCM-Neurosurgery/ndx-wearables I would like to bring this over the finish line. Worse comes to worse we should do that while on @bendichter's couch in the booth at SfN! |
|
I would like to help bring this over the finish line, and I think the way to do that is to land the asset metadata mapping first and split the filename suffix work into a follow-up. Some observations from looking at the current state of the PR and at what is deployed on the archive. On why the metadata half matters on its own: I scanned the On scope: nothing in the codebase currently reads the On the semicolon-joined terms: On the photometry approach term: On the new The one failing test looks like the map and the test expectation simply have @rly happy to push these changes to this branch if that would help. |
|
I implemented the above in a PR against this branch: rly#1. It switches the photometry entries to "fiber photometry approach" / "fiber photometry technique" as plain single terms (with single terms per type, no change to the map structure or to dandischema is needed), adds the table and device types from both photometry extensions, and drops the unused neurodata_typemap.py for now. @rly if you merge it into add_ndtypes it will show up here. |
Use "fiber photometry approach" and "fiber photometry technique" for the photometry types. Semicolon-joined strings like "fiber photometry technique; optical technique" would become a single unfacetable term, and "calcium imaging" is inaccurate for the many photometry datasets using dLight or GRAB sensors to measure neurotransmitters rather than calcium. Add the metadata table types from the deprecated ndx-photometry and the container, table, and device types from ndx-fiber-photometry so files carrying only those are still marked. Drop the unused dandi/metadata/neurodata_typemap.py for now; the expanded map can be reintroduced when it is wired into the code. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wuywpnnb3Q57q6oeMZ4God
Use clean fiber photometry terms; add photometry table and device types
|
Yes, let's get this over the finish line! 🏁 Thanks @bendichter for suggesting we drop the much bigger refactor of the mapping of neurodata types, which requires larger discussion and agreement. Let's focus on getting these extension data types in and correcting longstanding issues. I reverted the changes to the We'll fix up Updated PR summary
|
OpticalFiber, ExcitationSource, Photodetector, and Indicator are defined by ndx-ophys-devices, which ndx-microscopy and ndx-optogenetics also import. get_neurodata_types reads the raw HDF5 neurodata_type attribute and drops the namespace, so keying the map on those names tagged two-photon and optogenetics assets as fiber photometry. Drop them and cover the remaining names that only the photometry extensions define: CommandedVoltageSeries, DeconvolvedFiberPhotometryResponseSeries, MultiCommandedVoltage, FiberPhotometryIndicators, FiberPhotometryViruses, and FiberPhotometryVirusInjections. FiberPhotometry is defined by both extensions, so group it with FiberPhotometryResponseSeries. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Entries in neurodata_typemap declare what their type implies on its own, without relying on other types being present in the same file: CurrentClampStimulusSeries carries the clamp technique alongside CurrentClampSeries, and eight behavior types each carry the behavioral technique. process_ndtypes collects into a set, so the overlap costs nothing. FibersTable and FiberPhotometryTable hold stereotactic implant coordinates, and OptogeneticStimulusSite describes an implanted stimulation site, so all three take "surgical technique" as ElectrodeGroup does. CommandedVoltageSeries and MultiCommandedVoltage drive the excitation source, so they take "fiber photometry technique" as the response series does. The Units and Spectrum module values return to their master values. Nothing reads Neurodatum["module"], and filename suffixes come from get_neurodata_types_to_modalities_map, so changing them belongs with the work that gives the field meaning. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
In response to a Slack thread, this PR adds mappings for some neurodata types from ndx-pose, ndx-photometry (deprecated), and ndx-fiber-photometry. I wasn't sure whether there would be issues with the same neurodata type name from two different modules being mapped. I also made up the approaches and techniques...
It also fixes the casing of "OptogeneticStimulusSIte" -> OptogeneticStimulusSite"