Version 2.9: add load_array()
This commit is contained in:
parent
31549ce716
commit
7dae84d506
|
@ -195,6 +195,13 @@ provided above and read through the code to learn more.
|
|||
| segment.end_i - index where segment ends
|
||||
...
|
||||
|
||||
* If you want to access the raw coefficients, use the segment
|
||||
``load_array()`` method. It returns two floats and a NumPy array:
|
||||
|
||||
>>> initial_epoch, interval_length, coefficients = segment.load_array()
|
||||
>>> print(coefficients.shape)
|
||||
(3, 100448, 13)
|
||||
|
||||
* The square-bracket lookup mechanism ``kernel[3,399]`` is a
|
||||
non-standard convenience that returns only the last matching segment
|
||||
in the file. While the SPK standard does say that the last segment
|
||||
|
@ -212,7 +219,6 @@ provided above and read through the code to learn more.
|
|||
the position, and then only proceed to the velocity once you are sure
|
||||
that the light-time error is now small enough.
|
||||
|
||||
|
||||
High-Precision Dates
|
||||
--------------------
|
||||
|
||||
|
@ -298,6 +304,10 @@ https://github.com/brandon-rhodes/python-jplephem/
|
|||
Changelog
|
||||
---------
|
||||
|
||||
**2019 January 3 — Version 2.9**
|
||||
|
||||
* Added the ``load_array()`` method to the segment class.
|
||||
|
||||
**2018 July 22 — Version 2.8**
|
||||
|
||||
* Switched to a making a single memory map of the entire file, to avoid
|
||||
|
|
|
@ -149,6 +149,12 @@ class Segment(object):
|
|||
coefficients = rollaxis(coefficients, 1)
|
||||
return initial_epoch, interval_length, coefficients
|
||||
|
||||
def load_array(self):
|
||||
data = self._data
|
||||
if data is None:
|
||||
self._data = data = self._load()
|
||||
return data
|
||||
|
||||
def generate(self, tdb, tdb2):
|
||||
"""Generate components and differentials for time `tdb` plus `tdb2`.
|
||||
|
||||
|
|
|
@ -322,6 +322,11 @@ class SPKTests(_CommonTests, TestCase):
|
|||
'2414864.50..2471184.50 Solar System Barycenter (0) -> Mars Barycenter (4)'
|
||||
'\n frame=1 data_type=2 source=DE-0421LE-0421')
|
||||
|
||||
def test_loading_array(self):
|
||||
segment = self.spk[0,4]
|
||||
initial_epoch, interval_length, coefficients = segment.load_array()
|
||||
self.assertEqual(coefficients.shape, (3, 1760, 11))
|
||||
|
||||
|
||||
class LegacyTests(_CommonTests, TestCase):
|
||||
|
||||
|
|
Loading…
Reference in New Issue