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

Chunk eq errors when comparing objects to it #664

Open
Helveg opened this issue Dec 12, 2022 · 0 comments
Open

Chunk eq errors when comparing objects to it #664

Helveg opened this issue Dec 12, 2022 · 0 comments

Comments

@Helveg
Copy link
Contributor

Helveg commented Dec 12, 2022

When eq'ed against a hemitype node:

Traceback (most recent call last):
  File "/mnt/d/GIT/bsb/tests/test_placement.py", line 193, in test_notparallel_cs_job
    pool.execute()
  File "/mnt/d/GIT/bsb/bsb/services/pool.py", line 288, in execute
    job.execute(self.owner, job.f, job._args, job._kwargs)
  File "/mnt/d/GIT/bsb/bsb/services/pool.py", line 184, in execute
    return f(connectivity, *collections, **kwargs)
  File "/mnt/d/GIT/bsb/tests/test_placement.py", line 180, in connect
    test.assertEqual(Chunk([0, 0, 0], None), chunk)
  File "/home/robin/.pyenv/versions/3.9.1/lib/python3.9/unittest/case.py", line 831, in assertEqual
    assertion_func(first, second, msg=msg)
  File "/home/robin/.pyenv/versions/3.9.1/lib/python3.9/unittest/case.py", line 821, in _baseAssertEqual
    if not first == second:
  File "/mnt/d/GIT/bsb/bsb/storage/_chunks.py", line 31, in __eq__
    other_id = np.array(other, copy=False).view(Chunk)._safe_id()
  File "/mnt/d/GIT/bsb/bsb/connectivity/strategy.py", line 37, in __getattr__
    return self.placement[attr]
KeyError: '__array_struct__'

when eq'ed against a ConnectionStrategy:

Python 3.9.1 (default, Feb 18 2021, 16:03:49)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from bsb.storage import Chunk
>>> from bsb.connectivity import ConnectionStrategy
>>> ConnectionStrategy()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/mnt/d/GIT/bsb/bsb/config/_make.py", line 57, in __call__
    instance = meta_subject.__new__(
  File "/mnt/d/GIT/bsb/bsb/config/_make.py", line 179, in __new__
    ncls = class_determinant(_cls, kwargs)
  File "/mnt/d/GIT/bsb/bsb/config/_make.py", line 373, in _get_dynamic_class
    raise RequirementError(f"Dynamic node must contain a '{attr_name}' attribute")
bsb.exceptions.RequirementError: Dynamic node must contain a 'strategy' attribute
>>> class X(ConnectionStrategy):
...  def connect(): pass
...  def get_region_of_interest(): pass
...
>>> x = X()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/mnt/d/GIT/bsb/bsb/config/_make.py", line 57, in __call__
    instance = meta_subject.__new__(
  File "/mnt/d/GIT/bsb/bsb/config/_make.py", line 184, in __new__
    instance.__post_new__(**kwargs)
  File "/mnt/d/GIT/bsb/bsb/config/_make.py", line 218, in __post_new__
    raise RequirementError(f"Missing required attribute '{name}'")
bsb.exceptions.RequirementError: Missing required attribute 'presynaptic'
>>> x = X(presynaptic={"cell_types": []},postsynaptic={"cell_types": []}, strategy="")
>>> Chunk([0,0,0], None) == x
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/mnt/d/GIT/bsb/bsb/storage/_chunks.py", line 31, in __eq__
    other_id = np.array(other, copy=False).view(Chunk)._safe_id()
  File "/mnt/d/GIT/bsb/bsb/storage/_chunks.py", line 61, in _safe_id
    return int(self) if self.shape == () else self.id
TypeError: int() argument must be a string, a bytes-like object or a number, not 'X'
>>> x == Chunk([0,0,0], None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/mnt/d/GIT/bsb/bsb/storage/_chunks.py", line 31, in __eq__
    other_id = np.array(other, copy=False).view(Chunk)._safe_id()
  File "/mnt/d/GIT/bsb/bsb/storage/_chunks.py", line 61, in _safe_id
    return int(self) if self.shape == () else self.id
TypeError: int() argument must be a string, a bytes-like object or a number, not 'X'
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

No branches or pull requests

1 participant