Skip to content
Permalink
Browse files

Merge aa1ed32 into 717e4ad

  • Loading branch information...
mommermi committed Feb 5, 2019
2 parents 717e4ad + aa1ed32 commit af87c669008b3b5ccaa70e7bf45e6afd621d0e11
Showing with 214 additions and 210 deletions.
  1. +7 −8 .travis.yml
  2. +2 −2 docs/index.rst
  3. +151 −121 docs/sbpy/data.rst
  4. +1 −0 requirements.txt
  5. +0 −38 sbpy/conftest.py
  6. +2 −2 sbpy/data/__init__.py
  7. +27 −23 sbpy/data/ephem.py
  8. +24 −16 sbpy/data/orbit.py
@@ -32,17 +32,15 @@ env:
- ASTROPY_VERSION=stable
- MAIN_CMD='python setup.py'
- SETUP_CMD='test'
#- PIP_DEPENDENCIES=''
- EVENT_TYPE='pull_request push'


# List other runtime dependencies for the package that are available as
# conda packages here.
- CONDA_DEPENDENCIES=''

# List other runtime dependencies for the package that are available as
# pip packages here.
- PIP_DEPENDENCIES='numpy matplotlib ads scipy synphot https://github.com/astropy/astroquery/archive/master.zip'
- PIP_DEPENDENCIES='pip==18.1 numpy matplotlib ads scipy synphot https://github.com/astropy/astroquery/archive/master.zip pytest>=3.6 pytest-astropy'

# Conda packages for affiliated packages are hosted in channel
# "astropy" while builds for astropy LTS with recent numpy versions
@@ -59,10 +57,9 @@ env:

matrix:
# Make sure that egg_info works without dependencies
- PYTHON_VERSION=3.4 SETUP_CMD='egg_info'
- PYTHON_VERSION=3.5 SETUP_CMD='egg_info'
- PYTHON_VERSION=3.6 SETUP_CMD='egg_info'

- PYTHON_VERSION=3.7 SETUP_CMD='egg_info'
matrix:

# Don't wait for allowed failures
@@ -81,7 +78,7 @@ matrix:
- os: linux
env: SETUP_CMD='test --coverage'

# Now try Astropy dev and LTS vesions with the latest 3.x and 2.7.
# Now try Astropy dev and LTS vesions with the latest 3.x
- os: linux
env: ASTROPY_VERSION=development
EVENT_TYPE='pull_request push cron'
@@ -94,10 +91,12 @@ matrix:
# versions of Python, we can vary Python and Numpy versions at the same
# time.

- os: linux
env: PYTHON_VERSION=3.4 NUMPY_VERSION=1.10
- os: linux
env: PYTHON_VERSION=3.5 NUMPY_VERSION=1.11
- os: linux
env: PYTHON_VERSION=3.6 NUMPY_VERSION=1.11
- os: linux
env: PYTHON_VERSION=3.7 NUMPY_VERSION=1.11

# Try numpy pre-release
- os: linux
@@ -31,7 +31,7 @@ Please note that this package is currently under heavy development.
Installation
------------

`sbpy` requires Python 3.x - compatibility with Python 2.x is not
`sbpy` requires Python 3.5+ - compatibility with Python 2.x is not
supported. We hence recommend that you install the latest version of
`Anaconda Python 3.x <https://www.anaconda.com/download/>`_ on your
system before installing `sbpy`. Make sure that Anaconda Python is
@@ -42,7 +42,7 @@ Requirements

`sbpy` has the following requirements (incomplete):

* Python 3
* Python 3.5 or later
* `numpy <https://www.numpy.org/>` 1.4.0 or later
* pytest 3.1 or later
* `astropy <https://www.astropy.org/>`

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -1,3 +1,4 @@
pip=18.1
numpy>=1.4.0
astropy-helpers
matplotlib

This file was deleted.

Oops, something went wrong.
@@ -92,8 +92,8 @@ class Conf():
'CART': [None, 'au', 'au', 'au', 'au/d', 'au/d',
'au/d', None, 'd', None, 'mag', None]}

