File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ from pathlib import Path
2+ import yaml
3+
4+
5+ def _load_entities_order ():
6+ # we carry the copy of the schema
7+ schema_p = Path (__file__ ).parent / "data" / "schema"
8+ with (schema_p / "objects" / "entities.yaml" ).open () as f :
9+ entities = yaml .load (f )
10+
11+ with (schema_p / "rules" / "entities.yaml" ).open () as f :
12+ entities_full_order = yaml .load (f )
13+
14+ # map from full name to short "entity"
15+ return [entities [e ]["entity" ] for e in entities_full_order ]
16+
17+
18+ class BIDSFile :
19+ """ as defined in https://bids-specification.readthedocs.io/en/stable/99-appendices/04-entity-table.html
20+ which might soon become machine readable
21+ order matters
22+ """
23+
24+ _known_entities = _load_entities_order ()
25+
26+
27+ # TEMP: just for now, could be moved/removed
28+ def test_BIDSFile ():
29+ assert BIDSFile ._known_entities [:2 ] == ['sub' , 'ses' ]
30+ print (BIDSFile ._known_entities )
You can’t perform that action at this time.
0 commit comments