nasa-planetary-science / sbpy Goto Github PK
View Code? Open in Web Editor NEWA Python package for small bodies research
Home Page: https://sbpy.org/
License: Other
A Python package for small bodies research
Home Page: https://sbpy.org/
License: Other
For sbpy.thermal
it would be great to have functionality in sbpy.photometry
such that, e.g., HG
models can be initialized with a geometric albedo or Bond albedo in order to calculate the target's radius (with H provided) or H (with radius provided).
Below code generates an error message:
from sbpy.data import Ephem
from astropy.time import Time
epochs = Time(['2015-01-01', '2015-01-02'])
eph = Ephem.from_horizons('Ceres', epochs=epochs)
The problem is that .from_horizons
doesn't handle epochs
value correctly when it contains multiple values. There are also other bugs for the case isinstance(epochs, (list, tuple, ndarray))
.
I tried testing the package after pip install pytest
, the only testing dependency listed in the docs, and got an error:
(sbpy37) juanlu@centauri /tmp/sbpy $ pytest -v
============================================= test session starts ==============================================
platform linux -- Python 3.7.3, pytest-4.6.2, py-1.8.0, pluggy-0.12.0 -- /home/juanlu/.miniconda36/envs/sbpy37/bin/python
cachedir: .pytest_cache
rootdir: /tmp/sbpy, inifile: setup.cfg
collecting ... /home/juanlu/.miniconda36/envs/sbpy37/lib/python3.7/site-packages/_pytest/mark/structures.py:337: PytestUnknownMarkWarning: Unknown pytest.mark.remote_data - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/latest/mark.html
PytestUnknownMarkWarning,
collected 0 items / 1 errors
==================================================== ERRORS ====================================================
________________________________________ ERROR collecting test session _________________________________________
/home/juanlu/.miniconda36/envs/sbpy37/lib/python3.7/site-packages/_pytest/config/__init__.py:440: in _importconftest
return self._conftestpath2mod[conftestpath]
E KeyError: local('/tmp/sbpy/sbpy/conftest.py')
During handling of the above exception, another exception occurred:
/home/juanlu/.miniconda36/envs/sbpy37/lib/python3.7/site-packages/_pytest/config/__init__.py:446: in _importconftest
mod = conftestpath.pyimport()
/home/juanlu/.miniconda36/envs/sbpy37/lib/python3.7/site-packages/py/_path/local.py:701: in pyimport
__import__(modname)
<frozen importlib._bootstrap>:983: in _find_and_load
???
<frozen importlib._bootstrap>:967: in _find_and_load_unlocked
???
<frozen importlib._bootstrap>:668: in _load_unlocked
???
<frozen importlib._bootstrap>:638: in _load_backward_compatible
???
/home/juanlu/.miniconda36/envs/sbpy37/lib/python3.7/site-packages/_pytest/assertion/rewrite.py:304: in load_module
exec(co, mod.__dict__)
sbpy/conftest.py:47: in <module>
TESTED_VERSIONS['astropy_helpers'] = astropy_helpers_version
E NameError: name 'astropy_helpers_version' is not defined
During handling of the above exception, another exception occurred:
/home/juanlu/.miniconda36/envs/sbpy37/lib/python3.7/site-packages/py/_path/common.py:377: in visit
for x in Visitor(fil, rec, ignore, bf, sort).gen(self):
/home/juanlu/.miniconda36/envs/sbpy37/lib/python3.7/site-packages/py/_path/common.py:418: in gen
dirs = self.optsort([p for p in entries
/home/juanlu/.miniconda36/envs/sbpy37/lib/python3.7/site-packages/py/_path/common.py:419: in <listcomp>
if p.check(dir=1) and (rec is None or rec(p))])
/home/juanlu/.miniconda36/envs/sbpy37/lib/python3.7/site-packages/_pytest/main.py:661: in _recurse
ihook = self.gethookproxy(dirpath)
/home/juanlu/.miniconda36/envs/sbpy37/lib/python3.7/site-packages/_pytest/main.py:482: in gethookproxy
my_conftestmodules = pm._getconftestmodules(fspath)
/home/juanlu/.miniconda36/envs/sbpy37/lib/python3.7/site-packages/_pytest/config/__init__.py:424: in _getconftestmodules
mod = self._importconftest(conftestpath.realpath())
/home/juanlu/.miniconda36/envs/sbpy37/lib/python3.7/site-packages/_pytest/config/__init__.py:463: in _importconftest
raise ConftestImportFailure(conftestpath, sys.exc_info())
E _pytest.config.ConftestImportFailure: (local('/tmp/sbpy/sbpy/conftest.py'), (<class 'NameError'>, NameError("name 'astropy_helpers_version' is not defined"), <traceback object at 0x7f5286892948>))
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
=========================================== 1 error in 0.61 seconds ============================================
This code is likely the cause:
Lines 40 to 47 in 9867a86
Via Martin Cordiner:
In [6]: Ephem.from_mpc('C/2016 R2', epochs={'start': '2018-11-15', 'stop': '2018-12-15', 'step': '1 min'})
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-6-5f1c7ea99ab5> in <module>()
----> 1 Ephem.from_mpc('C/2016 R2', epochs={'start': '2018-11-15', 'stop': '2018-12-15', 'step': '1 min'})
~/local/miniconda3/envs/astroconda/lib/python3.5/site-packages/sbpy-0.0.dev335-py3.5.egg/sbpy/data/ephem.py in from_mpc(cls, targetid, epochs, location, **kwargs)
243 if step.unit not in (u.d, u.h, u.m, u.s):
244 raise ValueError(
--> 245 'step must have units of days, hours, minutes,'
246 ' or seconds')
247
ValueError: step must have units of days, hours, minutes, or seconds
Problem is that u.m should be u.min.
There is a philosophical issue with the current state of SpectralStandard
. __call__
will interpolate if a single wavelength is passed, but will rebin when multiple wavelengths are passed.
Instead, I propose to only interpolate with __call__
and make a new method, observe()
which will always rebin. It could also handle multiple bandpasses, effectively replacing filt()
.
sun = sbpy.spectroscopy.sun.Sun()
w = [0.4, 0.5, 0.6] * u.um
# interpolated values
sun(w)
# rebinned values, i.e., return three flux densities centered on 0.4, 0.5,
# and 0.6 μm, averaged over 0.1 μm wide bandpasses
sun.observe(w)
# observe through an array of filters
sun.observe(('johnson_b', 'johnson_v', 'cousins_r'))
Also, I need to clean up the documentation and imports. Complete tests.
@migueldvb @gianninapr The target record numbers in test_spec_remote.py
are causing failures:
vega/tests/['DXREAD: requested IOBJ= 900918 is out of bounds, no action taken.\r', 'Record boundaries: ...001-90004391 \r', 'If an SPK ID, look-up with "DES= 900918;" \r', ...]
Because record numbers can change at any time, I recommending changing these to designations.
>>> from sbpy.activity import photo_lengthscale
>>> from sbpy import bib
>>> with bib.Tracking():
>>> gamma_H2O = photo_lengthscale('H2O')
>>> gamma_OH = photo_lengthscale('OH')
>>> print(bib.to_text())
activity.gas.photo_lengthscale:
OH photodissociation lengthscale: 1993Icar..105..235C
Expected: 2 items, one for water, one for OH.
SpectralGradient.from_color
, to be introduced in #103, can convert a color index to a spectral gradient given filter bandpasses. It estimates effective wavelengths of the bandpasses using the sbpy default solar spectrum.
Because the effective wavelength depends on the spectral shape of the object, we should have an optional iterate keyword that attempts to converge on a stable solution. It should also take some kind of reddening function, or else assume linear reddening.
>>> from sbpy.data import Ephem
>>> h = Ephem.from_horizons('2P', closest_apparition=True)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-20-3ed486ce555c> in <module>()
----> 1 h = Ephem.from_horizons('2P', closest_apparition=True)
/home/msk/local/lib/python3.6/site-packages/sbpy-0.0.dev296-py3.6.egg/sbpy/data/ephem.py in from_horizons(cls, targetids, id_type, epochs, location, **kwargs)
108 obj = Horizons(id=targetid, id_type=id_type,
109 location=location, epochs=epochs)
--> 110 eph = obj.ephemerides(**kwargs)
111
112 # workaround for current version of astroquery to make
/home/msk/local/lib/python3.6/site-packages/astroquery-0.3.9.dev4961-py3.6.egg/astroquery/utils/class_or_instance.py in f(*args, **kwds)
23 def f(*args, **kwds):
24 if obj is not None:
---> 25 return self.fn(obj, *args, **kwds)
26 else:
27 return self.fn(cls, *args, **kwds)
/home/msk/local/lib/python3.6/site-packages/astroquery-0.3.9.dev4961-py3.6.egg/astroquery/utils/process_asyncs.py in newmethod(self, *args, **kwargs)
27 if kwargs.get('get_query_payload') or kwargs.get('field_help'):
28 return response
---> 29 result = self._parse_result(response, verbose=verbose)
30 self.table = result
31 return result
/home/msk/local/lib/python3.6/site-packages/astroquery-0.3.9.dev4961-py3.6.egg/astroquery/jplhorizons/core.py in _parse_result(self, response, verbose)
1221 return None
1222 else:
-> 1223 data = self._parse_horizons(response.text)
1224
1225 return data
/home/msk/local/lib/python3.6/site-packages/astroquery-0.3.9.dev4961-py3.6.egg/astroquery/jplhorizons/core.py in _parse_horizons(self, src)
1117 err_msg)
1118 else:
-> 1119 raise ValueError(('Query failed without error message; '
1120 'check URI for more information'))
1121 # strip whitespaces from column labels
ValueError: Query failed without error message; check URI for more information
No object is returned, so a user cannot follow up on the error message without running a debugger.
Add methods to convert Afρ / εfρ to and from dust cross section.
But we don't support Python 2. This should be prevented. Exclude earlier Python 3 versions too?
I tried installing sbpy
in a clean conda environment (Python 3.6) and stumbled across the missing requirements, which are now fixed in #51.
One problem that still persists is that if you run setup.py install/develop
, the script will fail since astropy-helpers
requires numpy
before the setup routine (which will install numpy
) is even reached. No big issue for now: simply install numpy
and the setup script will install the rest.
However, it would be nice to have numpy
installed automatically, too. Any thoughts on this?
Consider that there are various estimates for the fluorescence band g-factors of CO2, e.g., Crovisier & Encrenaz 1983 vs. Debout et al. 2016. If we included both in activity.fluorescence_band_strength
and a user called both to determine the difference, only the last used citation will be tracked.
>>> from sbpy import bib
>>> with bib.Tracking():
>>> bib.register('task', {'g': 'reference 1'})
>>> bib.register('task', {'g': 'reference 2'})
>>> print(bib.to_text())
task:
g: reference 2
Perhaps the citations should be internally stored as lists, and new citations appended as needed.
pyoorb can currently not be installed using pip or any other service
pyoorb tests are deactivated if that module is not installed
todo:
This is a problem with the cookiecutter
template for astropy
affiliated packages.
Trying to do a python setup.py develop
, I get the following error:
Traceback (most recent call last):
File "setup.py", line 8, in <module>
import ah_bootstrap
ModuleNotFoundError: No module named 'ah_bootstrap'
astropy
and astropy-helper
are the latest version. I have to comment out the import
for ah_bootstrap in setup.py
to make it work. Can anyone reproduce this problem?
Those two functions should be deprecated and replaced with unit conversion supported by equivalency function reflectance
once #136 is merged.
just a reminder for us to add astroquery.jplspec
to the travis-CI and sphinx requirements, once it's released
Hi everyone, I'd like to contribute to the sbpy development. Specifically, the fitting routine for the different disk-integrated models in the sbpy.photometry.core module. I saw that there's already a placeholder in the code. I was looking for a package which is able to retrieve MPC observations and fit photometric models for my own research, so this is a nice opportunity to contribute, if no one else is already working on an implementation.
Some thoughts I noted down after a look at the photometry.core code:
hg = HG1G2() # TypeError
). When the model is supposed to be fit to the phase curve, that shouldn't be necessary (as the example already in place shows). There has to be a change here, but I'm unfamiliar with the astropy Parameter
class, so I can't yet say where exactly.params, chi2 = HG1G2().fit(phi_array, mag_array)
could be clear and easier for users unfamiliar with the package structureLet me know what you think, and other considerations you might have for this method.
Cheers
Max
Conversion to/from Vega magnitudes should assume Vega has a magnitude of 0.03 (Bessell and Murphy 2012).
Test that the calculated coefficients for spontaneous emission at 300K agree with the coefficients in the Leiden Atomic and Molecular Database (LAMDA) within a few percent tolerance for a few molecules. Some remote tests using the astroquery.lamda
package can be included.
Haser model tests are failing:
Using asserts for parameter testing is not good because asserts can be skipped with, e.g., python -O:
astropy/astropy#5556 (comment)
We should add support to non-LTE codes to infer physical and chemical parameters such as temperature, density, and production rates from spectroscopic observations. A python interface to run RADEX models has been developed and could be called from sbpy. The RADEX code is written in fortran and also has a command line interface. Wrapper functions in python would require using numpy.f2py
to provide a connection with the fortran code.
https://personal.sron.nl/~vdtak/radex/index.shtml
https://github.com/keflavich/pyradex
A v0.1
tag exists, however
https://github.com/NASA-Planetary-Science/sbpy/blob/v0.1/setup.cfg#L35
We've advertised sbpy at two meetings, and there is enough functionality to be useful to someone. Is it time to consider getting a DOI for the development version? Probably via zenodo.
Hi folks,
I see there's a 'to implement' on the SSOIS query in sbpy.data.image_query. You are welcome to use the astropy-based SSOIS query wrapper available here as a starting point: https://github.com/OSSOS/MOP/blob/master/src/ossos/core/ossos/ssos.py
This set of classes and functions is built around sending in a set of MPC-format lines for a newly found (i.e. undesignated) minor planet. The class ParamDictBuilder and Query, and the first part of function TrackTarget.query_ssos() will be the most useful (the rest of it is checking SSOIS's returned tables against an existing set of images to see if any are new).
This is a to-do list for open items before we can release v0.1 and submit to JOSS:
sbpy.photometry
updates (#134, @jianyangli)sbpy.activity
updated (#129, @mkelley)sbpy.spectroscopy
to follow rules (@migueldvb)If there is anything I did not mention here, simply reply and I will add it to the list.
Asteroid 1735 ITA (1948 RJ1) (named "ITA" in the astorb output file) triggers an exception in the Names class.
Names.parse_comet('ITA')
Parsing it as a comet returns {'name': 'ITA'}, but this is a main belt asteroid, and
Names.asteroid_or_comet('ITA')
returns 'comet'.
Just another special case to consider, I guess.
Seems to be because QTable and Quantity do not support masked columns.
import numpy as np
import astropy.units as u
from astropy.table import QTable
a = np.ma.MaskedArray([1, 2, 3], mask=[True, False, False])
q = a * u.m
tab = QTable(data=[a, q], names=['array', 'quantity'], masked=True)
print(tab)
array quantity
m
----- --------
-- 1.0
2 2.0
3 3.0
This is presently a problem with Ephem.from_horizons
, which drops the masks leaving zeros as column values. For example, it makes comet Encke a naked-eye object:
In [115]: print(Ephem.from_horizons('2P', 'designation', closest_apparition=True)[['Tmag', 'Nmag']])
Tmag Nmag
mag mag
----- ----
20.91 0.0
astropy/astropy#1852 looks like the main issue.
At some point, somebody mentioned to include albedo units to sbpy.units
. Is this still considered a good idea?
I merged Miguel's astropy_helpers
update (#95) since there where no build issues, but now all the Travis-CI builds seem to break. See here: https://travis-ci.org/NASA-Planetary-Science/sbpy/jobs/481600991
The problem seems to be ah_bootstrap
again - we had this issue in #1 and solved it by manually copying ah_boostrap.py
into the root directory. However, it seems that this is actually triggered when astroquery
is being installed. I know that they are currently having build issues, too. Should we wait and see if they can fix it, or is there anything we can do about this?
The implementation of production rate calculation from a Haser model (with and w/o photodissociation) can be tested with the published values in table 2 from this paper. The data is not available in vizier but it can be grabbed from the latex source in the arxiv:
https://arxiv.org/e-print/1202.3194
This functionality is part of the CINE library:
https://github.com/migueldvb/cine
Cite Newburn and Johnson 1978 for Haser model formulae.
There are some percent-level and larger errors in synphot, to be fixed with spacetelescope/synphot_refactor#166 . Fortunately, I don't think it affects sbpy tests at anything greater than the percent level. We should probably make a version requirement or throw a warning if an older version is used.
astroquery.nasa_ads
now supports the new ADS API (astropy/astroquery#1162).
As suggested by Henry Hsieh.
I'm stuck trying to understand this test failure (see also Travis logs). The code works for me by hand and my local machine cannot reproduce it. Is there a quick way I can duplicate the environment so that I can reproduce it?
_______________________ test_alternative_name_uniqueness _______________________
def test_alternative_name_uniqueness():
"""test the uniqueness of alternative field names"""
from ..core import conf
assert (len(sum(conf.fieldnames, [])) ==
len(set(sum(conf.fieldnames, []))))
E AssertionError: assert 133 == 132
E + where 133 = len(['targetname', 'id', 'Object', 'Target Identifier', 'i', 'inc', ...])
E + where ['targetname', 'id', 'Object', 'Target Identifier', 'i', 'inc', ...] = sum([['targetname', 'id', 'Object', 'Target Identifier'], ['i', 'inc', 'incl', 'Inclination'], ['epoch', 'datetime_jd', 'J...ng Node'], ['w', 'argper', 'Argument of the Periapsis'], ['r', 'rh', 'r_hel', 'heldist', 'Heliocentric Distance'], ...], [])
E + where [['targetname', 'id', 'Object', 'Target Identifier'], ['i', 'inc', 'incl', 'Inclination'], ['epoch', 'datetime_jd', 'J...ng Node'], ['w', 'argper', 'Argument of the Periapsis'], ['r', 'rh', 'r_hel', 'heldist', 'Heliocentric Distance'], ...] = <sbpy.data.Conf object at 0x7f036cf2c518>.fieldnames
E + and 132 = len({'AZ', 'Altitude', 'Argument of the Periapsis', 'Azimuth', 'D', 'DEC', ...})
E + where {'AZ', 'Altitude', 'Argument of the Periapsis', 'Azimuth', 'D', 'DEC', ...} = set(['targetname', 'id', 'Object', 'Target Identifier', 'i', 'inc', ...])
E + where ['targetname', 'id', 'Object', 'Target Identifier', 'i', 'inc', ...] = sum([['targetname', 'id', 'Object', 'Target Identifier'], ['i', 'inc', 'incl', 'Inclination'], ['epoch', 'datetime_jd', 'J...ng Node'], ['w', 'argper', 'Argument of the Periapsis'], ['r', 'rh', 'r_hel', 'heldist', 'Heliocentric Distance'], ...], [])
E + where [['targetname', 'id', 'Object', 'Target Identifier'], ['i', 'inc', 'incl', 'Inclination'], ['epoch', 'datetime_jd', 'J...ng Node'], ['w', 'argper', 'Argument of the Periapsis'], ['r', 'rh', 'r_hel', 'heldist', 'Heliocentric Distance'], ...] = <sbpy.data.Conf object at 0x7f036cf2c518>.fieldnames
sbpy/data/tests/test_dataclass.py:185: AssertionError
============== 1 failed, 236 passed, 48 skipped in 278.56 seconds ==============
Hi Michael - some more examples of names that fail:
V'yus
`I`iwi
`O`o
Unicode issues I expect.
(btw, I'm finding these by just loading the MPCORB.DAT file and running all the "readable names" column through sbpy.data.Names .. if you want a utility to read the MPCORB file (which might fit into your Orbits class?) we've got one at
https://github.com/rhiannonlynne/ssdpu/blob/master/catalog_utils.py which you are welcome to take and presumably modify).
I tried the first Orbit
example from the docs and the propagation raises an error:
In [1]: %cpaste
Pasting code; enter '--' alone on the line to stop or use Ctrl-D.
:>>> from sbpy.data import Orbit
>>> import astropy.units as u
>>> elements = {'a':1.234*u.au, 'e':0.1234, 'i':12.34*u.deg,
... 'argper': 123.4*u.deg, 'node': 45.2*u.deg,
... 'epoch': 2451200.5*u.d, 'true_anom':23.1*u.deg}
>>> orb = Orbit.from_dict(elements)
>>> print(orb) # doctest: +SKIP::::::
:<EOF>
<QTable length=1>
a e i argper node epoch true_anom
AU deg deg deg d deg
float64 float64 float64 float64 float64 float64 float64
------- ------- ------- ------- ------- --------- ---------
1.234 0.1234 12.34 123.4 45.2 2451200.5 23.1
In [2]: from astropy.time import Time
In [3]: orb.oo_propagate(Time.now())
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-3-e36fbfe450f5> in <module>
----> 1 orb.oo_propagate(Time.now())
~/.miniconda36/envs/sbpy37/lib/python3.7/site-packages/sbpy/data/orbit.py in oo_propagate(self, epoch, timescale, dynmodel, ephfile)
544
545 oo_orbits, err = pyoorb.pyoorb.oorb_propagation(
--> 546 in_orbits=self._to_oo(),
547 in_epoch=ooepoch,
548 in_dynmodel=dynmodel)
~/.miniconda36/envs/sbpy37/lib/python3.7/site-packages/sbpy/data/orbit.py in _to_oo(self, timescale)
234 if timescale is None:
235 timescale_ = [conf.oorb_timeScales[t]
--> 236 for t in self.table['timescale']]
237 else:
238 timescale_ = [conf.oorb_timeScales[timescale]] * len(self.table)
~/.miniconda36/envs/sbpy37/lib/python3.7/site-packages/astropy/table/table.py in __getitem__(self, item)
1223 def __getitem__(self, item):
1224 if isinstance(item, str):
-> 1225 return self.columns[item]
1226 elif isinstance(item, (int, np.integer)):
1227 return self.Row(self, item)
~/.miniconda36/envs/sbpy37/lib/python3.7/site-packages/astropy/table/table.py in __getitem__(self, item)
105 """
106 if isinstance(item, str):
--> 107 return OrderedDict.__getitem__(self, item)
108 elif isinstance(item, (int, np.integer)):
109 return self.values()[item]
KeyError: 'timescale'
I then tried to replace the plain Quantity
in the dict with a proper Time
object without success:
In [8]: elements["epoch"] = Time(2451200.5 * u.d, format="jd")
In [9]: elements
Out[9]:
{'a': <Quantity 1.234 AU>,
'e': 0.1234,
'i': <Quantity 12.34 deg>,
'argper': <Quantity 123.4 deg>,
'node': <Quantity 45.2 deg>,
'epoch': <Time object: scale='utc' format='jd' value=2451200.5>,
'true_anom': <Quantity 23.1 deg>}
In [10]: orb = Orbit.from_dict(elements)
In [11]: orb
Out[11]:
<QTable length=1>
a e i argper node epoch true_anom
AU deg deg deg deg
float64 float64 float64 float64 float64 object float64
------- ------- ------- ------- ------- --------- ---------
1.234 0.1234 12.34 123.4 45.2 2451200.5 23.1
In [12]: orb.oo_propagate(Time.now())
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-12-e36fbfe450f5> in <module>
----> 1 orb.oo_propagate(Time.now())
~/.miniconda36/envs/sbpy37/lib/python3.7/site-packages/sbpy/data/orbit.py in oo_propagate(self, epoch, timescale, dynmodel, ephfile)
544
545 oo_orbits, err = pyoorb.pyoorb.oorb_propagation(
--> 546 in_orbits=self._to_oo(),
547 in_epoch=ooepoch,
548 in_dynmodel=dynmodel)
~/.miniconda36/envs/sbpy37/lib/python3.7/site-packages/sbpy/data/orbit.py in _to_oo(self, timescale)
234 if timescale is None:
235 timescale_ = [conf.oorb_timeScales[t]
--> 236 for t in self.table['timescale']]
237 else:
238 timescale_ = [conf.oorb_timeScales[timescale]] * len(self.table)
~/.miniconda36/envs/sbpy37/lib/python3.7/site-packages/astropy/table/table.py in __getitem__(self, item)
1223 def __getitem__(self, item):
1224 if isinstance(item, str):
-> 1225 return self.columns[item]
1226 elif isinstance(item, (int, np.integer)):
1227 return self.Row(self, item)
~/.miniconda36/envs/sbpy37/lib/python3.7/site-packages/astropy/table/table.py in __getitem__(self, item)
105 """
106 if isinstance(item, str):
--> 107 return OrderedDict.__getitem__(self, item)
108 elif isinstance(item, (int, np.integer)):
109 return self.values()[item]
KeyError: 'timescale'
Since we will be using astroquery for other things as well it makes sense to have it as a required dependency.
Hi! I just wanted to reach out after discovering the project and talking to @migueldvb today at #pyastro18. We have some common needs since we also want to read data from Horizons (poliastro/poliastro#313) and perhaps we can lend a hand in reading or converting the orbital elements http://docs.poliastro.space/en/latest/user_guide.html#from-position-and-velocity, so let's stay in touch.
Shouldn't we drop the Python 2.7 tests in Travis?
Ephem.from_oo
modifies the orbit
parameter in place. Then when reusing the orbit, from_oo
crashes because the column 'orbittype'
already exists.
(1) Consider copying the orbit object before modifying.
(2) Check for existence of 'orbittype'
column before adding it.
In [15]: orbit = Orbit.from_dict({
...: 'targetname': ['A109AGz'],
...: 'a': [26.0446738] * u.au,
...: 'e': [0.9049629],
...: 'i': [159.11197] * u.deg,
...: 'Omega': [356.78024] * u.deg,
...: 'w': [318.64862] * u.deg,
...: 'M': [359.78524] * u.deg,
...: 'epoch': [Time('2018-10-29').jd],
...: 'timescale': ['UTC'],
...: 'H': [16.1],
...: 'G': [0.15]
...: })
In [16]: eph = Ephem.from_oo(orbit, epochs=Time('2018-11-18 21:00').jd + np.arange(25))
In [17]: eph = Ephem.from_oo(orbit, epochs=Time('2018-11-18 21:00').jd + np.arange(25))
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-17-d45a0fe59320> in <module>()
----> 1 eph = Ephem.from_oo(orbit, epochs=Time('2018-11-18 21:00').jd + np.arange(25))
/home/msk/local/lib/python3.6/site-packages/sbpy-0.0.dev362-py3.6.egg/sbpy/data/ephem.py in from_oo(self, orbit, epochs, location, scope, timescale, dynmodel, ephfile)
529
530 # add orbittype column
--> 531 orbit.add_column([orbittype] * len(orbit.table), name='orbittype')
532
533 # derive and apply default units
/home/msk/local/lib/python3.6/site-packages/sbpy-0.0.dev362-py3.6.egg/sbpy/data/core.py in add_column(self, data, name, **kwargs)
538 """
539
--> 540 self._table.add_column(Column(data, name=name), **kwargs)
541 return len(self.column_names)
542
/home/msk/local/lib/python3.6/site-packages/astropy-3.0.3-py3.6-linux-x86_64.egg/astropy/table/table.py in add_column(self, col, index, name, rename_duplicate, copy)
1574 name = (name,)
1575
-> 1576 self.add_columns([col], [index], name, copy=copy, rename_duplicate=rename_duplicate)
1577
1578 def add_columns(self, cols, indexes=None, names=None, copy=True, rename_duplicate=False):
/home/msk/local/lib/python3.6/site-packages/astropy-3.0.3-py3.6-linux-x86_64.egg/astropy/table/table.py in add_columns(self, cols, indexes, names, copy, rename_duplicate)
1711 existing_names.add(new_name)
1712
-> 1713 self._init_from_cols(newcols)
1714
1715 def _replace_column_warnings(self, name, col):
/home/msk/local/lib/python3.6/site-packages/astropy-3.0.3-py3.6-linux-x86_64.egg/astropy/table/table.py in _init_from_cols(self, cols)
761 # convert columns with units to a Quantity mixin.
762 newcols = [self._convert_col_for_table(col) for col in cols]
--> 763 self._make_table_from_cols(self, newcols)
764
765 # Deduplicate indices. It may happen that after pickling or when
/home/msk/local/lib/python3.6/site-packages/astropy-3.0.3-py3.6-linux-x86_64.egg/astropy/table/table.py in _make_table_from_cols(table, cols)
806 raise TypeError('Cannot have None for column name')
807 if len(colnames) != len(cols):
--> 808 raise ValueError('Duplicate column names')
809
810 columns = table.TableColumns((col.info.name, col) for col in cols)
ValueError: Duplicate column names
At this moment the default solar flux and magnitude are hard coded. But @mkelley suggested that they should be allowed to change, both in runtime and in package configuration. Something like:
import numpy as np
import astropy.units as u
from sbpy.units import VEGAmag, reflectance
mag = 3.4 * VEGAmag
xsec = np.pi * (460 * u.km)**2
with default_solar_flux(f_sun, M_sun):
ref = mag.to('1/sr', reflectance(cross_section=xsec))
This issue just to log the future update we discussed in #134 , i.e., to support the initialization of multiple objects into a model set.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.