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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

from_sbdb unit tests fails with default installation #861

Closed
iMurfyD opened this issue Mar 14, 2020 · 6 comments
Closed

from_sbdb unit tests fails with default installation #861

iMurfyD opened this issue Mar 14, 2020 · 6 comments
Labels

Comments

@iMurfyD
Copy link
Contributor

@iMurfyD iMurfyD commented Mar 14, 2020

馃悶 Problem

馃枼 Please paste the output of following commands

  • conda info -a (only if you have conda)
(poliastropreinstalled) C:\Users\IMDes>conda info -a

     active environment : poliastropreinstalled
    active env location : C:\Users\IMDes\Anaconda3\envs\poliastropreinstalled
            shell level : 1
       user config file : C:\Users\IMDes\.condarc
 populated config files : C:\Users\IMDes\.condarc
          conda version : 4.8.2
    conda-build version : 3.18.9
         python version : 3.7.4.final.0
       virtual packages : __cuda=10.2
       base environment : C:\Users\IMDes\Anaconda3  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : C:\Users\IMDes\Anaconda3\pkgs
                          C:\Users\IMDes\.conda\pkgs
                          C:\Users\IMDes\AppData\Local\conda\conda\pkgs
       envs directories : C:\Users\IMDes\Anaconda3\envs
                          C:\Users\IMDes\.conda\envs
                          C:\Users\IMDes\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/4.8.2 requests/2.22.0 CPython/3.7.4 Windows/10 Windows/10.0.18362
          administrator : False
             netrc file : None
           offline mode : False

# conda environments:
#
base                     C:\Users\IMDes\Anaconda3
calc.py                  C:\Users\IMDes\Anaconda3\envs\calc.py
lowthrustsim             C:\Users\IMDes\Anaconda3\envs\lowthrustsim
plasmapydev              C:\Users\IMDes\Anaconda3\envs\plasmapydev
poliastropreinstalled  *  C:\Users\IMDes\Anaconda3\envs\poliastropreinstalled

