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

Updated parser code #15006

Merged
merged 10 commits into from Aug 31, 2018

Conversation

Projects
None yet
4 participants
@NikhilPappu
Contributor

NikhilPappu commented Aug 1, 2018

The major changes in this commit include the code I have changed
in _listener_autolev_antlr.py. The changes to other files are
minor. I have also made the changes requested in PR #14758
after it had been merged.

Some specific changes are:

  1. Changed the input rule in the grammar and parser code to fix errors.
  2. Added a flag include_pydy in parse_autolev.
  3. Changed the doctest in __init__.py to make it look better.
  4. Removed the print option. stdout is now the default.
  5. Made various changes to _listener_autolev_antlr to parse
    more files. Revamped the processVariables function quite a bit.
    Changed the mass function and the pydy output code a bit followed
    by some minor changes.
  6. I have also added a .subs(kindiffdict()) in the forcing full method
    of kane.py. This is required for the pydy numerical code to work in
    some cases. This doesn't break any tests.
  • parsing

    • Made changes to _listener_autolev_antlr in parsing.autolev. Revamped the processVariables function
      quite a bit. Changed the mass function and the pydy output code a bit followed
      by some minor changes. Made some minor changes to other files in parsing.autolev.
    • Also changed some code in tests/test_autolev.py (Added commented test code for the GitLab repo
      tests and changed zip to zip_longest which is more correct.
  • physics.mechanics

    • Added a .subs(kindiffdict()) in the forcing full method of kane.py. This is required for the pydy
      numerical code to work in some cases. This doesn't break any tests.
@sympy-bot

This comment has been minimized.

Show comment
Hide comment
@sympy-bot

sympy-bot Aug 1, 2018

Hi, I am the SymPy bot (v130). I'm here to help you write a release notes entry. Please read the guide on how to write release notes.

Your release notes are in good order.

Here is what the release notes will look like:

  • parsing

    • Made changes to _listener_autolev_antlr in parsing.autolev. Revamped the processVariables function
      quite a bit. Changed the mass function and the pydy output code a bit followed
      by some minor changes. Made some minor changes to other files in parsing.autolev. (#15006 by @NikhilPappu)

    • Also changed some code in tests/test_autolev.py (Added commented test code for the GitLab repo
      tests and changed zip to zip_longest which is more correct. (#15006 by @NikhilPappu)

  • physics.mechanics

    • Added a .subs(kindiffdict()) in the forcing full method of kane.py. This is required for the pydy
      numerical code to work in some cases. This doesn't break any tests. (#15006 by @NikhilPappu)

This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.2.1.

Note: This comment will be updated with the latest check if you edit the pull request. You need to reload the page to see it.

Click here to see the pull request description that was parsed.

The major changes in this commit include the code I have changed
in _listener_autolev_antlr.py. The changes to other files are
minor. I have also made the changes requested in PR #14758
after it had been merged.

Some specific changes are:
1. Changed the input rule in the grammar and parser code to fix errors.
2. Added a flag include_pydy in parse_autolev.
3. Changed the doctest in `__init__.py` to make it look better.
4. Removed the print option. stdout is now the default.
5. Made various changes to _listener_autolev_antlr to parse
   more files. Revamped the processVariables function quite a bit.
   Changed the mass function and the pydy output code a bit followed
   by some minor changes.
6. I have also added a .subs(kindiffdict()) in the forcing full method
   of kane.py. This is required for the pydy numerical code to work in
   some cases. This doesn't break any tests.

<!-- BEGIN RELEASE NOTES -->
- parsing
   - Made changes to _listener_autolev_antlr in parsing.autolev. Revamped the processVariables function 
     quite a bit. Changed the mass function and the pydy output code a bit followed
     by some minor changes. Made some minor changes to other files in parsing.autolev.
   - Also changed some code in tests/test_autolev.py (Added commented test code for the GitLab repo 
     tests and changed zip to zip_longest which is more correct.

- physics.mechanics
   - Added a .subs(kindiffdict()) in the forcing full method of kane.py. This is required for the pydy 
     numerical code to work in some cases. This doesn't break any tests.
<!-- END RELEASE NOTES -->

Update

The release notes on the wiki have been updated.

sympy-bot commented Aug 1, 2018

Hi, I am the SymPy bot (v130). I'm here to help you write a release notes entry. Please read the guide on how to write release notes.

Your release notes are in good order.

Here is what the release notes will look like:

  • parsing

    • Made changes to _listener_autolev_antlr in parsing.autolev. Revamped the processVariables function
      quite a bit. Changed the mass function and the pydy output code a bit followed
      by some minor changes. Made some minor changes to other files in parsing.autolev. (#15006 by @NikhilPappu)

    • Also changed some code in tests/test_autolev.py (Added commented test code for the GitLab repo
      tests and changed zip to zip_longest which is more correct. (#15006 by @NikhilPappu)

  • physics.mechanics

    • Added a .subs(kindiffdict()) in the forcing full method of kane.py. This is required for the pydy
      numerical code to work in some cases. This doesn't break any tests. (#15006 by @NikhilPappu)

This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.2.1.

Note: This comment will be updated with the latest check if you edit the pull request. You need to reload the page to see it.

Click here to see the pull request description that was parsed.

The major changes in this commit include the code I have changed
in _listener_autolev_antlr.py. The changes to other files are
minor. I have also made the changes requested in PR #14758
after it had been merged.

Some specific changes are:
1. Changed the input rule in the grammar and parser code to fix errors.
2. Added a flag include_pydy in parse_autolev.
3. Changed the doctest in `__init__.py` to make it look better.
4. Removed the print option. stdout is now the default.
5. Made various changes to _listener_autolev_antlr to parse
   more files. Revamped the processVariables function quite a bit.
   Changed the mass function and the pydy output code a bit followed
   by some minor changes.
6. I have also added a .subs(kindiffdict()) in the forcing full method
   of kane.py. This is required for the pydy numerical code to work in
   some cases. This doesn't break any tests.

<!-- BEGIN RELEASE NOTES -->
- parsing
   - Made changes to _listener_autolev_antlr in parsing.autolev. Revamped the processVariables function 
     quite a bit. Changed the mass function and the pydy output code a bit followed
     by some minor changes. Made some minor changes to other files in parsing.autolev.
   - Also changed some code in tests/test_autolev.py (Added commented test code for the GitLab repo 
     tests and changed zip to zip_longest which is more correct.

- physics.mechanics
   - Added a .subs(kindiffdict()) in the forcing full method of kane.py. This is required for the pydy 
     numerical code to work in some cases. This doesn't break any tests.
<!-- END RELEASE NOTES -->

Update

The release notes on the wiki have been updated.

@moorepants

This comment has been minimized.

Show comment
Hide comment
@moorepants

moorepants Aug 1, 2018

Member

@NikhilPappu Please fill out the pull request template so we know what the PR is about. This PR also looks very large, like your last one. It is much easier for us to review if you break it into atomic changes spread across multiple PRs. It will speed up review if you do that.

Member

moorepants commented Aug 1, 2018

@NikhilPappu Please fill out the pull request template so we know what the PR is about. This PR also looks very large, like your last one. It is much easier for us to review if you break it into atomic changes spread across multiple PRs. It will speed up review if you do that.

@asmeurer

This comment has been minimized.

Show comment
Hide comment
@asmeurer

asmeurer Aug 2, 2018

Member

Looks like you found another bug in the bot. Thanks @NikhilPappu!

Member

asmeurer commented Aug 2, 2018

Looks like you found another bug in the bot. Thanks @NikhilPappu!

@asmeurer

This comment has been minimized.

Show comment
Hide comment
@asmeurer

asmeurer Aug 2, 2018

Member

Also please write real commit messages. "Updated code" could literally apply to any commit. The commit message should describe what the commit changes in a way that someone who comes across it in a year from now could understand what was changed and, importantly, why.

Member

asmeurer commented Aug 2, 2018

Also please write real commit messages. "Updated code" could literally apply to any commit. The commit message should describe what the commit changes in a way that someone who comes across it in a year from now could understand what was changed and, importantly, why.

@moorepants

This comment has been minimized.

Show comment
Hide comment
@moorepants

moorepants Aug 2, 2018

Member

@NikhilPappu Here is a nice guide to writing good commit messages: https://chris.beams.io/posts/git-commit/

Member

moorepants commented Aug 2, 2018

@NikhilPappu Here is a nice guide to writing good commit messages: https://chris.beams.io/posts/git-commit/

@asmeurer

This comment has been minimized.

Show comment
Hide comment
@asmeurer

asmeurer Aug 2, 2018

Member

We also have a guide in our own development workflow https://github.com/sympy/sympy/wiki/Development-workflow#writing-commit-messages. I might take a look at the guide Jason posted and see if our guide can be improved.

Member

asmeurer commented Aug 2, 2018

We also have a guide in our own development workflow https://github.com/sympy/sympy/wiki/Development-workflow#writing-commit-messages. I might take a look at the guide Jason posted and see if our guide can be improved.

@asmeurer

This comment has been minimized.

Show comment
Hide comment
@asmeurer

asmeurer Aug 2, 2018

Member

Also one thing that I would add that doesn't seem to be in either guide is to never use the -m flag to git commit. Let it open your editor so you can write a real message. Using -m nudges you to writing messages that are too short. If you don't like how git commit opens vim when using -m you can configure your EDITOR environment variable to open something better (nano is the simplest option, and most GUI editors have a command line tool that you can set EDITOR to that will open in them).

Member

asmeurer commented Aug 2, 2018

Also one thing that I would add that doesn't seem to be in either guide is to never use the -m flag to git commit. Let it open your editor so you can write a real message. Using -m nudges you to writing messages that are too short. If you don't like how git commit opens vim when using -m you can configure your EDITOR environment variable to open something better (nano is the simplest option, and most GUI editors have a command line tool that you can set EDITOR to that will open in them).

@NikhilPappu

This comment has been minimized.

Show comment
Hide comment
@NikhilPappu

NikhilPappu Aug 2, 2018

Contributor

@asmeurer @moorepants
Sorry about not providing any descriptions. I made the PR in a hurry and just wanted to check the Travis build for once. I will write the PR message and the release notes.
As for multiple PRs, I think the changes made here are minor for the most part and this PR should be enough for the changes in the parser. I think I could open different PRs for the tests added to test_functions.py and test_frame.py in physics/mechanics and vector.
As for the commit message I will change it to a more descriptive one. It's hard to say much in just the title so I shall give a proper description in the body of the commit message.

Contributor

NikhilPappu commented Aug 2, 2018

@asmeurer @moorepants
Sorry about not providing any descriptions. I made the PR in a hurry and just wanted to check the Travis build for once. I will write the PR message and the release notes.
As for multiple PRs, I think the changes made here are minor for the most part and this PR should be enough for the changes in the parser. I think I could open different PRs for the tests added to test_functions.py and test_frame.py in physics/mechanics and vector.
As for the commit message I will change it to a more descriptive one. It's hard to say much in just the title so I shall give a proper description in the body of the commit message.

Updated the parser code and made changes requested in #14758.
The major changes in this commit include the code I have changed
in _listener_autolev_antlr.py. The changes to other files are
minor. I have also made the changes requested in PR #14758
after it had been merged.

Some specific changes are:
1. Changed the input rule in the grammar and parser code to fix errors.
2. Added a flag include_pydy in parse_autolev.
3. Changed the doctest in __init__.py to make it look better.
4. Removed the print option. stdout is now the default.
5. Made various changes to _listener_autolev_antlr to parse
   more files. Revamped the processVariables function quite a bit.
   Changed the mass function and the pydy output code a bit followed
   by some minor changes.
6. I have also added a .subs(kindiffdict()) in the forcing full method
   of kane.py. This is required for the pydy numerical code to work in
   some cases. This doesn't break any of the test cases.
7. Changed zip to zip_longest in test_autolev.py. Also added commented
   code for the tests in the GitLab repo.

NikhilPappu added some commits Aug 19, 2018

@NikhilPappu

This comment has been minimized.

Show comment
Hide comment
@NikhilPappu

NikhilPappu Aug 19, 2018

Contributor

@moorepants I have changed the parse_autolev api and added a warning for the keywords as per your suggestion in the documentation PR.

Contributor

NikhilPappu commented Aug 19, 2018

@moorepants I have changed the parse_autolev api and added a warning for the keywords as per your suggestion in the documentation PR.

@moorepants

This comment has been minimized.

Show comment
Hide comment
@moorepants

moorepants Aug 21, 2018

Member

@NikhilPappu resolve the merge conflicts.

Member

moorepants commented Aug 21, 2018

@NikhilPappu resolve the merge conflicts.

NikhilPappu added some commits Aug 21, 2018

@NikhilPappu

This comment has been minimized.

Show comment
Hide comment
@NikhilPappu

NikhilPappu Aug 21, 2018

Contributor

@moorepants I resolved them.

Contributor

NikhilPappu commented Aug 21, 2018

@moorepants I resolved them.

@moorepants

Some minor comments added. I'm going to also test this locally and will give any feedback if needed.

@moorepants

This comment has been minimized.

Show comment
Hide comment
@moorepants

moorepants Aug 29, 2018

Member

First error I got when trying locally is:

/home/moorepants/src/sympy/sympy/external/importtools.py:145: UserWarning: antlr4 module is not installed
  warnings.warn("%s module is not installed" % module, UserWarning)
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-3-7dc7f7398af9> in <module>()
      1 with open('whipple.al', 'r') as f:
----> 2     res = parse_autolev(f)
      3 

~/src/sympy/sympy/parsing/autolev/__init__.py in parse_autolev(autolev_code, include_numeric)
     97 
     98     if _autolev is not None:
---> 99         return _autolev.parse_autolev(autolev_code, include_numeric)

~/src/sympy/sympy/parsing/autolev/_parse_autolev_antlr.py in parse_autolev(autolev_code, include_numeric)
     17     antlr4 = import_module('antlr4', warn_not_installed=True)
     18     if not antlr4:
---> 19         raise ImportError("Autolev parsing requires the antlr4 python package,"
     20                           " provided by pip (antlr4-python2-runtime or"
     21                           " antlr4-python3-runtime) or"

ImportError: Autolev parsing requires the antlr4 python package, provided by pip (antlr4-python2-runtime or antlr4-python3-runtime) or conda (antlr-python-runtime)

I then tried:

$ conda search antlr
moorepants@garuda:~$ conda search antlr
Loading channels: done
# Name                  Version           Build  Channel             
antlr                     2.7.7               2  conda-forge         
antlr                     2.7.7               3  conda-forge         
antlr                     2.7.7               4  conda-forge         
antlr                     2.7.7               5  conda-forge         
antlr                     2.7.7               6  conda-forge         
antlr                     2.7.7               7  conda-forge         
antlr                     2.7.7      hfc679d8_7  conda-forge         
antlr                     2.7.7          py27_0  conda-forge         
antlr                     2.7.7          py27_1  conda-forge         
antlr                     4.7.1               0  conda-forge

There does not seem to be any package called antlr-python-runtime in the conda channels defaults of conda-forge.

Member

moorepants commented Aug 29, 2018

First error I got when trying locally is:

/home/moorepants/src/sympy/sympy/external/importtools.py:145: UserWarning: antlr4 module is not installed
  warnings.warn("%s module is not installed" % module, UserWarning)
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-3-7dc7f7398af9> in <module>()
      1 with open('whipple.al', 'r') as f:
----> 2     res = parse_autolev(f)
      3 

~/src/sympy/sympy/parsing/autolev/__init__.py in parse_autolev(autolev_code, include_numeric)
     97 
     98     if _autolev is not None:
---> 99         return _autolev.parse_autolev(autolev_code, include_numeric)

~/src/sympy/sympy/parsing/autolev/_parse_autolev_antlr.py in parse_autolev(autolev_code, include_numeric)
     17     antlr4 = import_module('antlr4', warn_not_installed=True)
     18     if not antlr4:
---> 19         raise ImportError("Autolev parsing requires the antlr4 python package,"
     20                           " provided by pip (antlr4-python2-runtime or"
     21                           " antlr4-python3-runtime) or"

ImportError: Autolev parsing requires the antlr4 python package, provided by pip (antlr4-python2-runtime or antlr4-python3-runtime) or conda (antlr-python-runtime)

I then tried:

$ conda search antlr
moorepants@garuda:~$ conda search antlr
Loading channels: done
# Name                  Version           Build  Channel             
antlr                     2.7.7               2  conda-forge         
antlr                     2.7.7               3  conda-forge         
antlr                     2.7.7               4  conda-forge         
antlr                     2.7.7               5  conda-forge         
antlr                     2.7.7               6  conda-forge         
antlr                     2.7.7               7  conda-forge         
antlr                     2.7.7      hfc679d8_7  conda-forge         
antlr                     2.7.7          py27_0  conda-forge         
antlr                     2.7.7          py27_1  conda-forge         
antlr                     4.7.1               0  conda-forge

There does not seem to be any package called antlr-python-runtime in the conda channels defaults of conda-forge.

@moorepants

This comment has been minimized.

Show comment
Hide comment
@moorepants

moorepants Aug 29, 2018

Member

I take that back. It is just conda's poor search command:

moorepants@garuda:~$ conda search antlr*
Loading channels: done
# Name                  Version           Build  Channel             
antlr                     2.7.7               2  conda-forge         
antlr                     2.7.7               3  conda-forge         
antlr                     2.7.7               4  conda-forge         
antlr                     2.7.7               5  conda-forge         
antlr                     2.7.7               6  conda-forge         
antlr                     2.7.7               7  conda-forge         
antlr                     2.7.7      hfc679d8_7  conda-forge         
antlr                     2.7.7          py27_0  conda-forge         
antlr                     2.7.7          py27_1  conda-forge         
antlr                     4.7.1               0  conda-forge         
antlr-python-runtime           4.7.1          py27_0  conda-forge         
antlr-python-runtime           4.7.1          py35_0  conda-forge         
antlr-python-runtime           4.7.1          py36_0  conda-forge         
Member

moorepants commented Aug 29, 2018

I take that back. It is just conda's poor search command:

moorepants@garuda:~$ conda search antlr*
Loading channels: done
# Name                  Version           Build  Channel             
antlr                     2.7.7               2  conda-forge         
antlr                     2.7.7               3  conda-forge         
antlr                     2.7.7               4  conda-forge         
antlr                     2.7.7               5  conda-forge         
antlr                     2.7.7               6  conda-forge         
antlr                     2.7.7               7  conda-forge         
antlr                     2.7.7      hfc679d8_7  conda-forge         
antlr                     2.7.7          py27_0  conda-forge         
antlr                     2.7.7          py27_1  conda-forge         
antlr                     4.7.1               0  conda-forge         
antlr-python-runtime           4.7.1          py27_0  conda-forge         
antlr-python-runtime           4.7.1          py35_0  conda-forge         
antlr-python-runtime           4.7.1          py36_0  conda-forge         
@moorepants

This comment has been minimized.

Show comment
Hide comment
@moorepants

moorepants Aug 29, 2018

Member

New error. I tried this file https://github.com/moorepants/dissertation/blob/master/src/eom/Whipple.al, which is a reasonably complex Autolev file and got a KeyError. There is no custom error message, so no real idea what causes this.

moorepants@garuda:sympy(pr-15006)$ ipython
Python 3.5.5 | packaged by conda-forge | (default, Jul 23 2018, 23:45:43) 
Type 'copyright', 'credits' or 'license' for more information
IPython 6.5.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from sympy.parsing.autolev import parse_autolev

In [2]: with open('whipple.al', 'r') as f:
   ...:     res = parse_autolev(f)
   ...:     
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-2-7dc7f7398af9> in <module>()
      1 with open('whipple.al', 'r') as f:
----> 2     res = parse_autolev(f)
      3 

~/src/sympy/sympy/parsing/autolev/__init__.py in parse_autolev(autolev_code, include_numeric)
     97 
     98     if _autolev is not None:
---> 99         return _autolev.parse_autolev(autolev_code, include_numeric)

~/src/sympy/sympy/parsing/autolev/_parse_autolev_antlr.py in parse_autolev(autolev_code, include_numeric)
     35         my_listener = MyListener(include_numeric)
     36         walker = antlr4.ParseTreeWalker()
---> 37         walker.walk(my_listener, tree)
     38         return "".join(my_listener.output_code)

~/miniconda3/lib/python3.5/site-packages/antlr4/tree/Tree.py in walk(self, listener, t)
    149         self.enterRule(listener, t)
    150         for child in t.getChildren():
--> 151             self.walk(listener, child)
    152         self.exitRule(listener, t)
    153 

~/miniconda3/lib/python3.5/site-packages/antlr4/tree/Tree.py in walk(self, listener, t)
    149         self.enterRule(listener, t)
    150         for child in t.getChildren():
--> 151             self.walk(listener, child)
    152         self.exitRule(listener, t)
    153 

~/miniconda3/lib/python3.5/site-packages/antlr4/tree/Tree.py in walk(self, listener, t)
    150         for child in t.getChildren():
    151             self.walk(listener, child)
--> 152         self.exitRule(listener, t)
    153 
    154     #

~/miniconda3/lib/python3.5/site-packages/antlr4/tree/Tree.py in exitRule(self, listener, r)
    165     def exitRule(self, listener:ParseTreeListener, r:RuleNode):
    166         ctx = r.getRuleContext()
--> 167         ctx.exitRule(listener)
    168         listener.exitEveryRule(ctx)
    169 

~/src/sympy/sympy/parsing/autolev/_antlr/autolevparser.py in exitRule(self, listener)
    556         def exitRule(self, listener):
    557             if hasattr(listener, "exitVecAssign"):
--> 558                 listener.exitVecAssign(self)
    559 
    560 

~/src/sympy/sympy/parsing/autolev/_listener_autolev_antlr.py in exitVecAssign(self, ctx)
   1490 
   1491                     if v1 == "p":
-> 1492                         if self.type2[v2] == "point":
   1493                             e2 = self.symbol_table2[v2]
   1494                         elif self.type2[v2] == "particle":

KeyError: 'no'
Member

moorepants commented Aug 29, 2018

New error. I tried this file https://github.com/moorepants/dissertation/blob/master/src/eom/Whipple.al, which is a reasonably complex Autolev file and got a KeyError. There is no custom error message, so no real idea what causes this.

moorepants@garuda:sympy(pr-15006)$ ipython
Python 3.5.5 | packaged by conda-forge | (default, Jul 23 2018, 23:45:43) 
Type 'copyright', 'credits' or 'license' for more information
IPython 6.5.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from sympy.parsing.autolev import parse_autolev

In [2]: with open('whipple.al', 'r') as f:
   ...:     res = parse_autolev(f)
   ...:     
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-2-7dc7f7398af9> in <module>()
      1 with open('whipple.al', 'r') as f:
----> 2     res = parse_autolev(f)
      3 

~/src/sympy/sympy/parsing/autolev/__init__.py in parse_autolev(autolev_code, include_numeric)
     97 
     98     if _autolev is not None:
---> 99         return _autolev.parse_autolev(autolev_code, include_numeric)

~/src/sympy/sympy/parsing/autolev/_parse_autolev_antlr.py in parse_autolev(autolev_code, include_numeric)
     35         my_listener = MyListener(include_numeric)
     36         walker = antlr4.ParseTreeWalker()
---> 37         walker.walk(my_listener, tree)
     38         return "".join(my_listener.output_code)

~/miniconda3/lib/python3.5/site-packages/antlr4/tree/Tree.py in walk(self, listener, t)
    149         self.enterRule(listener, t)
    150         for child in t.getChildren():
--> 151             self.walk(listener, child)
    152         self.exitRule(listener, t)
    153 

~/miniconda3/lib/python3.5/site-packages/antlr4/tree/Tree.py in walk(self, listener, t)
    149         self.enterRule(listener, t)
    150         for child in t.getChildren():
--> 151             self.walk(listener, child)
    152         self.exitRule(listener, t)
    153 

~/miniconda3/lib/python3.5/site-packages/antlr4/tree/Tree.py in walk(self, listener, t)
    150         for child in t.getChildren():
    151             self.walk(listener, child)
--> 152         self.exitRule(listener, t)
    153 
    154     #

~/miniconda3/lib/python3.5/site-packages/antlr4/tree/Tree.py in exitRule(self, listener, r)
    165     def exitRule(self, listener:ParseTreeListener, r:RuleNode):
    166         ctx = r.getRuleContext()
--> 167         ctx.exitRule(listener)
    168         listener.exitEveryRule(ctx)
    169 

~/src/sympy/sympy/parsing/autolev/_antlr/autolevparser.py in exitRule(self, listener)
    556         def exitRule(self, listener):
    557             if hasattr(listener, "exitVecAssign"):
--> 558                 listener.exitVecAssign(self)
    559 
    560 

~/src/sympy/sympy/parsing/autolev/_listener_autolev_antlr.py in exitVecAssign(self, ctx)
   1490 
   1491                     if v1 == "p":
-> 1492                         if self.type2[v2] == "point":
   1493                             e2 = self.symbol_table2[v2]
   1494                         elif self.type2[v2] == "particle":

KeyError: 'no'
@NikhilPappu

This comment has been minimized.

Show comment
Hide comment
@NikhilPappu

NikhilPappu Aug 29, 2018

Contributor

@moorepants I'll make the changes shortly. The whipple.al file should work (other than the linearization part) if the errors are fixed. I'll look into this when I find time.

Contributor

NikhilPappu commented Aug 29, 2018

@moorepants I'll make the changes shortly. The whipple.al file should work (other than the linearization part) if the errors are fixed. I'll look into this when I find time.

@asmeurer asmeurer added this to the SymPy 1.3 milestone Aug 29, 2018

Made the requested changes
Also fixed the position vector error observed in #15165.
@NikhilPappu

This comment has been minimized.

Show comment
Hide comment
@NikhilPappu

NikhilPappu Aug 30, 2018

Contributor

@moorepants I have addressed the comments and made some changes. I have also fixed the position vector error observed in #15165. I think this PR should be almost ready for merging now. As for whipple.al, I will have to run it line by line and check the reasons for the errors. I shall do this later.

Contributor

NikhilPappu commented Aug 30, 2018

@moorepants I have addressed the comments and made some changes. I have also fixed the position vector error observed in #15165. I think this PR should be almost ready for merging now. As for whipple.al, I will have to run it line by line and check the reasons for the errors. I shall do this later.

@NikhilPappu NikhilPappu reopened this Aug 30, 2018

@moorepants

This comment has been minimized.

Show comment
Hide comment
@moorepants

moorepants Aug 30, 2018

Member

Looks like you need something that says "if using symengine" use subs, otherwise use xreplace.:

___________ sympy/physics/mechanics/tests/test_kane.py:test_one_dof ____________
Traceback (most recent call last):
  File "sympy/utilities/runtests.py", line 1277, in _timeout
    function()
  File "/home/travis/build/sympy/sympy/sympy/physics/mechanics/tests/test_kane.py", line 40, in test_one_dof
    KM.mass_matrix_full.LUsolve(KM.forcing_full)) == zeros(2, 1)
  File "sympy/physics/mechanics/kane.py", line 641, in forcing_full
    return -Matrix([f1.xreplace(self.kindiffdict()), self._f_d.xreplace(self.kindiffdict()), self._f_dnh.xreplace(self.kindiffdict())])
AttributeError: 'symengine.lib.symengine_wrapper.MutableDenseMatrix' object has no attribute 'xreplace'
Member

moorepants commented Aug 30, 2018

Looks like you need something that says "if using symengine" use subs, otherwise use xreplace.:

___________ sympy/physics/mechanics/tests/test_kane.py:test_one_dof ____________
Traceback (most recent call last):
  File "sympy/utilities/runtests.py", line 1277, in _timeout
    function()
  File "/home/travis/build/sympy/sympy/sympy/physics/mechanics/tests/test_kane.py", line 40, in test_one_dof
    KM.mass_matrix_full.LUsolve(KM.forcing_full)) == zeros(2, 1)
  File "sympy/physics/mechanics/kane.py", line 641, in forcing_full
    return -Matrix([f1.xreplace(self.kindiffdict()), self._f_d.xreplace(self.kindiffdict()), self._f_dnh.xreplace(self.kindiffdict())])
AttributeError: 'symengine.lib.symengine_wrapper.MutableDenseMatrix' object has no attribute 'xreplace'
@moorepants

This comment has been minimized.

Show comment
Hide comment
@moorepants
Member

moorepants commented Aug 30, 2018

Opened issue here: symengine/symengine#1456

@moorepants

This comment has been minimized.

Show comment
Hide comment
@moorepants

moorepants Aug 30, 2018

Member

I'm fine with merging. Let me know when tests pass and last things are done.

Member

moorepants commented Aug 30, 2018

I'm fine with merging. Let me know when tests pass and last things are done.

NikhilPappu added some commits Aug 30, 2018

@NikhilPappu

This comment has been minimized.

Show comment
Hide comment
@NikhilPappu

NikhilPappu Aug 31, 2018

Contributor

@moorepants I think this can be merged now.

Contributor

NikhilPappu commented Aug 31, 2018

@moorepants I think this can be merged now.

@moorepants

This comment has been minimized.

Show comment
Hide comment
@moorepants

moorepants Aug 31, 2018

Member

Great!

Member

moorepants commented Aug 31, 2018

Great!

@moorepants moorepants merged commit ceff9f6 into sympy:master Aug 31, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
sympy-bot/release-notes The release notes look OK
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment