Comments (7)
That's a remarkably weird bug
from neurolib.
What's the bug about?
from neurolib.
remember dpath
library? it's the thing that allows searching in dict keys with star notation (e.g. *tau
).. so when a numpy array which dtype is int is a value inside the dictionary, it fails... actually I guess that is the bug in the dpath
library... however, it's very easy to overcome this by forcing all numpy arrays (so connectivity and delay matrices) to float (and they typically float)...
from neurolib.
when a numpy array which dtype is int is a value inside the dictionary, it fails... actually I guess that is the bug in the dpath library.
It seems weird that it depends on the value inside the array. Force-converting user-defined values is the most elegant solution but I guess it works until it doesn't :))
Can you post / reproduce the error?
from neurolib.
setup:
from dpath.util import search
import numpy as np
dct = {"aln.t.a": 12.0, "aln.t.b": 32., "aln.conn": np.array([[1, 1]])}
# first arg is to search where, second is what to search (using star notation), third is the separator in keys (dot by default)
list(search(dct, "*a", "."))
leads to:
AttributeError Traceback (most recent call last)
~/.virtualenvs/thalctx/lib/python3.7/site-packages/dpath/segments.py in kvs(node)
13 try:
---> 14 return iter(node.items())
15 except AttributeError:
AttributeError: 'numpy.int64' object has no attribute 'items'
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
<ipython-input-8-578683b23f73> in <module>
----> 1 list(search(dct, "*a", "."))
~/.virtualenvs/thalctx/lib/python3.7/site-packages/dpath/util.py in yielder()
219 if yielded:
220 def yielder():
--> 221 for segments, found in dpath.segments.walk(obj):
222 if keeper(segments, found):
223 yield (separator.join(map(dpath.segments.int_str, segments)), found)
~/.virtualenvs/thalctx/lib/python3.7/site-packages/dpath/segments.py in walk(obj, location)
60 yield ((location + (k,)), v)
61 for k, v in kvs(obj):
---> 62 for found in walk(v, location + (k,)):
63 yield found
64
~/.virtualenvs/thalctx/lib/python3.7/site-packages/dpath/segments.py in walk(obj, location)
60 yield ((location + (k,)), v)
61 for k, v in kvs(obj):
---> 62 for found in walk(v, location + (k,)):
63 yield found
64
~/.virtualenvs/thalctx/lib/python3.7/site-packages/dpath/segments.py in walk(obj, location)
60 yield ((location + (k,)), v)
61 for k, v in kvs(obj):
---> 62 for found in walk(v, location + (k,)):
63 yield found
64
~/.virtualenvs/thalctx/lib/python3.7/site-packages/dpath/segments.py in walk(obj, location)
46 '''
47 if not leaf(obj):
---> 48 for k, v in kvs(obj):
49 length = None
50
~/.virtualenvs/thalctx/lib/python3.7/site-packages/dpath/segments.py in kvs(node)
14 return iter(node.items())
15 except AttributeError:
---> 16 return zip(range(len(node)), node)
17
18
TypeError: object of type 'numpy.int64' has no len()
however:
# note floats inside np.array
dct = {"aln.t.a": 12.0, "aln.t.b": 32., "aln.conn": np.array([[1.0, 1.0]])}
list(search(dct, "*a", "."))
leads to correct result
[('aln.t.a', 12.0)]
from neurolib.
one of the weirdest I ever encountered!
from neurolib.
it's deep inside dpath
and relates to how dpath
create segments
(which is one of the building blocks of the whole machinery)
from neurolib.
Related Issues (20)
- Citation HOT 1
- Better error catching in exploration
- There are 0 valid individuals Mean score across population: nan HOT 7
- If set explicitly, local connectivity weights for ALNNode change after running the model HOT 3
- Try to make MultiModel faster HOT 1
- Neurolib satellite tutorial session at CNS*2022 HOT 20
- Testing: test_models with dynamic loading HOT 1
- TypeError: <class 'numpy.typing._dtype_like._SupportsDType'> is not a generic class HOT 3
- Help Using Neurolib: Finding an easy way to load new data for the model implementation HOT 1
- Question about the animation HOT 1
- Parameter exploration bug: PicklingError HOT 5
- Cmat is the same in two model instances, but models themselves are not HOT 1
- WW model is missing in example and test
- Documentation pipeline fails HOT 1
- model parameters and stimulation
- Parameters provided in examples (and default parameters) does not perform BOLD simulation correctly HOT 1
- Possible deprecation issues in the example file of multimodel_custom_model HOT 1
- Example files appear to be broken
- how to use EEG data with neurolib?
- Wong Wang working example to produce FCD matrix
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from neurolib.