sys.version: 3.7.4 (default, Aug  9 2019, 18:34:13) [...
sys.prefix: C:\Users\IMDes\Anaconda3
sys.executable: C:\Users\IMDes\Anaconda3\python.exe
conda location: C:\Users\IMDes\Anaconda3\lib\site-packages\conda
conda-build: C:\Users\IMDes\Anaconda3\Scripts\conda-build.exe
conda-convert: C:\Users\IMDes\Anaconda3\Scripts\conda-convert.exe
conda-debug: C:\Users\IMDes\Anaconda3\Scripts\conda-debug.exe
conda-develop: C:\Users\IMDes\Anaconda3\Scripts\conda-develop.exe
conda-env: C:\Users\IMDes\Anaconda3\Scripts\conda-env.exe
conda-index: C:\Users\IMDes\Anaconda3\Scripts\conda-index.exe
conda-inspect: C:\Users\IMDes\Anaconda3\Scripts\conda-inspect.exe
conda-metapackage: C:\Users\IMDes\Anaconda3\Scripts\conda-metapackage.exe
conda-render: C:\Users\IMDes\Anaconda3\Scripts\conda-render.exe
conda-server: C:\Users\IMDes\Anaconda3\Scripts\conda-server.exe
conda-skeleton: C:\Users\IMDes\Anaconda3\Scripts\conda-skeleton.exe
conda-verify: C:\Users\IMDes\Anaconda3\Scripts\conda-verify.exe
user site dirs:

AF_PATH: C:\Program Files\ArrayFire\v3
CIO_TEST: <not set>
CONDA_DEFAULT_ENV: poliastropreinstalled
CONDA_EXE: C:\Users\IMDes\Anaconda3\condabin\..\Scripts\conda.exe
CONDA_EXES: "C:\Users\IMDes\Anaconda3\condabin\..\Scripts\conda.exe"
CONDA_PREFIX: C:\Users\IMDes\Anaconda3\envs\poliastropreinstalled
CONDA_PROMPT_MODIFIER: (poliastropreinstalled)
CONDA_PYTHON_EXE: C:\Users\IMDes\Anaconda3\python.exe
CONDA_ROOT: C:\Users\IMDes\Anaconda3
CONDA_SHLVL: 1
CUDA_PATH: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2
HOMEPATH: \Users\IMDes
NVTOOLSEXT_PATH: C:\Program Files\NVIDIA Corporation\NvToolsExt\
PATH: C:\Users\IMDes\Anaconda3;C:\Users\IMDes\Anaconda3\Library\mingw-w64\bin;C:\Users\IMDes\Anaconda3\Library\usr\bin;C:\Users\IMDes\Anaconda3\Library\bin;C:\Users\IMDes\Anaconda3\Scripts;C:\Users\IMDes\Anaconda3\bin;C:\Users\IMDes\Anaconda3\envs\poliastropreinstalled;C:\Users\IMDes\Anaconda3\envs\poliastropreinstalled\Library\mingw-w64\bin;C:\Users\IMDes\Anaconda3\envs\poliastropreinstalled\Library\usr\bin;C:\Users\IMDes\Anaconda3\envs\poliastropreinstalled\Library\bin;C:\Users\IMDes\Anaconda3\envs\poliastropreinstalled\Scripts;C:\Users\IMDes\Anaconda3\envs\poliastropreinstalled\bin;C:\Users\IMDes\Anaconda3\condabin;C:\Users\IMDes\Anaconda3;C:\Users\IMDes\Anaconda3\Library\mingw-w64\bin;C:\Users\IMDes\Anaconda3\Library\usr\bin;C:\Users\IMDes\Anaconda3\Library\bin;C:\Users\IMDes\Anaconda3\Scripts;C:\Python27;C:\Python27\Scripts;C:\Program Files\Haskell\bin;C:\Program Files\Haskell Platform\8.6.5\lib\extralibs\bin;C:\Program Files\Haskell Platform\8.6.5\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\libnvvp;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS;C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Wolfram Research\WolframScript;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\WINDOWS\System32\OpenSSH;C:\Program Files\MATLAB\R2019b\bin;C:\TDM-GCC-64\bin;C:\Program Files\Microsoft SQL Server\120\Tools\Binn;C:\Program Files\PuTTY;C:\Program Files\NVIDIA Corporation\Nsight Compute 2019.5.0;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\Haskell Platform\8.6.5\mingw\bin;C:\Program Files\nodejs;C:\ProgramData\chocolatey\bin;C:\Users\IMDes\AppData\Roaming\cabal\bin;C:\Users\IMDes\AppData\Roaming\local\bin;C:\Users\IMDes\.cargo\bin;C:\Users\IMDes\AppData\Local\Microsoft\WindowsApps;C:\Users\IMDes\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\IMDes\AppData\Local\GitHubDesktop\bin;C:\Program Files\ArrayFire\v3\lib;C:\Users\IMDes\AppData\Local\Programs\MiKTeX 2.9\miktex\bin\x64;C:\Program Files\JetBrains\PyCharm 2019.3.1\bin;.;C:\Users\IMDes\AppData\Roaming\npm
PSMODULEPATH: C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
REQUESTS_CA_BUNDLE: <not set>
SSL_CERT_FILE: <not set>
VBOX_MSI_INSTALL_PATH: C:\Program Files\Oracle\VirtualBox\
  • conda list (only if you have conda)
(poliastropreinstalled) C:\Users\IMDes>conda list
# packages in environment at C:\Users\IMDes\Anaconda3\envs\poliastropreinstalled:
#
# Name                    Version                   Build  Channel
astropy                   3.2.3            py38hfa6e2cd_0    conda-forge
astroquery                0.4                        py_0    conda-forge
atomicwrites              1.3.0                      py_0    conda-forge
attrs                     19.3.0                     py_0    conda-forge
backcall                  0.1.0                    py38_0
beautifulsoup4            4.8.2                    py38_0    conda-forge
bleach                    3.1.1                      py_0    conda-forge
ca-certificates           2020.1.1                      0
certifi                   2019.11.28               py38_0
cffi                      1.14.0           py38ha419a9e_0    conda-forge
chardet                   3.0.4                 py38_1003    conda-forge
colorama                  0.4.3                      py_0
console_shortcut          0.1.1                         4
cryptography              2.8              py38hb32ad35_1    conda-forge
cycler                    0.10.0                     py_2    conda-forge
czml3                     0.5.3                    pypi_0    pypi
decorator                 4.4.2                      py_0
defusedxml                0.6.0                      py_0    conda-forge
entrypoints               0.3             py38h32f6830_1001    conda-forge
freetype                  2.10.0               h563cfd7_1    conda-forge
html5lib                  1.0.1                      py_0    conda-forge
hypothesis                5.6.0                      py_0    conda-forge
icc_rt                    2019.0.0             h0cc432a_1
icu                       58.2                 ha66f8fd_1
idna                      2.9                        py_1    conda-forge
importlib-metadata        1.5.0                    py38_0    conda-forge
importlib_metadata        1.5.0                         1    conda-forge
intel-openmp              2020.0                      166
ipykernel                 5.1.4            py38h39e3cac_0
ipython                   7.13.0           py38h5ca1d4c_0
ipython_genutils          0.2.0                    py38_0
ipywidgets                7.5.1                      py_0
jedi                      0.16.0                   py38_0
jinja2                    2.11.1                     py_0    conda-forge
jpeg                      9b                   hb83a4c4_2
jplephem                  2.13               pyhb958827_0    conda-forge
json5                     0.9.1                      py_0
jsonschema                3.2.0                    py38_0    conda-forge
jupyter_client            5.3.4                    py38_0
jupyter_core              4.6.1                    py38_0
jupyterlab                1.2.6              pyhf63ae98_0
jupyterlab_server         1.0.6                      py_0
keyring                   21.1.1                   py38_0    conda-forge
kiwisolver                1.1.0            py38heaebd3c_1    conda-forge
libblas                   3.8.0                    15_mkl    conda-forge
libcblas                  3.8.0                    15_mkl    conda-forge
liblapack                 3.8.0                    15_mkl    conda-forge
libpng                    1.6.37               h2a8f88b_0
libsodium                 1.0.16               h9d3ae62_0
llvmlite                  0.31.0                   py38_0    conda-forge
m2w64-gcc-libgfortran     5.3.0                         6
m2w64-gcc-libs            5.3.0                         7
m2w64-gcc-libs-core       5.3.0                         7
m2w64-gmp                 6.1.0                         2
m2w64-libwinpthread-git   5.0.0.4634.697f757               2
markupsafe                1.1.1            py38h9de7a3e_1    conda-forge
matplotlib                3.2.0                         1    conda-forge
matplotlib-base           3.2.0            py38h2981e6d_1    conda-forge
mistune                   0.8.4           py38hfa6e2cd_1000    conda-forge
mkl                       2020.0                      166
more-itertools            8.2.0                      py_0    conda-forge
msys2-conda-epoch         20160418                      1
nbconvert                 5.6.1                    py38_0    conda-forge
nbformat                  5.0.4                      py_0    conda-forge
nodejs                    10.13.0                       0
notebook                  6.0.3                    py38_0    conda-forge
numba                     0.48.0           py38he350917_0    conda-forge
numpy                     1.18.1           py38hc71023c_0    conda-forge
openssl                   1.1.1d               he774522_4
packaging                 20.1                       py_0    conda-forge
pandas                    1.0.2            py38hbe40bda_0    conda-forge
pandoc                    2.9.2                         0    conda-forge
pandocfilters             1.4.2                      py_1    conda-forge
parso                     0.6.1                      py_0
pickleshare               0.7.5                 py38_1000
pip                       20.0.2                   py38_1
plotly                    4.5.4              pyh8c360ce_0    conda-forge
pluggy                    0.13.1                   py38_0    conda-forge
poliastro                 0.13.0                     py_0    conda-forge
prometheus_client         0.7.1                      py_0    conda-forge
prompt_toolkit            3.0.3                      py_0
psutil                    5.7.0            py38hfa6e2cd_0    conda-forge
py                        1.8.1                      py_0    conda-forge
pycparser                 2.20                       py_0    conda-forge
pygments                  2.5.2                      py_0
pyopenssl                 19.1.0                     py_1    conda-forge
pyparsing                 2.4.6                      py_0    conda-forge
pyqt                      5.9.2            py38ha925a31_4
pyrsistent                0.15.7           py38hfa6e2cd_0    conda-forge
pysocks                   1.7.1                    py38_0    conda-forge
pytest                    5.4.1            py38h32f6830_0    conda-forge
pytest-arraydiff          0.3                        py_0    conda-forge
pytest-astropy            0.7.0                      py_0    conda-forge
pytest-astropy-header     0.1.2                      py_0    conda-forge
pytest-doctestplus        0.4.0                      py_0    conda-forge
pytest-openfiles          0.4.0                      py_0    conda-forge
pytest-remotedata         0.3.1                      py_0    conda-forge
python                    3.8.1           h5fd99cc_8_cpython
python-dateutil           2.8.1                      py_0
python_abi                3.8                      1_cp38    conda-forge
pytz                      2019.3                     py_0    conda-forge
pywin32                   227              py38he774522_1
pywin32-ctypes            0.2.0                 py38_1000    conda-forge
pywinpty                  0.5.7                    py38_0    conda-forge
pyzmq                     18.1.1           py38ha925a31_0
qt                        5.9.7            vc14h73c81de_0
qtconsole                 4.7.1                      py_0
qtpy                      1.9.0                      py_0
requests                  2.23.0                   py38_0    conda-forge
retrying                  1.3.3                      py_2    conda-forge
scipy                     1.3.2            py38h582fac2_0    conda-forge
send2trash                1.5.0                      py_0    conda-forge
setuptools                46.0.0                   py38_0
sip                       4.19.13          py38ha925a31_0
six                       1.14.0                   py38_0
sortedcontainers          2.1.0                      py_0    conda-forge
soupsieve                 1.9.4                    py38_0    conda-forge
sqlite                    3.31.1               he774522_0
terminado                 0.8.3                    py38_0    conda-forge
testpath                  0.4.4                      py_0    conda-forge
tornado                   6.0.4            py38he774522_1
traitlets                 4.3.3                    py38_0
urllib3                   1.25.7                   py38_0    conda-forge
vc                        14.1                 h0510ff6_4
vs2015_runtime            14.16.27012          hf0eaf9b_1
w3lib                     1.21.0                   pypi_0    pypi
wcwidth                   0.1.8                      py_0
webencodings              0.5.1                      py_1    conda-forge
wheel                     0.34.2                   py38_0
widgetsnbextension        3.5.1                    py38_0    conda-forge
win_inet_pton             1.1.0                    py38_0    conda-forge
wincertstore              0.2                      py38_0
winpty                    0.4.3                         4    conda-forge
zeromq                    4.3.1                h33f27b4_3
zipp                      3.1.0                      py_0    conda-forge
zlib                      1.2.11               h62dcd97_3
  • pip freeze
(poliastropreinstalled) C:\Users\IMDes>pip freeze
astropy==3.2.3
astroquery==0.4
atomicwrites==1.3.0
attrs==19.3.0
backcall==0.1.0
beautifulsoup4==4.8.2
bleach==3.1.1
certifi==2019.11.28
cffi==1.14.0
chardet==3.0.4
colorama==0.4.3
cryptography==2.8
cycler==0.10.0
czml3==0.5.3
decorator==4.4.2
defusedxml==0.6.0
entrypoints==0.3
html5lib==1.0.1
hypothesis==5.6.0
idna==2.9
importlib-metadata==1.5.0
ipykernel==5.1.4
ipython==7.13.0
ipython-genutils==0.2.0
ipywidgets==7.5.1
jedi==0.16.0
Jinja2==2.11.1
jplephem==2.13
json5==0.9.1
jsonschema==3.2.0
jupyter-client==5.3.4
jupyter-core==4.6.1
jupyterlab==1.2.6
jupyterlab-server==1.0.6
keyring==21.1.1
kiwisolver==1.1.0
llvmlite==0.31.0
MarkupSafe==1.1.1
matplotlib==3.2.0
mistune==0.8.4
more-itertools==8.2.0
nbconvert==5.6.1
nbformat==5.0.4
notebook==6.0.3
numba==0.48.0
numpy==1.18.1
packaging==20.1
pandas==1.0.2
pandocfilters==1.4.2
parso==0.6.1
pickleshare==0.7.5
plotly==4.5.4
pluggy==0.13.1
poliastro==0.13.0
prometheus-client==0.7.1
prompt-toolkit==3.0.3
psutil==5.7.0
py==1.8.1
pycparser==2.20
Pygments==2.5.2
pyOpenSSL==19.1.0
pyparsing==2.4.6
pyrsistent==0.15.7
PySocks==1.7.1
pytest==5.4.1
pytest-arraydiff==0.3
pytest-astropy==0.7.0
pytest-astropy-header==0.1.2
pytest-doctestplus==0.4.0
pytest-openfiles==0.4.0
pytest-remotedata==0.3.1
python-dateutil==2.8.1
pytz==2019.3
pywin32==227
pywin32-ctypes==0.2.0
pywinpty==0.5.7
pyzmq==18.1.1
qtconsole==4.7.1
QtPy==1.9.0
requests==2.23.0
retrying==1.3.3
scipy==1.3.2
Send2Trash==1.5.0
sip==4.19.13
six==1.14.0
sortedcontainers==2.1.0
soupsieve==1.9.4
terminado==0.8.3
testpath==0.4.4
tornado==6.0.4
traitlets==4.3.3
urllib3==1.25.7
w3lib==1.21.0
wcwidth==0.1.8
webencodings==0.5.1
widgetsnbextension==3.5.1
win-inet-pton==1.1.0
wincertstore==0.2
zipp==3.1.0

馃挕 Possible solutions
It looks like the SBDB entry for Ceres doesn't match the hard-coded value in the unit test (from the test failing) - in this case the inclination specifically. Check the source and make sure that the hard coded value in the unit test is actually the orbit of Ceres

馃搵 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 馃帀
@iMurfyD iMurfyD changed the title from_sbdb unit tests fails with default installation from_sbdb unit tests fails with default installation Mar 14, 2020
@iMurfyD
Copy link
Contributor Author

@iMurfyD iMurfyD commented Mar 14, 2020

Started to work on this. Previously ran this in v0.13 (the one currently installed in conda). Ran again with the current version on the github (0.14) and found a similar issue. For clarity, ss_classical is the orbit the code fetches from the DB, SBDB_DATA is the hard-coded value in the unit test. When stepping into pdb, I find the following:

Failing line: assert ss_classical == SBDB_DATA[target_name]

(Pdb) p ss_classical 
(<Quantity 2.76765685 AU>, <Quantity 0.07755702>, <Quantity 10.58862149 deg>, <Quantity 80.28698637 deg>, <Quantity 73.73167094 deg>, <Quantity 165.10574142 deg>)
(Pdb) p SBDB_DATA[target_name]
(<Quantity 2.76916515 AU>, <Quantity 0.07600903>, <Quantity 10.59406704 deg>, <Quantity 80.30553157 deg>, <Quantity 73.59769412 deg>, <Quantity 86.01851108 deg>)

Right now, the current entry on the JPL SBDB is:

Element Value Uncertainty (1-sigma) Units
e .07755702331559071 4.807e-12
a 2.767656854438644 1.0356e-11 au
q 2.553005627249392 1.947e-11 au
i 10.58862149177901 4.6132e-09 deg
node 80.28698636629558 6.1769e-08 deg
peri 73.73167094328808 6.6184e-08 deg
M 162.6862516879934 7.3559e-09 deg
tp 2458240.497283818471(2018-May-01.99728382) 3.6867e-08 TDB
period 1681.7707396078814.60 9.4391e-092.584e-11 dyr
n .2140600924499002 1.2014e-12 deg/d
Q 2.982308081627896 1.1159e-11 au

馃敠 What I think the problem is:
It looks like there's two problems here:

  1. The 6 static (a, e, i, node, and peri, n) orbital elements seem to drift periodically. Notice that the third and fourth decimal places seem to differ in all three spots. Presumably the orbit of Ceres perturbs, so that's what's causing this.
  2. The mean anomaly (M) is used as the epoch here. It looks like JPL updated this entry which threw off what was in the code here.

@astrojuanlu
Copy link
Member

@astrojuanlu astrojuanlu commented Mar 15, 2020

You're totally right @iMurfyD: this test is fragile because it depends on the latest data from JPL. So I see a few ways of fixing it:

  • Exploring the possibility to download an "old" version of the ephemerides, and freezing it
  • Rewriting the test so it has a more permissive tolerance
  • Rewriting the test so it doesn't compare "frozen data" with "live data" at all, and uses mocking instead
  • ?

What do you think?

@iMurfyD
Copy link
Contributor Author

@iMurfyD iMurfyD commented Mar 16, 2020

I didn't see an obvious way to download an "old" ephemerides.

I can see the upsides and downsides to each of these. Alternatively, I tried to write a test which compares the from_sbdb and from_horizons results. Still finalizing that.

I think comparing the two databases to each other would be the best idea since we maintain that we are trying to use the networking features of the method and are doing some type of comparison to make sure the thing which is downloaded and parsed into the software is more or less the right orbit.

Another option might be to manually scrape the website for the orbital elements and compare against that - although I'm not sure how different (and hence useful) that is from the actual implementation of the from_sbdb method.

@iMurfyD
Copy link
Contributor Author

@iMurfyD iMurfyD commented Mar 16, 2020

Implemented a unit test that cross references databases and submitted as a pull request:

#867

@iMurfyD iMurfyD closed this as completed Mar 16, 2020
@iMurfyD iMurfyD reopened this Mar 16, 2020
@iMurfyD
Copy link
Contributor Author

@iMurfyD iMurfyD commented Mar 16, 2020

Whoops :/

@astrojuanlu
Copy link
Member

@astrojuanlu astrojuanlu commented Mar 19, 2020

Fixed in #867!

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

No branches or pull requests

2 participants