Open hrani opened 4 years ago
moose.Neutral('/m') moose.CubeMesh('/m/c') f = moose.Function('/m/c/f') moose.showfield(f) Not sure what does "derivative" hold in case of function, earlier it use to be derivative = 0.0 now its saying Nan derivative = nan
function like getId(), getDataIndex(), mooseWriteSBML,mooseReadSBML mooseWriteKkit is not available at python binding level.
getId
and getDataIndex
are avaiable as a field.
In [7]: b = moose.Neutral('/a')
In [8]: a.getId()
Out[8]: <moose.vec: class=Neutral, id=448, path=/a>
In [9]: a.getDataIndex()
Out[9]: 0
mooseWriteSBML
is changed to [writeSBML](https://github.com/BhallaLab/moose-core/blob/b4aac15bf9e696c442f8d4c972f329d16ff97f7f/python/moose/__init__.py#L766)
. Similarly mooseReadSBML
, and mooseWriteKkit
are renamed to readSBML
and writeKkit
. You can create an alias in python/__init__.py
file. You may want to check pybind11/module.cpp
as well.
When a value is assigned to a moose element, derivative
does not make sense. For computing derivative, you need at least 2 values (f(x+h) - f(x)/h
). In old API, it was initialized to 0.0
. It doesn't break any existing code.
In [7]: b = moose.Neutral('/a') In [8]: a.getId() Out[8]: <moose.vec: class=Neutral, id=448, path=/a> In [9]: a.getDataIndex() Out[9]: 0
ipython3 Python 3.8.2 (default, Jul 16 2020, 14:00:26) Type 'copyright', 'credits' or 'license' for more information IPython 7.13.0 -- An enhanced Interactive Python. Type '?' for help.
moose.about()
Out[1]:
{'path': '/home/harsha/moose/moose-core/python/moose',
'version': '3.2.0.dev20200826',
'docs': 'https://moose.readthedocs.io/en/latest/',
'development': 'https://github.com/BhallaLab/moose-core'}
b = moose.Neutral('/a')
b.getDataIndex()
KeyError Traceback (most recent call last)
https://github.com/BhallaLab/moose-core/pull/422 fixes the missing getFieldIndex
, getDataIndex
functions. I miswrote in the previous update: they were available as dataIndex
, fieldIndex
. Sorry about that! Only one script in the moose-examples, still uses getDataIndex
. If they have made into the published code, I'd suggest to deprecate them in favor of fieldIndex
and dataIndex
.
About missing mooseReadSBML
etc., it's up to you and @upibhalla to either tweak the API or change the docs. It's a one-line change in the __init__.py
. As far as I can recall, mooseReadSBML
etc. were introduced because C++ had the name-clash with this readSBML
etc. function which is no longer the case.
About derivative
set to nan
in the beginning, it is mathematically correct now and does not break any code. There is no need to make it wrong.
Many other PRs I've opened are diverging and getting stale and I hardly hear about them for 2-3 months. I am feeling a little less motivated to work on this project.
function like getId(), getDataIndex(), mooseWriteSBML,mooseReadSBML mooseWriteKkit is not available at python binding level.