braincell.io.load_neuromorpho#
- braincell.io.load_neuromorpho(neuron_id, *, cache_dir=None, mode='neuromorpho', client=None, return_report=False, overwrite=False)[source]#
Fetch a NeuroMorpho.Org neuron and return it as a
Morphology.Downloads the standardized CNG SWC into
cache_dir(defaulting to~/.cache/braincell/neuromorpho) and parses it withMorphology.from_swc()usingmode="neuromorpho".Already-cached neurons are not re-downloaded; pass
overwrite=Trueto force a refresh.- Parameters:
neuron_id (
int) – NeuroMorpho.Org numeric identifier (e.g.10047).cache_dir (
str|Path|None) – Cache root.Noneresolves toDEFAULT_USER_CACHE_DIR(~/.cache/braincell/neuromorpho). The directory is created lazily.mode (
str|None) – SWC import mode forwarded toMorphology.from_swc(). Defaults to"neuromorpho"(copies soma attachment points into child branches).client (
NeuroMorphoClient|None) – Optional pre-configured client.return_report (
bool) – IfTrue, also return theSwcReportfrom parsing.overwrite (
bool) – IfTrue, re-download even when the file is already cached.
- Returns:
The parsed morphology, optionally with a diagnostic report.
- Return type:
- Raises:
NeuroMorphoNotFoundError – If
neuron_iddoes not exist upstream.NeuroMorphoHTTPError – On non-recoverable HTTP errors.
FileNotFoundError – If the standardized SWC file cannot be located after download (should not happen in practice).
See also
fetch_neuromorphoDownload files without parsing.
Morphology.from_neuromorphoEquivalent classmethod entry point.
Morphology.from_swcUnderlying SWC reader.
Examples
>>> from braincell import load_neuromorpho >>> morph = load_neuromorpho(10047) >>> morph, report = load_neuromorpho(10047, return_report=True)