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

Prevent Orbit creation with non scalar quantities #716

Closed
dragonlost opened this issue Jun 26, 2019 · 9 comments · Fixed by #903
Closed

Prevent Orbit creation with non scalar quantities #716

dragonlost opened this issue Jun 26, 2019 · 9 comments · Fixed by #903
Assignees
Milestone

Comments

@dragonlost
Copy link

@dragonlost dragonlost commented Jun 26, 2019

Hello.
I recently use poliastro but i have a bug.
when i use propagate fonction :

    xyz_c.append(ss.r)
  File "/home/sdurand/miniconda3/lib/python3.7/site-packages/poliastro/twobody/orbit.py", line 99, in r
    return self._state.to_vectors().r
  File "/home/sdurand/miniconda3/lib/python3.7/site-packages/poliastro/twobody/_states.py", line 113, in to_vectors
    self.nu.to(u.rad).value,
  File "/home/sdurand/miniconda3/lib/python3.7/site-packages/numba/dispatcher.py", line 350, in _compile_for_args
    error_rewrite(e, 'typing')
  File "/home/sdurand/miniconda3/lib/python3.7/site-packages/numba/dispatcher.py", line 317, in error_rewrite
    reraise(type(e), e, None)
  File "/home/sdurand/miniconda3/lib/python3.7/site-packages/numba/six.py", line 658, in reraise
    raise value.with_traceback(tb)
numba.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Failed in nopython mode pipeline (step: nopython frontend)
Type of variable 'v_pqw' cannot be determined, operation: $0.45, location: /home/sdurand/miniconda3/lib/python3.7/site-packages/poliastro/core/elements.py (76)

File "../../../../../miniconda3/lib/python3.7/site-packages/poliastro/core/elements.py", line 76:
def rv_pqw(k, p, ecc, nu):
    <source elided>
    r_pqw = (np.array([cos(nu), sin(nu), 0 * nu]) * p / (1 + ecc * cos(nu))).T
    v_pqw = (np.array([-sin(nu), (ecc + cos(nu)), 0]) * sqrt(k / p)).T
    ^

[1] During: resolving callee type: type(CPUDispatcher(<function rv_pqw at 0x7f1c6406b0d0>))
[2] During: typing of call at /home/sdurand/miniconda3/lib/python3.7/site-packages/poliastro/core/elements.py (102)


File "../../../../../miniconda3/lib/python3.7/site-packages/poliastro/core/elements.py", line 102:
def coe2rv(k, p, ecc, inc, raan, argp, nu):
    <source elided>
    """
    r_pqw, v_pqw = rv_pqw(k, p, ecc, nu)
    ^

This is not usually a problem with Numba itself but instead often caused by
the use of unsupported features or an issue in resolving types.

To see Python/NumPy features supported by the latest release of Numba visit:
http://numba.pydata.org/numba-doc/dev/reference/pysupported.html
and
http://numba.pydata.org/numba-doc/dev/reference/numpysupported.html

For more information about typing errors and how to debug them visit:
http://numba.pydata.org/numba-doc/latest/user/troubleshoot.html#my-code-doesn-t-compile

If you think your code should work with Numba, please report the error message
and traceback, along with a minimal reproducer at:
https://github.com/numba/numba/issues/new

@astrojuanlu
Copy link
Member

@astrojuanlu astrojuanlu commented Jun 26, 2019

Hi @dragonlost! Can you display ss.classical()?

@astrojuanlu
Copy link
Member

@astrojuanlu astrojuanlu commented Jun 26, 2019

This is probably a bug, I'm sure we can prevent the user from doing this.

@astrojuanlu
Copy link
Member

@astrojuanlu astrojuanlu commented Jun 26, 2019

Also, we will need your poliastro version, Python version, and operative system.

@dragonlost
Copy link
Author

@dragonlost dragonlost commented Jun 26, 2019

for ss.classical() : (<Quantity [6878.14] km>, <Quantity [0.]>, <Quantity 20. deg>, <Quantity 0. deg>, <Quantity 0. deg>, <Quantity 0. deg>)

My operative system : Ubuntu Mate 18.04.2
My python version : Python 3.7.2 with Anaconda 3 (gcc 7.3.0)
My poliastro version : 0.12.0 (build : py_0, conda-forge)

and conda 4.7.5 and numba 0.43.1
`

@astrojuanlu
Copy link
Member

@astrojuanlu astrojuanlu commented Jun 26, 2019

I see that the first two are arrays with one element, did you notice the brackets?

@dragonlost
Copy link
Author

@dragonlost dragonlost commented Jun 26, 2019

ok is my fault. I had a bad upstream conversion that would create me "a" and "e" as a list

@dragonlost
Copy link
Author

@dragonlost dragonlost commented Jun 26, 2019

Thank for very very fast support !!

@astrojuanlu
Copy link
Member

@astrojuanlu astrojuanlu commented Jun 26, 2019

😄 You're welcome! We'll try to find a way to prevent this in the future, that numba error is impossible to understand :)

@astrojuanlu astrojuanlu changed the title numba error Prevent Orbit creation with non scalar quantities Jul 1, 2019
@astrojuanlu astrojuanlu added this to the 0.14 milestone Jul 21, 2019
@astrojuanlu astrojuanlu removed this from the 0.14 milestone Apr 5, 2020
@astrojuanlu astrojuanlu added this to the 0.15 milestone Apr 5, 2020
@astrojuanlu
Copy link
Member

@astrojuanlu astrojuanlu commented Apr 11, 2020

I just got bitten by a slightly different version of this

@astrojuanlu astrojuanlu self-assigned this Apr 11, 2020
astrojuanlu added a commit to astrojuanlu/poliastro that referenced this issue Apr 11, 2020
astrojuanlu added a commit to astrojuanlu/poliastro that referenced this issue Apr 12, 2020
astrojuanlu added a commit to astrojuanlu/poliastro that referenced this issue Apr 12, 2020
astrojuanlu added a commit to astrojuanlu/poliastro that referenced this issue Apr 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants