.. _local_data_pickle_tut: Pickling -------- All neuron types including :class:`navis.NeuronList` can be pickled. If you don't know what that is: pickling is storing the actual Python object as a bytes stream. This is incredibly fast and works very well for short-term storage but has a few downsides: 1. Can only be re-opened in Python 2. Is (sort of) specific to the current version of ``navis`` - i.e. may not work with future versions of navis With that in mind, pickling is incredibly easy: .. code:: ipython3 import navis import pickle # Load some example neurons nl = navis.example_neurons(3, kind='mesh') # Pickle neurons to file with open('/Users/philipps/Downloads//meshes.pkl', 'wb') as f: pickle.dump(nl, f) .. code:: ipython3 # Read neurons back from pickle file with open('/Users/philipps/Downloads//meshes.pkl', 'rb') as f: nl = pickle.load(f) nl .. raw:: html <class 'navis.core.neuronlist.NeuronList'> containing 3 neurons (1.9MiB)
type name id units n_vertices n_faces
0 navis.MeshNeuron DA1_lPN_R 1734350788 8 nanometer 6309 13054
1 navis.MeshNeuron DA1_lPN_R 1734350908 8 nanometer 7098 14620
2 navis.MeshNeuron DA1_lPN_R 722817260 8 nanometer 6582 13772
Hopefully the above has given you some entry points on how to load and save your data. See also the :ref:`I/O API reference api_io>`.