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

setting stoich.path to stoich.ReacSystemPath for cross compartment model gives seg fault #426

Open
hrani opened this issue Sep 8, 2020 · 1 comment
Assignees

Comments

@hrani
Copy link
Contributor

hrani commented Sep 8, 2020

https://github.com/BhallaLab/moose-examples/blob/master/snippets/crossComptSimpleReacGSSA.py.BROKEN
line no 100-102 Stoich.path says DeprecationWarning:: Use Soitch::readSystemPath instead

  1. Stoich.cpp @ line no 44: reacSystemPath, but @ line no 281: message says readSystemPath, it should be reacSystemPath right?

  2. In new python binding this field reacSystemPath might not be exposed ( if try to print dir(stoich) this field is not showing)

  3. replacing in (100-102) crossComptSimpleReacGSSA.py.BROKEN from Stoich.path to Stoich.reacSystemPath gives a seg fault with Stoich::innerInstallReaction
    3.a This happens for GSL and GSSA solvers for multiCompartment/crosscompartment model ( may be durning buildXreacs some reactions are not zombified or other way round)
    For single compartment model, I have set stoich.reacSystemPath and it works (scriptKineticSolver.py)

dilawar pushed a commit to dilawar/pymoose-community that referenced this issue Sep 9, 2020
@dilawar
Copy link
Contributor

dilawar commented Sep 9, 2020

  1. the fixes are in Typo and partial fixes to Issue 426 #427.getFieldNames is available on every moose.element. See the example in the PR for more details.

  2. dir(stoich) does not return C++ fields. To get them use getFieldNames. It is for two reasons: first, performance reason because python objects don't have to carry copies. Second, this behavior required odd hacks in the API (can't recall which one and can't find a note or commit.).

This is also the reason why isinstance does not work (#425, #423) as before in the new API. Use getFieldNames, getFieldDicts etc. and showfields to see the C++ level attributes. The generic attributes which are common to all moose elements (think moose.Neutral) are available in dir command.

There is probably a neat way to extend dir to include the output of getFieldNames as well (e.g. https://stackoverflow.com/questions/15507848/what-is-the-correct-way-to-override-the-dir-method). Not sure if it is worth the cost of making API a bit more convoluted.

hrani added a commit that referenced this issue Sep 9, 2020
* Fixed typo #426

* getFieldNames is available for element also

Both are equivalent

>>> a = moose.Stoich('a')
>>> v1 = moose.getFieldNames(a, 'value')
>>> v2 = a.getFieldNames('value')
>>> assert v1 == v2

If not argument is passed to `getFieldNames`, it returns are field
types.

Co-authored-by: HarshaRani <[email protected]>
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

3 participants