MCPcopy
hub / github.com/mne-tools/mne-python / dir_tree_find

Function dir_tree_find

mne/_fiff/tree.py:11–39  ·  view source on GitHub ↗

Find nodes of the given kind from a directory tree structure. Parameters ---------- tree : dict Directory tree. kind : int Kind to find. Returns ------- nodes : list List of matching nodes.

(tree, kind)

Source from the content-addressed store, hash-verified

9
10
11def dir_tree_find(tree, kind):
12 """Find nodes of the given kind from a directory tree structure.
13
14 Parameters
15 ----------
16 tree : dict
17 Directory tree.
18 kind : int
19 Kind to find.
20
21 Returns
22 -------
23 nodes : list
24 List of matching nodes.
25 """
26 nodes = []
27
28 if isinstance(tree, list):
29 for t in tree:
30 nodes += dir_tree_find(t, kind)
31 else:
32 # Am I desirable myself?
33 if tree["block"] == kind:
34 nodes.append(tree)
35
36 # Search the subtrees
37 for child in tree["children"]:
38 nodes += dir_tree_find(child, kind)
39 return nodes
40
41
42@verbose

Callers 15

_read_one_epoch_fileFunction · 0.85
_read_bem_surfaces_fifFunction · 0.85
_read_bem_solution_fifFunction · 0.85
_read_morph_mapFunction · 0.85
_read_events_fifFunction · 0.85
_read_annotations_fifFunction · 0.85
_read_covFunction · 0.85
_get_aspectFunction · 0.85
_get_evoked_nodeFunction · 0.85
_read_evokedFunction · 0.85
_read_forward_meas_infoFunction · 0.85
read_forward_solutionFunction · 0.85

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected