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

AttributeError: 'Orbit' object has no attribute 'frame' #849

Closed
iamabhishek0 opened this issue Feb 26, 2020 · 14 comments · Fixed by #855
Closed

AttributeError: 'Orbit' object has no attribute 'frame' #849

iamabhishek0 opened this issue Feb 26, 2020 · 14 comments · Fixed by #855

Comments

@iamabhishek0
Copy link
Contributor

iamabhishek0 commented Feb 26, 2020

>>> from poliastro import *
>>> r = [-6045, -3490, 2500] * u.km
>>> v = [-3.457, 6.618, 2.533] * u.km / u.s
>>> ss = Orbit.from_vectors(Earth, r, v)
>>> ss
7283 x 10293 km x 153.2 deg (GCRS) orbit around Earth (♁) at epoch J2000.000 (TT)
>>> ss.frame
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'Orbit' object has no attribute 'frame'
@astrojuanlu
Copy link
Member

astrojuanlu commented Feb 27, 2020

Hi @iamabhishek0, I tried this with master and everything worked:

>>> from astropy import units as u
>>> r = [-6045, -3490, 2500] * u.km
>>> v = [-3.457, 6.618, 2.533] * u.km / u.s
>>> from poliastro.twobody import Orbit
>>> from poliastro.bodies import Earth
>>> ss = Orbit.from_vectors(Earth, r, v)
>>> ss.frame
<GCRS Frame (obstime=J2000.000, obsgeoloc=(0., 0., 0.) m, obsgeovel=(0., 0., 0.) m / s)>

could you please tell us what poliastro version are you using?

@iamabhishek0
Copy link
Contributor Author

iamabhishek0 commented Feb 28, 2020

I am using the current version which is on the master.

@astrojuanlu
Copy link
Member

astrojuanlu commented Mar 3, 2020

I am not at all sure. Are you using Linux? Could you please paste the output of

$ which python
$ python -m pip list | grep poliastro
$ python -c "from poliastro.examples import iss; print(iss.frame)"

?

@astrojuanlu astrojuanlu added the status:needs more info label Mar 3, 2020
@iamabhishek0
Copy link
Contributor Author

iamabhishek0 commented Mar 3, 2020

Yes, I am using Linux.

(polienv) [uchiha@pop-os src{master}]$ which python
/home/uchiha/Desktop/poliastro/polienv/bin/python
(polienv) [uchiha@pop-os src{master}]$ python -m pip list | grep poliastro
(polienv) [uchiha@pop-os src{master}]$ python -c "from poliastro.examples import iss; print(iss.frame)"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: 'Orbit' object has no attribute 'frame'

@astrojuanlu
Copy link
Member

astrojuanlu commented Mar 3, 2020

Well, python -m pip list doesn't find it, so I wonder where is it finding it.

Can you do this?

$ python -c "import poliastro as p; print(p.__file__)"
$ python -c "import poliastro as p; print(p.__version__)"

@iamabhishek0
Copy link
Contributor Author

iamabhishek0 commented Mar 3, 2020

(polienv) [uchiha@pop-os src{master}]$ python -c "import poliastro as p; print(p.__file__)"
/home/uchiha/Desktop/poliastro/src/poliastro/__init__.py
(polienv) [uchiha@pop-os src{master}]$ python -c "import poliastro as p; print(p.__version__)"
0.14.post0.dev0

@astrojuanlu
Copy link
Member

astrojuanlu commented Mar 3, 2020

Okay, so you're running the code inside src/poliastro. You won't need to do that if you flit install --symlink where pyproject.toml is, but let's not get there yet.

Last thing: do git status, since unfortunately the __version__ does not record the commit...

@iamabhishek0
Copy link
Contributor Author

iamabhishek0 commented Mar 3, 2020

(polienv) [uchiha@pop-os src{master}]$ git status
On branch master
Your branch is up to date with 'origin/master'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        ../polienv/

nothing added to commit but untracked files present (use "git add" to track)

@astrojuanlu
Copy link
Member

astrojuanlu commented Mar 3, 2020

Sorry, I forgot the most important one 🤦‍♂️ git show

@iamabhishek0
Copy link
Contributor Author

iamabhishek0 commented Mar 3, 2020

(polienv) [uchiha@pop-os src{master}]$ git show
commit 9994fd6a8e939ac74e0385232b689c46aa59a906 (HEAD -> master, origin/master, origin/HEAD)
Merge: 77b2f9f 5224680
Author: Juan Luis Cano Rodríguez <hello@juanlu.space>
Date:   Tue Mar 3 17:01:49 2020 +0100

    Merge pull request #853 from iamabhishek0/fixes_#852
    
    Fixed Broken benchmarks Link

@iamabhishek0
Copy link
Contributor Author

iamabhishek0 commented Mar 3, 2020

Actually when I was setting up my virtual environment I did pip install .
But then I had to work on python 3.7.4 which was giving segmentation fault because of numba's bug.
So I created virtual environment using python3 -m virtualenv polienv and installed all the dependencies manually after which everything was working fine.
Sorry for installing the dependencies this way because I wasn't aware of flit install --symlink, I will give it a try today.

@astrojuanlu
Copy link
Member

astrojuanlu commented Mar 3, 2020

All right, sorry for the loooooooooong delay. I reproduced the "issue", now let me remember if it's actually a bug or a feature.

@astrojuanlu astrojuanlu removed the status:needs more info label Mar 3, 2020
@astrojuanlu
Copy link
Member

astrojuanlu commented Mar 3, 2020

This change was introduced in #827 and now the equivalent thing is to do ss.get_frame().

If you saw ss.frame in any place of the documentation then this is a bug, otherwise let's close it.

@iamabhishek0
Copy link
Contributor Author

iamabhishek0 commented Mar 3, 2020

@Juanlu001 Thank for your support, We could close this one after fixing the documentation.

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