Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cells read from swc files cannot be pickled #522

Closed
michaeldeistler opened this issue Nov 20, 2024 · 3 comments · Fixed by #525
Closed

Cells read from swc files cannot be pickled #522

michaeldeistler opened this issue Nov 20, 2024 · 3 comments · Fixed by #525
Assignees

Comments

@michaeldeistler
Copy link
Contributor

import jaxley as jx
import pickle

cell = jx.read_swc("tests/swc_files/morph_250.swc", ncomp=2)

with open("test.pkl", "wb") as handle:
    pickle.dump(cell, handle)

This must be because I made the _radius_generating_fn an attribute of cell, such that one can post-hoc run set_ncomp().

@michaeldeistler
Copy link
Contributor Author

A super quick fix (that does no longer allow calling set_ncomp() is to do:

cell = jx.read_swc("../../tests/swc_files/morph_250.swc", ncomp=2)
cell._radius_generating_fns = None

with open("test.pkl", "wb") as handle:
    pickle.dump(cell, handle)

@jnsbck
Copy link
Contributor

jnsbck commented Nov 20, 2024

oh damn. This should have been caught by tests/test_pickle. We should add another test_case here.

@jnsbck
Copy link
Contributor

jnsbck commented Nov 20, 2024

Can also make use the fixtures in conftest.py.

@jnsbck jnsbck self-assigned this Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants