NeuroMorphoCacheLayout#

class braincell.io.NeuroMorphoCacheLayout(root)[source]#

Pure path builder for the on-disk NeuroMorpho.Org cache layout.

Performs no I/O. Answers “where would file X for neuron N live if it existed”. Used by NeuroMorphoCache and testable in isolation.

Parameters:

root (Path) – Cache root directory. Need not exist; the layout is purely symbolic.

Examples

>>> layout = NeuroMorphoCacheLayout(Path("/tmp/nm"))
>>> layout.neuron_dir(10047)
PosixPath('/tmp/nm/10047')
>>> layout.metadata_path(10047)
PosixPath('/tmp/nm/10047/metadata.json')
metadata_path(neuron_id)[source]#

Return the path of metadata.json for neuron_id.

Return type:

Path

neuron_dir(neuron_id)[source]#

Return the per-neuron folder under root.

Return type:

Path

original_file_path(neuron_id, neuron_name, suffix)[source]#

Return the path of the original (Source-Version) file.

Parameters:
  • neuron_id (int)

  • neuron_name (str)

  • suffix (str) – File extension including the leading dot, e.g. ".asc".

Return type:

Path

standard_swc_path(neuron_id, neuron_name)[source]#

Return the path of the standardized SWC file.

Parameters:
  • neuron_id (int)

  • neuron_name (str) – The neuron name (used to derive the file stem).

Return type:

Path