decor.defaults() doesn't return the defaults
Closed this issue · 10 comments
I am going through the documentation.
Here in Arbor, the decor() class, defaults(), is supposed to return a list of all set defaults for inspection.
By calling:
decor = Arbor.decor()
decor.defaults()
I should have the returned defaults. I somehow have it but in the error message, not as the regular output of the function. I'm not sure if that is considered a bug.
Hi @ErbB4,
what is the error message?
Like this:
Unable to convert function return value to a Python type! The signature was
(self: arbor._arbor.decor) -> List[Union[arbor._arbor.membrane_potential, arbor._arbor.axial_resistivity, arbor._arbor.temperature_K, arbor._arbor.membrane_capacitance, arbor._arbor.ion_diffusivity, arbor._arbor.int_concentration, arbor._arbor.ext_concentration, arbor._arbor.reversal_potential, arb::ion_reversal_potential_method, arbor._arbor.cv_policy]]
ah. defaults
is possibly a list, not a function? Try
decor.defaults
only returns <bound method PyCapsule.defaults of <arbor._arbor.decor object at 0x735e587c7af0>>
even decor.defaults? returns more:
defaults(self: arbor._arbor.decor) -> List[Union[arbor._arbor.membrane_potential, arbor._arbor.axial_resistivity, arbor._arbor.temperature_K, arbor._arbor.membrane_capacitance, arbor._arbor.ion_diffusivity, arbor._arbor.int_concentration, arbor._arbor.ext_concentration, arbor._arbor.reversal_potential, arb::ion_reversal_potential_method, arbor._arbor.cv_policy]]
Return a view of all defaults.
But I think it is not the right way to use it hehe
Interestingly, I cannot reproduce this on the current HEAD version:
✔❯ python3
Python 3.12.3 (main, Apr 9 2024, 08:09:14) [Clang 15.0.0 (clang-1500.1.0.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import arbor as A
>>> d = A.decor()
>>> d.defaults()
[]
>>> A.config()
{'mpi': True, 'mpi4py': True, 'gpu': None, 'vectorize': False, 'profiling': True, 'neuroml': True, 'bundled': True, 'version': '0.9.1-dev', 'source': '2024-06-07T09:29:45+02:00 bfbb60bda5181bfe267b9459c4d8fdee4b0b50bd modified', 'build_config': 'RELEASE', 'arch': 'native', 'prefix': '/usr/local', 'python_lib_path': '/usr/local/lib/python3.12/site-packages', 'binary_path': 'bin', 'lib_path': 'lib', 'data_path': 'share', 'CXX': '/opt/homebrew/bin/g++-11', 'pybind-version': '2.11.1', 'timestamp': 'Jun 11 2024 11:57:16'}
And on the pypi published version:
✔❯ ipython3
Python 3.12.3 (main, Apr 9 2024, 08:09:14) [Clang 15.0.0 (clang-1500.1.0.2.5)]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.25.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import arbor as A
In [2]: A.config()
Out[2]:
{'mpi': False,
'mpi4py': False,
'gpu': None,
'vectorize': False,
'profiling': False,
'neuroml': True,
'bundled': True,
'version': '0.9.0',
'source': 'unknown commit',
'build_config': 'RELEASE',
'arch': 'native',
'prefix': '/usr/local',
'python_lib_path': '',
'binary_path': 'bin',
'lib_path': 'lib',
'data_path': 'share',
'CXX': '/Applications/Xcode_14.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++',
'pybind-version': '2.10.1',
'timestamp': 'Aug 10 2023 10:52:41'}
In [3]: d = A.decor()
In [4]: d.defaults()
Out[4]: []
interesting... I have no comment anymore
'Works on my machine' is not a fix. If it still occurs on your installation, maybe try rebuilding, and we'll try to get to the bottom of it
I think this has resolved.