navis-org / pymaid

Python library to interface with CATMAID servers. Fully interoperable with navis.
https://pymaid.readthedocs.io/en/latest/
GNU General Public License v3.0
24 stars 11 forks source link

get_connectors raises AttributeError when there are no synapses of requested relation_type #213

Closed kuanawanda closed 3 years ago

kuanawanda commented 3 years ago

I've come across this error in ver 2.0.4 but I think it wasn't a problem in earlier versions (not sure which one, sorry). I also tried updating to the version on github.

I was able to reproduce the issue on the public fafb instatnce. Thanks!

import pymaid print(pymaid.version) rm = pymaid.CatmaidInstance(server='https://fafb.catmaid.virtualflybrain.org/', api_token=None) conn=pymaid.get_connectors(12240258) # This runs conn=pymaid.get_connectors(12240258,relation_type='presynaptic_to') # This runs conn=pymaid.get_connectors(12240258,relation_type='postsynaptic_to') # This raises error

Traceback (most recent call last): File "/Users/akuan/repos/ppc_project_analysis/tracing_analysis/test.py", line 6, in conn=pymaid.get_connectors(12240258,relation_type='postsynaptic_to') # This raises error File "/Users/akuan/ppc_env/lib/python3.7/site-packages/pymaid/cache.py", line 316, in wrapper res = function(*args, **kwargs) File "/Users/akuan/ppc_env/lib/python3.7/site-packages/pymaid/fetch.py", line 1227, in get_connectors 'edition_time']) File "/Users/akuan/ppc_env/lib/python3.7/site-packages/pandas/core/frame.py", line 490, in init mgr = init_dict({}, index, columns, dtype=dtype) File "/Users/akuan/ppc_env/lib/python3.7/site-packages/pandas/core/internals/construction.py", line 239, in init_dict val = construct_1d_arraylike_from_scalar(np.nan, len(index), nan_dtype) File "/Users/akuan/ppc_env/lib/python3.7/site-packages/pandas/core/dtypes/cast.py", line 1449, in construct_1d_arraylike_from_scalar dtype = dtype.dtype AttributeError: type object 'object' has no attribute 'dtype'

kuanawanda commented 3 years ago

Ugh, sorry, I think i just figured it out. Looks like its an incompatibility with pandas ver. 1.0.1. Upgrading to pandas 1.2.4 seemed to fix the issue.