oorb_ephem_fields = ['MJD', 'RA', 'DEC', 'RA*cos(Dec)_rate', 'DEC_rate', 'alpha',
'elong', 'r', 'Delta', 'V', 'pa', 'TopEclLon',
oorb_ephem_fields = ['MJD', 'RA', 'DEC', 'RA*cos(Dec)_rate', 'DEC_rate',
'alpha', 'elong', 'r', 'Delta', 'V', 'pa', 'TopEclLon',
'TopEclLat', 'OppTopEclLon', 'OppTopEclLat',
'HelEclLon', 'HelEclLat', 'OppHelEclLon',
'OppHelEclLat', 'EL', 'ELsun', 'ELmoon',
@@ -492,28 +492,27 @@ def from_oo(self, orbit, epochs=None, location='500', scope='full',
>>> from sbpy.data import Orbit, Ephem
>>> from astropy.time import Time
>>> epochs = Time.now().jd + np.arange(0, 10, 1/24)
>>> ceres = Orbit.from_horizons('1') # doctest: +SKIP
>>> ceres = Orbit.from_horizons('1')
>>> eph = Ephem.from_oo(ceres, epochs=epochs, location='G37') # doctest: +SKIP
>>> print(eph.table) # doctest: +SKIP
targetname MJD [1] ... obsy [1] obsz [1]
d ... AU AU
---------- ------------------ ... --------------------- ----------------------
1 Ceres 58374.720415079966 ... -0.1640418731222332 1.3660753531152814e-05
1 Ceres 58374.76208174648 ... -0.16334416599555382 1.6732994041007698e-05
1 Ceres 58374.803748413455 ... -0.16264729902661218 2.0200328928084155e-05
1 Ceres 58374.845415079966 ... -0.16195072092478624 2.3823231905778508e-05
1 Ceres 58374.88708174648 ... -0.16125385509757997 2.735153478080482e-05
1 Ceres 58374.928748413455 ... -0.16055613920683476 3.0541568772989025e-05
... ... ... ... ...
1 Ceres 58384.428748413455 ... 0.0016096754330388497 9.924120661052244e-06
1 Ceres 58384.470415079966 ... 0.0023287044344341605 7.69766111133525e-06
1 Ceres 58384.51208174648 ... 0.0030458232636104473 6.300640241761616e-06
1 Ceres 58384.553748413455 ... 0.003760809893911351 5.8280310798125914e-06
1 Ceres 58384.595415079966 ... 0.004473588211662766 6.311456253324348e-06
1 Ceres 58384.63708174648 ... 0.005184233254950517 7.717021060406424e-06
1 Ceres 58384.678748413455 ... 0.005892966025131429 9.947635868821306e-06
Length = 240 rows
"""
>>> print(eph) # doctest: +SKIP
<QTable length=240>
targetname epoch ... obsz trueanom
d ... AU deg
str7 float64 ... float64 float64
---------- ------------------ ... ----------------------- -----------------
1 Ceres 2458519.316966272 ... 3.2083678848104924e-06 68.0863831954328
1 Ceres 2458519.3586329385 ... 2.7022422510736277e-07 68.09589266358881
1 Ceres 2458519.4002996054 ... -3.111046209036683e-06 68.10540191585879
1 Ceres 2458519.441966272 ... -6.700369254264427e-06 68.11491095202307
1 Ceres 2458519.4836329385 ... -1.0248419404668141e-05 68.12441977218093
1 Ceres 2458519.5252996054 ... -1.3508703580356052e-05 68.13392837643161
... ... ... ... ...
1 Ceres 2458529.066966272 ... 1.2522500440509399e-05 70.30569661787204
1 Ceres 2458529.1086329385 ... 1.4101698473351076e-05 70.31515536712485
1 Ceres 2458529.1502996054 ... 1.4771304981564537e-05 70.3246138990413
1 Ceres 2458529.191966272 ... 1.448582020449618e-05 70.33407221340468
1 Ceres 2458529.2336329385 ... 1.326517587380005e-05 70.34353031031534
1 Ceres 2458529.2752996054 ... 1.1193369555934085e-05 70.35298818987367 """

import pyoorb

@@ -570,6 +569,10 @@ def from_oo(self, orbit, epochs=None, location='500', scope='full',
epochs = [Time.now()]
elif isinstance(epochs, Time):
epochs = [Time(epochs)]
elif isinstance(epochs, (float, int)):
epochs = [Time(epochs, format='jd')]
elif isinstance(epochs, str):
epochs = [Time(epochs, format='iso')]
elif isinstance(epochs, (list, tuple, ndarray)):
new_epochs = [None] * len(epochs)
for i in range(len(epochs)):
@@ -616,8 +619,9 @@ def from_oo(self, orbit, epochs=None, location='500', scope='full',
name='targetname'),
index=0)

# remove trueanom column for now as it only holds a dummy value
ephem.table.remove_column('trueanom')
# convert MJD to Julian Date
ephem.add_column(ephem['MJD']+2400000.5*u.d, name='epoch', index=1)
ephem._table.remove_column('MJD')

if bib.status() is None or bib.status():
bib.register('sbpy.data.Ephem.from_oo',
@@ -9,7 +9,7 @@
created on June 04, 2017
"""
import os
from numpy import array, ndarray, double, arange
from numpy import array, ndarray, double, arange, rad2deg
from astropy.time import Time
from astropy.table import vstack, Column
from astroquery.jplhorizons import Horizons
@@ -352,12 +352,13 @@ def oo_transform(self, orbittype, timescale=None, ephfile='de430'):
>>> from sbpy.data import Orbit
>>> ceres = Orbit.from_horizons('Ceres')
>>> statevec = ceres.oo_transform('CART') # doctest: +SKIP
>>> print(statevec.table) # doctest: +SKIP
id x y ... epoch_scale H G
AU AU ... mag
------- ------------------ -------------------- ... ----------- ---- ----
1 Ceres -2.525066589355839 -0.34964875372044524 ... UTC 3.34 0.12
>>> print(statevec) # doctest: +SKIP
<QTable length=1>
id x y ... H G timescale
AU AU ... mag
str7 float64 float64 ... float64 float64 str2
------- ------------------ ------------------- ... ------- ------- ---------
1 Ceres -1.967176101061908 -1.7891189971612211 ... 3.34 0.12 TT
"""
import pyoorb

@@ -400,8 +401,11 @@ def oo_transform(self, orbittype, timescale=None, ephfile='de430'):

orbits = self.from_array(oo_orbits.transpose(), names=columns)

# apply units
for i, col in enumerate(orbits.column_names):
# convert from radians to degrees where unit == deg
if conf.oorb_orbit_units[orbittype][i] == 'deg':
orbits._table[col] = rad2deg(orbits[col])
# apply units
orbits[col].unit = conf.oorb_orbit_units[orbittype][i]

# replace id column with actual target names from original orbits
@@ -484,13 +488,14 @@ def oo_propagate(self, epoch, timescale='UTC',
>>> from astropy.time import Time
>>> epoch = Time.now().jd + 100
>>> ceres = Orbit.from_horizons('Ceres')
>>> future_ceres = ceres.oo_propagate(epoch) # doctest: +SKIP
>>> print(future_ceres.table) # doctest: +SKIP
id a e ... epoch_scale H G
AU ... mag
------- ----------------- ------------------- ... ----------- ---- ----
1 Ceres 2.767911178119476 0.07574650026062148 ... UTC 3.34 0.12
"""
>>> future_ceres = ceres.oo_propagate(epoch) # doctest: +SKIP
>>> print(future_ceres) # doctest: +SKIP
<QTable length=1>
id a e ... H G timescale
AU ... mag
str7 float64 float64 ... float64 float64 str3
------- ----------------- ------------------- ... ------- ------- ---------
1 Ceres 2.769331727251861 0.07605371361208543 ... 3.34 0.12 UTC """

import pyoorb

@@ -550,8 +555,11 @@ def oo_propagate(self, epoch, timescale='UTC',

orbits = self.from_array(oo_orbits.transpose(), names=columns)

# apply units
for i, col in enumerate(orbits.column_names):
# convert from radians to degrees where unit == deg
if conf.oorb_orbit_units[orbittype][i] == 'deg':
orbits._table[col] = rad2deg(orbits[col])
# apply units
orbits[col].unit = conf.oorb_orbit_units[orbittype][i]

# replace id column with actual target names from original orbits

0 comments on commit af87c66

Please sign in to comment.
You can’t perform that action at this time.