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

Orbit.from_ephem error #1632

Open
Errabundo66 opened this issue Jun 29, 2023 · 0 comments
Open

Orbit.from_ephem error #1632

Errabundo66 opened this issue Jun 29, 2023 · 0 comments

Comments

@Errabundo66
Copy link

馃悶 Problem
Hello.
I'm trying to run some examples and always got an error in Orbit.from_ephem instruction.
For example in "Going to Mars" example code.

I'm trying to develop a code just for getting asteroids ephemeris, next years oppositions, Phase Angle, Phase Angle bisector longitude, etc. propagating a perturbed orbit with the gravitational forces from main planets and main asteroids (n-body).

I think it can be achieved with poliastro, but firstly I need to understand the sintaxis.

Thank you for your help.
Fernando

from astropy import units as u
from astropy import time

import numpy as np

from poliastro import iod
from poliastro.bodies import Earth, Mars, Sun
from poliastro.ephem import Ephem
from poliastro.maneuver import Maneuver
from poliastro.twobody import Orbit
from poliastro.util import time_range

from astropy.coordinates import solar_system_ephemeris

solar_system_ephemeris.set("jpl")

# Initial data
date_launch = time.Time("2011-11-26 15:02", scale="utc").tdb
date_arrival = time.Time("2012-08-06 05:17", scale="utc").tdb

earth = Ephem.from_body(Earth, time_range(date_launch, end=date_arrival))
mars = Ephem.from_body(Mars, time_range(date_launch, end=date_arrival))

# Solve for departure and target orbits
orb_earth = Orbit.from_ephem(Sun, earth, date_launch)
orb_mars = Orbit.from_ephem(Sun, mars, date_arrival)

TypeError                                 Traceback (most recent call last)
Cell In[5], line 2
      1 # Solve for departure and target orbits
----> 2 orb_earth = Orbit.from_ephem(Sun, earth, date_launch)
      3 orb_mars = Orbit.from_ephem(Sun, mars, date_arrival)

