Skip to content
This repository has been archived by the owner on Oct 14, 2023. It is now read-only.

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

>>> 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

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

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

@astrojuanlu
Copy link
Member

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 Cannot reproduce problem in current state label Mar 3, 2020
@iamabhishek0
Copy link
Contributor Author

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

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

(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

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

(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

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

@iamabhishek0
Copy link
Contributor Author

(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

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

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 Cannot reproduce problem in current state label Mar 3, 2020
@astrojuanlu
Copy link
Member

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

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants