navis.write_parquet¶
- navis.write_parquet(x, filepath, write_meta=True)[source]¶
Write TreeNeuron(s) or Dotprops to parquet file.
See here for format specifications.
- Parameters:
x (TreeNeuron | Dotprop | NeuronList thereof) – Neuron(s) to save. If NeuronList must contain either only TreeNeurons or only Dotprops.
filepath (str | pathlib.Path) – Destination for the file.
write_meta (bool | list of str) – Whether to also write neuron properties to file. By default this is .name, .units and .soma. You can change which properties are written by providing them as list of strings.
See also
navis.read_parquet()
Import skeleton from parquet file.
navis.scan_parquet()
Scan parquet file for its contents.
Examples
Save a bunch of skeletons:
>>> import navis >>> nl = navis.example_neurons(3, kind='skeleton') >>> navis.write_parquet(nl, tmp_dir / 'skeletons.parquet')
Inspect that file’s content
>>> import navis >>> contents = navis.scan_parquet(tmp_dir / 'skeletons.parquet') >>> contents id units name soma 0 722817260 8 nanometer DA1_lPN_R NaN 1 1734350908 8 nanometer DA1_lPN_R [6] 2 1734350788 8 nanometer DA1_lPN_R [4177]
Read the skeletons back in
>>> import navis >>> nl = navis.read_parquet(tmp_dir / 'skeletons.parquet') >>> len(nl) 3