File [~/anaconda3/envs/New/lib/python3.11/site-packages/poliastro/twobody/orbit/creation.py:240](https://file+.vscode-resource.vscode-cdn.net/Users/fhuet/Library/CloudStorage/OneDrive-Personal/Python/poliastro-main/~/anaconda3/envs/New/lib/python3.11/site-packages/poliastro/twobody/orbit/creation.py:240), in OrbitCreationMixin.from_ephem(cls, attractor, ephem, epoch)
    222 @classmethod
    223 def from_ephem(cls, attractor, ephem, epoch):
    224     """Create osculating orbit from ephemerides at a given epoch.
    225 
    226     This will assume that the `Ephem` coordinates
   (...)
    237 
    238     """
    239     return cls.from_vectors(
--> 240         attractor, *ephem.rv(epoch), epoch, ephem.plane
    241     )

File [~/anaconda3/envs/New/lib/python3.11/site-packages/poliastro/ephem.py:354](https://file+.vscode-resource.vscode-cdn.net/Users/fhuet/Library/CloudStorage/OneDrive-Personal/Python/poliastro-main/~/anaconda3/envs/New/lib/python3.11/site-packages/poliastro/ephem.py:354), in Ephem.rv(self, epochs, **kwargs)
    343 def rv(self, epochs=None, **kwargs):
    344     """Position and velocity vectors at given epochs.
    345 
    346     Parameters
...
-> 1688     args, kwargs, unit, out = function_helper(*args, **kwargs)
   1689 except NotImplementedError:
   1690     return self._not_implemented_or_raise(function, types)

TypeError: concatenate() got an unexpected keyword argument 'dtype'
-->

馃枼 Please paste the output of following commands

  • conda info -a (only if you have conda)
  • conda list (only if you have conda)
  • pip freeze
# Paste your output here:
(New) fhuet@Fernandos-MacBook-Air poliastro-main % conda info -a

     active environment : New
    active env location : /Users/fhuet/anaconda3/envs/New
            shell level : 2
       user config file : /Users/fhuet/.condarc
 populated config files : /Users/fhuet/.condarc
          conda version : 23.5.0
    conda-build version : 3.25.0
         python version : 3.10.9.final.0
       virtual packages : __archspec=1=arm64
                          __osx=13.4.1=0
                          __unix=0=0
       base environment : /Users/fhuet/anaconda3  (writable)
      conda av data dir : /Users/fhuet/anaconda3/etc/conda
  conda av metadata url : None
           channel URLs : https://repo.anaconda.com/pkgs/main/osx-arm64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/osx-arm64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /Users/fhuet/anaconda3/pkgs
                          /Users/fhuet/.conda/pkgs
       envs directories : /Users/fhuet/anaconda3/envs
                          /Users/fhuet/.conda/envs
               platform : osx-arm64
             user-agent : conda/23.5.0 requests/2.29.0 CPython/3.10.9 Darwin/22.5.0 OSX/13.4.1
                UID:GID : 501:20
             netrc file : None
           offline mode : False


# conda environments:
#
base                     /Users/fhuet/anaconda3
New                   *  /Users/fhuet/anaconda3/envs/New

sys.version: 3.10.9 (main, Mar  1 2023, 12:20:14) [Cl...
sys.prefix: /Users/fhuet/anaconda3
sys.executable: /Users/fhuet/anaconda3/bin/python
conda location: /Users/fhuet/anaconda3/lib/python3.10/site-packages/conda
conda-build: /Users/fhuet/anaconda3/bin/conda-build
conda-content-trust: /Users/fhuet/anaconda3/bin/conda-content-trust
conda-convert: /Users/fhuet/anaconda3/bin/conda-convert
conda-debug: /Users/fhuet/anaconda3/bin/conda-debug
conda-develop: /Users/fhuet/anaconda3/bin/conda-develop
conda-env: /Users/fhuet/anaconda3/bin/conda-env
conda-index: /Users/fhuet/anaconda3/bin/conda-index
conda-inspect: /Users/fhuet/anaconda3/bin/conda-inspect
conda-metapackage: /Users/fhuet/anaconda3/bin/conda-metapackage
conda-pack: /Users/fhuet/anaconda3/bin/conda-pack
conda-render: /Users/fhuet/anaconda3/bin/conda-render
conda-repo: /Users/fhuet/anaconda3/bin/conda-repo
conda-server: /Users/fhuet/anaconda3/bin/conda-server
conda-skeleton: /Users/fhuet/anaconda3/bin/conda-skeleton
conda-token: /Users/fhuet/anaconda3/bin/conda-token
conda-verify: /Users/fhuet/anaconda3/bin/conda-verify
user site dirs: 

CIO_TEST: <not set>
CONDA_DEFAULT_ENV: New
CONDA_EXE: /Users/fhuet/anaconda3/bin/conda
CONDA_PREFIX: /Users/fhuet/anaconda3/envs/New
CONDA_PREFIX_1: /Users/fhuet/anaconda3
CONDA_PROMPT_MODIFIER: (New) 
CONDA_PYTHON_EXE: /Users/fhuet/anaconda3/bin/python
CONDA_ROOT: /Users/fhuet/anaconda3
CONDA_SHLVL: 2
CURL_CA_BUNDLE: <not set>
LD_PRELOAD: <not set>
PATH: /usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/fhuet/anaconda3/envs/New/bin:/Users/fhuet/anaconda3/condabin
REQUESTS_CA_BUNDLE: <not set>
SSL_CERT_FILE: <not set>
# Paste your output here:
(New) fhuet@Fernandos-MacBook-Air poliastro-main % conda list
# packages in environment at /Users/fhuet/anaconda3/envs/New:
#
# Name                    Version                   Build  Channel
appnope                   0.1.2           py311hca03da5_1001  
astropy                   5.1                      pypi_0    pypi
astroquery                0.4.6                    pypi_0    pypi
asttokens                 2.0.5              pyhd3eb1b0_0  
attrs                     23.1.0                   pypi_0    pypi
backcall                  0.2.0              pyhd3eb1b0_0  
beautifulsoup4            4.12.2                   pypi_0    pypi
blas                      1.0                    openblas  
bottleneck                1.3.5           py311ha0d4635_0  
brotlipy                  0.7.0           py311h80987f9_1002  
bzip2                     1.0.8                h620ffc9_4  
ca-certificates           2023.05.30           hca03da5_0  
certifi                   2023.5.7        py311hca03da5_0  
cffi                      1.15.1          py311h80987f9_3  
charset-normalizer        2.0.4              pyhd3eb1b0_0  
comm                      0.1.2           py311hca03da5_0  
contourpy                 1.1.0                    pypi_0    pypi
cryptography              39.0.1          py311h834c97f_0  
cycler                    0.11.0                   pypi_0    pypi
debugpy                   1.5.1           py311h313beb8_0  
decorator                 5.1.1              pyhd3eb1b0_0  
executing                 0.8.3              pyhd3eb1b0_0  
fastjsonschema            2.17.1                   pypi_0    pypi
fonttools                 4.40.0                   pypi_0    pypi
html5lib                  1.1                      pypi_0    pypi
idna                      3.4             py311hca03da5_0  
importlib-metadata        6.7.0                    pypi_0    pypi
iniconfig                 2.0.0                    pypi_0    pypi
ipykernel                 6.19.2          py311h37496c9_0  
ipython                   8.12.0          py311hca03da5_0  
jaraco-classes            3.2.3                    pypi_0    pypi
jedi                      0.18.1          py311hca03da5_1  
jplephem                  2.18                     pypi_0    pypi
jsonschema                4.17.3                   pypi_0    pypi
jupyter-core              5.3.1                    pypi_0    pypi
jupyter_client            8.1.0           py311hca03da5_0  
jupyter_core              5.3.0           py311hca03da5_0  
keyring                   24.2.0                   pypi_0    pypi
kiwisolver                1.4.4                    pypi_0    pypi
libcxx                    14.0.6               h848a8c0_0  
libffi                    3.4.4                hca03da5_0  
libgfortran               5.0.0           11_3_0_hca03da5_28  
libgfortran5              11.3.0              h009349e_28  
libopenblas               0.3.21               h269037a_0  
libsodium                 1.0.18               h1a28f6b_0  
llvm-openmp               14.0.6               hc6e5704_0  
llvmlite                  0.40.1                   pypi_0    pypi
matplotlib                3.7.1                    pypi_0    pypi
matplotlib-inline         0.1.6           py311hca03da5_0  
mimeparse                 0.1.3                    pypi_0    pypi
more-itertools            9.1.0                    pypi_0    pypi
ncurses                   6.4                  h313beb8_0  
nest-asyncio              1.5.6           py311hca03da5_0  
numba                     0.57.1                   pypi_0    pypi
numexpr                   2.8.4           py311h6dc990b_1  
numpy                     1.24.3          py311hb57d4eb_0  
numpy-base                1.24.3          py311h1d85a46_0  
openssl                   1.1.1u               h1a28f6b_0  
packaging                 23.1                     pypi_0    pypi
pandas                    1.5.3           py311h6956b77_0  
parso                     0.8.3              pyhd3eb1b0_0  
pexpect                   4.8.0              pyhd3eb1b0_3  
pickleshare               0.7.5           pyhd3eb1b0_1003  
pillow                    9.5.0                    pypi_0    pypi
pip                       23.0.1          py311hca03da5_0  
platformdirs              3.8.0                    pypi_0    pypi
plotly                    5.15.0                   pypi_0    pypi
pluggy                    1.2.0                    pypi_0    pypi
poliastro                 0.18.dev0                pypi_0    pypi
prompt-toolkit            3.0.36          py311hca03da5_0  
psutil                    5.9.0           py311h80987f9_0  
ptyprocess                0.7.0              pyhd3eb1b0_2  
pure_eval                 0.2.2              pyhd3eb1b0_0  
pycparser                 2.21               pyhd3eb1b0_0  
pyerfa                    2.0.0           py311h80987f9_0  
pygments                  2.15.1          py311hca03da5_1  
pymeeus                   0.5.11             pyhd3eb1b0_1  
pyopenssl                 23.0.0          py311hca03da5_0  
pyparsing                 3.1.0                    pypi_0    pypi
pyrsistent                0.19.3                   pypi_0    pypi
pysocks                   1.7.1           py311hca03da5_0  
pytest                    7.4.0                    pypi_0    pypi
python                    3.11.3               hc0d8a6c_0  
python-dateutil           2.8.2              pyhd3eb1b0_0  
pytz                      2022.7          py311hca03da5_0  
pyvo                      1.4.1                    pypi_0    pypi
pyyaml                    6.0             py311h80987f9_1  
pyzmq                     25.1.0          py311h313beb8_0  
readline                  8.2                  h1a28f6b_0  
requests                  2.29.0          py311hca03da5_0  
retrying                  1.3.4                    pypi_0    pypi
scipy                     1.11.0                   pypi_0    pypi
setuptools                67.8.0          py311hca03da5_0  
sgp4                      2.22                     pypi_0    pypi
six                       1.16.0             pyhd3eb1b0_1  
skyfield                  1.46                     pypi_0    pypi
soupsieve                 2.4.1                    pypi_0    pypi
spiceypy                  5.1.2                    pypi_0    pypi
sqlite                    3.41.2               h80987f9_0  
stack_data                0.2.0              pyhd3eb1b0_0  
tenacity                  8.2.2                    pypi_0    pypi
tk                        8.6.12               hb8d0fd4_0  
tornado                   6.2             py311h80987f9_0  
traitlets                 5.9.0                    pypi_0    pypi
tzdata                    2023c                h04d1e81_0  
urllib3                   1.26.15         py311hca03da5_0  
wcwidth                   0.2.5              pyhd3eb1b0_0  
webencodings              0.5.1                    pypi_0    pypi
wheel                     0.38.4          py311hca03da5_0  
xz                        5.4.2                h80987f9_0  
yaml                      0.2.5                h1a28f6b_0  
zeromq                    4.3.4                hc377ac9_0  
zipp                      3.15.0                   pypi_0    pypi
zlib                      1.2.13               h5a0b063_0  


(New) fhuet@Fernandos-MacBook-Air poliastro-main % pip freeze
appnope @ file:///Users/cbousseau/work/recipes/ci_py311/appnope_1677917710869/work
astropy @ file:///Users/cbousseau/work/recipes/ci_py311_2/astropy_1678994125362/work
astroquery==0.4.6
asttokens @ file:///opt/conda/conda-bld/asttokens_1646925590279/work
attrs==23.1.0
backcall @ file:///home/ktietz/src/ci/backcall_1611930011877/work
beautifulsoup4==4.12.2
Bottleneck @ file:///Users/cbousseau/work/recipes/ci_py311/bottleneck_1677925122241/work
brotlipy==0.7.0
certifi @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_5c4sjwommo/croot/certifi_1683875376620/work/certifi
cffi @ file:///Users/cbousseau/work/recipes/ci_py311/cffi_1677903595907/work
charset-normalizer @ file:///tmp/build/80754af9/charset-normalizer_1630003229654/work
comm @ file:///Users/cbousseau/work/recipes/ci_py311/comm_1677919149446/work
contourpy==1.1.0
cryptography @ file:///Users/cbousseau/work/recipes/ci_py311_2/cryptography_1678994456782/work
cycler==0.11.0
debugpy @ file:///Users/cbousseau/work/recipes/ci_py311/debugpy_1677919321378/work
decorator @ file:///opt/conda/conda-bld/decorator_1643638310831/work
executing @ file:///opt/conda/conda-bld/executing_1646925071911/work
fastjsonschema==2.17.1
fonttools==4.40.0
html5lib==1.1
idna @ file:///Users/cbousseau/work/recipes/ci_py311/idna_1677906072337/work
importlib-metadata==6.7.0
iniconfig==2.0.0
ipykernel @ file:///Users/cbousseau/work/recipes/ci_py311/ipykernel_1677921035781/work
ipython @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_2bkl1d0l7u/croot/ipython_1680701883396/work
jaraco.classes==3.2.3
jedi @ file:///Users/cbousseau/work/recipes/ci_py311_2/jedi_1678994967789/work
jplephem==2.18
jsonschema==4.17.3
jupyter_client @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_701yya0pqm/croot/jupyter_client_1680171868326/work
jupyter_core @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_d1sy1hlz9t/croot/jupyter_core_1679906585151/work
keyring==24.2.0
kiwisolver==1.4.4
llvmlite==0.40.1
matplotlib==3.7.1
matplotlib-inline @ file:///Users/cbousseau/work/recipes/ci_py311/matplotlib-inline_1677918241899/work
mimeparse==0.1.3
more-itertools==9.1.0
nest-asyncio @ file:///Users/cbousseau/work/recipes/ci_py311/nest-asyncio_1677912430289/work
numba==0.57.1
numexpr @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_76yyu1p9jk/croot/numexpr_1683221830860/work
numpy @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_f9f5xs2fx0/croot/numpy_and_numpy_base_1682520577456/work
packaging==23.1
pandas==1.5.3
parso @ file:///opt/conda/conda-bld/parso_1641458642106/work
pexpect @ file:///tmp/build/80754af9/pexpect_1605563209008/work
pickleshare @ file:///tmp/build/80754af9/pickleshare_1606932040724/work
Pillow==9.5.0
platformdirs==3.8.0
plotly==5.15.0
pluggy==1.2.0
poliastro @ https://github.com/poliastro/poliastro/archive/main.zip
prompt-toolkit @ file:///Users/cbousseau/work/recipes/ci_py311/prompt-toolkit_1677918689663/work
psutil @ file:///Users/cbousseau/work/recipes/ci_py311_2/psutil_1678995687212/work
ptyprocess @ file:///tmp/build/80754af9/ptyprocess_1609355006118/work/dist/ptyprocess-0.7.0-py2.py3-none-any.whl
pure-eval @ file:///opt/conda/conda-bld/pure_eval_1646925070566/work
pycparser @ file:///tmp/build/80754af9/pycparser_1636541352034/work
pyerfa @ file:///Users/cbousseau/work/recipes/ci_py311/pyerfa_1677933632816/work
Pygments @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_29bs9f_dh9/croot/pygments_1684279974747/work
PyMeeus @ file:///tmp/build/80754af9/pymeeus_1634069098549/work
pyOpenSSL @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_ddecjfxr7g/croot/pyopenssl_1678965309681/work
pyparsing==3.1.0
pyrsistent==0.19.3
PySocks @ file:///Users/cbousseau/work/recipes/ci_py311/pysocks_1677906386870/work
pytest==7.4.0
python-dateutil @ file:///tmp/build/80754af9/python-dateutil_1626374649649/work
pytz @ file:///Users/cbousseau/work/recipes/ci_py311/pytz_1677920497588/work
pyvo==1.4.1
PyYAML @ file:///Users/cbousseau/work/recipes/ci_py311/pyyaml_1677927153992/work
pyzmq @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_23n9bfwjq5/croot/pyzmq_1686601381911/work
requests @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_37wt8ycste/croot/requests_1682607533309/work
retrying==1.3.4
scipy==1.11.0
sgp4==2.22
six @ file:///tmp/build/80754af9/six_1644875935023/work
skyfield==1.46
soupsieve==2.4.1
spiceypy==5.1.2
stack-data @ file:///opt/conda/conda-bld/stack_data_1646927590127/work
tenacity==8.2.2
tornado @ file:///Users/cbousseau/work/recipes/ci_py311/tornado_1677913116168/work
traitlets @ file:///Users/cbousseau/work/recipes/ci_py311/traitlets_1677911650502/work
urllib3 @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_c7xh0_scrc/croot/urllib3_1680254693282/work
wcwidth @ file:///Users/ktietz/demo/mc3/conda-bld/wcwidth_1629357192024/work
webencodings==0.5.1
zipp==3.15.0

馃挕 Possible solutions

馃搵 Steps to solve the problem

  • Comment below about what you've started working on.
  • Add, commit, push your changes
  • Submit a pull request and add this in comments - Addresses #<put issue number here>
  • Ask for a review in comments section of pull request
  • Celebrate your contribution to this project 馃帀
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant