Hello community,
here is the log from the commit of package python-skyfield for openSUSE:Factory
checked in at 2020-07-27 17:40:44
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-skyfield (Old)
and /work/SRC/openSUSE:Factory/.python-skyfield.new.3592 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-skyfield"
Mon Jul 27 17:40:44 2020 rev:3 rq:822763 version:1.25
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-skyfield/python-skyfield.changes
2020-07-24 10:04:19.685873586 +0200
+++
/work/SRC/openSUSE:Factory/.python-skyfield.new.3592/python-skyfield.changes
2020-07-27 17:41:32.707064312 +0200
@@ -1,0 +2,32 @@
+Sat Jul 25 11:43:28 UTC 2020 - Benjamin Greiner <[email protected]>
+
+- Update to version 1.25
+ * Added skyfield.data.stellarium.parse_constellations()
+ and skyfield.data.stellarium.parse_star_names()
+ to load Stellarium star names and constellation lines.
+ Constellation lines are featured in a new example script
+ neowise-chart that produces a finder chart for
+ comet C/2020 F3 NEOWISE.
+ * The Hipparcos star catalog should now load faster, having
+ switched behind the scenes to a higher performance Pandas
+ import routine.
+ * Fixed the ability of skyfield.timelib.Timescale.utc()
+ to accept a Python datetime.date object as its argument.
+ #409
+ * Slightly lowered the precision of two tests when they
+ detect that Python is compiled for a 32-bit processor, so
+ the test suite can succeed when contributors package
+ Skyfield for 32-bit Linux. #411
+- use upstreams custom test runner 'assay'
+ * The runner does not have any releases yet. No package
+ available, so use assay-master-252.79f5d78.tar.gz directly
+ * drop skyfield-pr405-replace-assay-by-pytest.patch
+ * gh#brandon-rhodes/assay#6, gh#skyfielders/python-skyfield#405
+- the unit test expect a truncated hipparcos catalog
+ * generate-hipparcos.sh
+ * hip_main.dat.gz
+- drop skyfield-pr404-comparefloat.patch addressed upstream
+ gh#skyfielders/python-skyfield#404
+ gh#skyfielders/python-skyfield#411
+
+-------------------------------------------------------------------
Old:
----
skyfield-1.24.tar.gz
skyfield-pr404-comparefloat.patch
skyfield-pr405-replace-assay-by-pytest.patch
New:
----
assay-master-252.79f5d78.tar.gz
generate-hipparcos.sh
skyfield-1.25.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-skyfield.spec ++++++
--- /var/tmp/diff_new_pack.dvc2us/_old 2020-07-27 17:41:39.951071113 +0200
+++ /var/tmp/diff_new_pack.dvc2us/_new 2020-07-27 17:41:39.955071116 +0200
@@ -17,11 +17,11 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
-%define assaycommit 18f320237345813a49173657e7d2d6ca85e9a38a
-%define assayver 245.18f3202
+%define assaycommit 79f5d784a55d70f31b2c90b636910738cd74840e
+%define assayver 252.79f5d78
%define skip_python2 1
Name: python-skyfield
-Version: 1.24
+Version: 1.25
Release: 0
Summary: Elegant astronomy for Python
License: MIT
@@ -36,12 +36,12 @@
Source6: ftp://cddis.nasa.gov/products/iers/deltat.data
Source7: ftp://cddis.nasa.gov/products/iers/deltat.preds
Source8: https://hpiers.obspm.fr/iers/bul/bulc/Leap_Second.dat
-Source9: http://cdsarc.u-strasbg.fr/ftp/cats/I/239/hip_main.dat.gz
+# use generate-hipparcos.sh to download and truncate the test data
+Source9: hip_main.dat.gz
+Source10: generate-hipparcos.sh
+# upstreams custom test runner assay: gh#skyfielders/python-skyfield#405
+Source98:
https://github.com/brandon-rhodes/assay/archive/%{assaycommit}.tar.gz#/assay-master-%{assayver}.tar.gz
Source99: python-skyfield-rpmlintrc
-# PR404 Refine some float comparisons in the unit tests for flaky platforms
gh#skyfielders/python-skyfield#404
-Patch0: skyfield-pr404-comparefloat.patch
-# PR405 Replace upstreams custom testrunner 'assay' with standard pytest
gh#skyfielders/python-skyfield#405
-Patch1: skyfield-pr405-replace-assay-by-pytest.patch
BuildRequires: %{python_module astropy}
BuildRequires: %{python_module beautifulsoup4}
BuildRequires: %{python_module certifi}
@@ -49,9 +49,9 @@
BuildRequires: %{python_module jplephem >= 2.13}
BuildRequires: %{python_module lxml}
BuildRequires: %{python_module matplotlib}
+BuildRequires: %{python_module mock}
BuildRequires: %{python_module numpy}
BuildRequires: %{python_module pandas}
-BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module sgp4 >= 2.2}
BuildRequires: fdupes
@@ -74,10 +74,7 @@
research-grade positions for planets and Earth satellites.
%prep
-%setup -q -n skyfield-%{version}
-%autopatch -p1
-# https://github.com/skyfielders/python-skyfield/issues/411
-sed -i -e 's/assert relative_error < 2e-12/assert relative_error < 4e-12/'
skyfield/tests/test_positions.py
+%setup -q -n skyfield-%{version} -b 98
# copy all test data files into the rootdir
cp %{SOURCE1} %{SOURCE2} %{SOURCE3} %{SOURCE4} %{SOURCE5} %{SOURCE6}
%{SOURCE7} %{SOURCE8} %{SOURCE9} ./
@@ -89,7 +86,8 @@
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
-%pytest
+export PYTHONPATH="../assay-%{assaycommit}"
+%python_exec -m assay --batch skyfield.tests
%files %{python_files}
%doc README.rst
++++++ generate-hipparcos.sh ++++++
#!/bin/sh
# Get truncated Hipparcos catalog for testing
# Truncate the Hipparcos catalog to stars with magnitude brighter than 6.6
# corresponds to last line of
# https://github.com/skyfielders/python-skyfield/blob/master/builders/Makefile
URL=http://cdsarc.u-strasbg.fr/ftp/cats/I/239/hip_main.dat.gz
curl "$URL" | zcat | awk -F\| '$6 <= 6.6 || $2 == 87937' | gzip -c -9 >
hip_main.dat.gz
++++++ hip_main.dat.gz ++++++
++++ 118221 lines (skipped)
++++ between hip_main.dat.gz
++++ and /work/SRC/openSUSE:Factory/.python-skyfield.new.3592/hip_main.dat.gz
++++++ skyfield-1.24.tar.gz -> skyfield-1.25.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/skyfield-1.24/PKG-INFO new/skyfield-1.25/PKG-INFO
--- old/skyfield-1.24/PKG-INFO 2020-07-21 03:45:09.000000000 +0200
+++ new/skyfield-1.25/PKG-INFO 2020-07-24 12:07:05.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: skyfield
-Version: 1.24
+Version: 1.25
Summary: Elegant astronomy for Python
Home-page: http://github.com/brandon-rhodes/python-skyfield/
Author: Brandon Rhodes
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/skyfield-1.24/skyfield/__init__.py
new/skyfield-1.25/skyfield/__init__.py
--- old/skyfield-1.24/skyfield/__init__.py 2020-07-21 03:40:13.000000000
+0200
+++ new/skyfield-1.25/skyfield/__init__.py 2020-07-24 11:43:58.000000000
+0200
@@ -5,5 +5,5 @@
the source code, as well as the http://rhodesmill.org/skyfield/ site!
"""
-VERSION = (1, 24)
+VERSION = (1, 25)
__version__ = '.'.join(map(str, VERSION))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/skyfield-1.24/skyfield/constellationlib.py
new/skyfield-1.25/skyfield/constellationlib.py
--- old/skyfield-1.24/skyfield/constellationlib.py 2020-06-12
20:16:38.000000000 +0200
+++ new/skyfield-1.25/skyfield/constellationlib.py 2020-07-24
11:51:59.000000000 +0200
@@ -29,11 +29,11 @@
from .timelib import Time, julian_date_of_besselian_epoch
def load_constellation_map():
- """Load Skyfield's constellation map and return a lookup function
+ """Load Skyfield's constellation boundaries and return a lookup function.
- Skyfield carries an internal constellation map that is optimized for
- quick position lookup. Call this function to load the map and
- return a function mapping position to constellation name.
+ Skyfield carries an internal map of constellation boundaries that is
+ optimized for quick position lookup. Call this function to load the
+ map and return a function mapping position to constellation name.
>>> from skyfield.api import position_of_radec, load_constellation_map
>>> constellation_at = load_constellation_map()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/skyfield-1.24/skyfield/data/hipparcos.py
new/skyfield-1.25/skyfield/data/hipparcos.py
--- old/skyfield-1.24/skyfield/data/hipparcos.py 2020-06-04
15:43:53.000000000 +0200
+++ new/skyfield-1.25/skyfield/data/hipparcos.py 2020-07-21
13:18:03.000000000 +0200
@@ -41,6 +41,21 @@
installer, like "pip install pandas" or "conda install pandas".
"""
+_COLUMN_NAMES = (
+ 'Catalog', 'HIP', 'Proxy', 'RAhms', 'DEdms', 'Vmag',
+ 'VarFlag', 'r_Vmag', 'RAdeg', 'DEdeg', 'AstroRef', 'Plx', 'pmRA',
+ 'pmDE', 'e_RAdeg', 'e_DEdeg', 'e_Plx', 'e_pmRA', 'e_pmDE', 'DE:RA',
+ 'Plx:RA', 'Plx:DE', 'pmRA:RA', 'pmRA:DE', 'pmRA:Plx', 'pmDE:RA',
+ 'pmDE:DE', 'pmDE:Plx', 'pmDE:pmRA', 'F1', 'F2', '---', 'BTmag',
+ 'e_BTmag', 'VTmag', 'e_VTmag', 'm_BTmag', 'B-V', 'e_B-V', 'r_B-V',
+ 'V-I', 'e_V-I', 'r_V-I', 'CombMag', 'Hpmag', 'e_Hpmag', 'Hpscat',
+ 'o_Hpmag', 'm_Hpmag', 'Hpmax', 'HPmin', 'Period', 'HvarType',
+ 'moreVar', 'morePhoto', 'CCDM', 'n_CCDM', 'Nsys', 'Ncomp',
+ 'MultFlag', 'Source', 'Qual', 'm_HIP', 'theta', 'rho', 'e_rho',
+ 'dHp', 'e_dHp', 'Survey', 'Chart', 'Notes', 'HD', 'BD', 'CoD',
+ 'CPD', '(V-I)red', 'SpType', 'r_SpType',
+)
+
def load_dataframe(fobj, compression='gzip'):
"""Given an open file for `hip_main.dat.gz`, return a parsed dataframe.
@@ -49,21 +64,19 @@
"""
try:
- from pandas import read_fwf
+ from pandas import read_csv
except ImportError:
raise ImportError(PANDAS_MESSAGE)
- names, colspecs = zip(
- ('hip', (2, 14)),
- ('magnitude', (41, 46)),
- ('ra_degrees', (51, 63)),
- ('dec_degrees', (64, 76)),
- ('parallax_mas', (79, 86)), # TODO: have Star load this
- ('ra_mas_per_year', (87, 95)),
- ('dec_mas_per_year', (96, 104)),
+ df = read_csv(
+ fobj, sep='|', compression=compression, names=_COLUMN_NAMES,
+ usecols=['HIP', 'Vmag', 'RAdeg', 'DEdeg', 'Plx', 'pmRA', 'pmDE'],
+ na_values=[' ', ' ', ' ', ' '],
+ )
+ df.columns = (
+ 'hip', 'magnitude', 'ra_degrees', 'dec_degrees',
+ 'parallax_mas', 'ra_mas_per_year', 'dec_mas_per_year',
)
-
- df = read_fwf(fobj, colspecs, names=names, compression=compression)
df = df.assign(
ra_hours = df['ra_degrees'] / 15.0,
epoch_year = 1991.25,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/skyfield-1.24/skyfield/data/stellarium.py
new/skyfield-1.25/skyfield/data/stellarium.py
--- old/skyfield-1.24/skyfield/data/stellarium.py 1970-01-01
01:00:00.000000000 +0100
+++ new/skyfield-1.25/skyfield/data/stellarium.py 2020-07-24
11:55:32.000000000 +0200
@@ -0,0 +1,59 @@
+"""Parse Stellarium data files."""
+
+from collections import namedtuple
+
+StarName = namedtuple('StarName', 'hip name')
+
+def parse_constellations(lines):
+ """Return a list of constellation outlines.
+
+ Each constellation outline is a list of edges, each of which is
+ drawn between a pair of specific stars::
+
+ [
+ (name, [(star1, star2), (star3, star4), ...]),
+ (name, [(star1, star2), (star3, star4), ...]),
+ ...
+ ]
+
+ Each name is a 3-letter constellation abbreviation; each star is an
+ integer Hipparcos catalog number. See :ref:`neowise-chart` for an
+ example of how to combine this data with the Hipparcos star catalog
+ to draw constellation lines on a chart.
+
+ """
+ constellations = []
+ for line in lines:
+ line = line.lstrip()
+ if line.startswith(b'#'):
+ continue
+ fields = line.split()
+ if not fields:
+ continue
+ name = fields[0]
+ edges = [(int(fields[i]), int(fields[i+1]))
+ for i in range(2, len(fields), 2)]
+ constellations.append((name.decode('utf-8'), edges))
+ return constellations
+
+def parse_star_names(lines):
+ """Return the names in a Stellarium ``star_names.fab`` file.
+
+ Returns a list of named tuples, each of which offers a ``.hip``
+ attribute with a Hipparcos catalog number and a ``.name`` attribute
+ with the star name. Do not depend on the tuple having only length
+ two; additional fields may be added in the future.
+
+ """
+ names = []
+ for line in lines:
+ line = line.strip()
+ if line == b'' or line.startswith(b'#'):
+ continue
+ fields = line.split()
+ hip, name = fields[0].split(b'|')
+ names.append(StarName(
+ int(hip),
+ name.strip(b'_(")').decode('utf-8'),
+ ))
+ return names
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/skyfield-1.24/skyfield/documentation/api.rst
new/skyfield-1.25/skyfield/documentation/api.rst
--- old/skyfield-1.24/skyfield/documentation/api.rst 2020-07-17
16:17:03.000000000 +0200
+++ new/skyfield-1.25/skyfield/documentation/api.rst 2020-07-24
11:45:40.000000000 +0200
@@ -310,6 +310,8 @@
==============
.. autofunction:: skyfield.api.load_constellation_map
+.. autofunction:: skyfield.data.stellarium.parse_constellations
+.. autofunction:: skyfield.data.stellarium.parse_star_names
Searching
=========
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/skyfield-1.24/skyfield/documentation/example-plots.rst
new/skyfield-1.25/skyfield/documentation/example-plots.rst
--- old/skyfield-1.24/skyfield/documentation/example-plots.rst 2020-06-04
15:43:53.000000000 +0200
+++ new/skyfield-1.25/skyfield/documentation/example-plots.rst 2020-07-24
11:56:33.000000000 +0200
@@ -6,8 +6,32 @@
This section of the documentation
will gradually accumulate example scripts
for producing images from Skyfield computations.
-For the moment there’s only example so far,
-for plotting the elevation of a satellite over time:
+
+Note that these example scripts
+are written for fairly recent versions of `matplotlib`_.
+If you try running them on a system
+with an older version of the library,
+you might see errors — in particular with how they specify colors,
+in which case you can try omitting those parameters
+to get the script running.
+In any case,
+these are only intended to be a starting point
+for building your own scripts,
+either with matplotlib or whatever other plotting library you prefer.
+
+.. _neowise-chart:
+
+Drawing a finder chart for comet NEOWISE
+========================================
+
+Here is a stand-alone script
+that brings together four different data sources —
+a planetary ephemeris, a comet orbit database, a large star catalog,
+and constellation diagrams —
+to plot the course of Comet NEOWISE across Ursa Major
+over one week of July 2020:
+
+.. image:: _static/neowise-finder-chart.png
.. testsetup::
@@ -15,6 +39,42 @@
matplotlib.use('Agg') # to avoid “no display name” error on Travis CI
del matplotlib
+ import sys
+ sys.path[0:0] = ['../../examples']
+ import comet_neowise_chart
+
+Its code includes many design decisions and presentation tweaks
+that you will probably want to adjust for your own project.
+Use the script as a starting point:
+
+.. include:: ../../examples/comet_neowise_chart.py
+ :literal:
+
+.. testcleanup::
+
+ import os
+ os.rename('neowise-finder-chart.png', '_static/neowise-finder-chart.png')
+
+If you choose a different rendering engine
+instead of the venerable but rather ornery and complicated `matplotlib`_,
+then of course the plotting calls you make
+will be completely different.
+But the basic data loading and filtering will be the same,
+so hopefully the script will still help get you started
+in targeting a more modern plotting library.
+
+Plotting satellite altitude during re-entry
+===========================================
+
+Here is the decreasing altitude of a satellite as its orbit decayed
+and it re-entered the atmosphere above the Pacific Ocean:
+
+.. image:: _static/goce-reentry.png
+
+The code to produce the diagram using `matplotlib`_,
+including custom tick marks that are based on the date,
+is:
+
.. testcode::
from matplotlib import pyplot as plt
@@ -47,36 +107,34 @@
# Start a new figure.
- plt.figure()
+ fig, ax = plt.subplots()
# Draw the blue curve.
x = t.toordinal()
y = sat.at(t).distance().km - earth_radius_km
- plt.plot(x, y)
+ ax.plot(x, y)
# Label the official moment of reentry.
x = reentry.toordinal()
y = sat.at(reentry).distance().km - earth_radius_km
- plt.plot(x, y, 'ro')
- plt.text(x, y + 10, 'Moment of re-entry')
+ ax.plot(x, y, 'ro')
+ ax.text(x, y + 10, 'Moment of re-entry')
# Grid lines and labels.
- axes = plt.axes()
- axes.grid(True)
- label_dates_and_hours(axes)
- plt.title('GOCE satellite altitude')
- plt.ylabel('km above sea level')
+ label_dates_and_hours(ax)
+ ax.grid()
+ ax.set(title='GOCE satellite altitude', ylabel='km above sea level')
# Render the plot to a PNG file.
- plt.savefig('goce-reentry.png')
-
-.. image:: _static/goce-reentry.png
+ fig.savefig('goce-reentry.png', bbox_inches='tight')
.. testcleanup::
import os
os.rename('goce-reentry.png', '_static/goce-reentry.png')
+
+.. _matplotlib: https://matplotlib.org/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/skyfield-1.24/skyfield/documentation/searches.rst
new/skyfield-1.25/skyfield/documentation/searches.rst
--- old/skyfield-1.24/skyfield/documentation/searches.rst 2020-06-15
18:41:50.000000000 +0200
+++ new/skyfield-1.25/skyfield/documentation/searches.rst 2020-07-21
12:20:38.000000000 +0200
@@ -183,17 +183,16 @@
from matplotlib import pyplot as plt
- plt.figure(figsize=(5, 3))
- plt.title('Elongation of Mars (degrees)')
- plt.xlabel('Year')
- plt.axes().grid(True)
- plt.axes().axhline(90, color='r') # Red line at 90°
+ fig, ax = plt.subplots(figsize=(5, 3))
t = ts.utc(2018, 1, range(366 * 5))
- plt.plot(t.J, mars_elongation_degrees(t))
+ ax.axhline(90, color='r') # Red line at 90°
+ ax.plot(t.J, mars_elongation_degrees(t))
+ ax.set(title='Elongation of Mars (degrees)', xlabel='Year')
+ ax.grid(True)
- plt.tight_layout()
- plt.savefig('mars-elongation.png')
+ fig.tight_layout()
+ fig.savefig('mars-elongation.png')
.. image:: _static/mars-elongation.png
@@ -251,12 +250,10 @@
.. testcode::
- from matplotlib import pyplot as plt
-
- plt.figure(figsize=(5, 1.5))
- plt.plot(t.J, mars_quadrature(t))
- plt.tight_layout()
- plt.savefig('mars-quadrature.png')
+ fig, ax = plt.subplots(figsize=(5, 1.5))
+ ax.plot(t.J, mars_quadrature(t))
+ fig.tight_layout()
+ fig.savefig('mars-quadrature.png')
.. image:: _static/mars-quadrature.png
@@ -280,10 +277,10 @@
.. testcode::
t_annual = ts.utc(range(2018, 2024))
- plt.figure(figsize=(5, 1.5))
- plt.plot(t_annual.J, mars_quadrature(t_annual), 'ro')
- plt.tight_layout()
- plt.savefig('mars-quadrature-undersampled.png')
+ fig, ax = plt.subplots(figsize=(5, 1.5))
+ ax.plot(t_annual.J, mars_quadrature(t_annual), 'ro')
+ fig.tight_layout()
+ fig.savefig('mars-quadrature-undersampled.png')
.. image:: _static/mars-quadrature-undersampled.png
@@ -407,16 +404,15 @@
.. testcode::
- plt.figure(figsize=(5, 2))
- plt.title('Elongation of Venus (degrees)')
- plt.xlabel('Year')
- plt.axes().grid(True)
+ fig, ax = plt.subplots(figsize=(5, 2))
t = ts.utc(2018, 1, range(366 * 5))
- plt.plot(t.J, venus_elongation_degrees(t))
+ ax.plot(t.J, venus_elongation_degrees(t))
+ ax.set(title='Elongation of Venus (degrees)', xlabel='Year')
+ ax.grid()
- plt.tight_layout()
- plt.savefig('venus-elongation.png')
+ fig.tight_layout()
+ fig.savefig('venus-elongation.png')
.. image:: _static/venus-elongation.png
@@ -445,16 +441,15 @@
.. testcode::
- plt.figure(figsize=(5, 2))
- plt.title('Elongation of Venus (degrees)')
- plt.xlabel('Year')
- plt.axes().grid(True)
+ fig, ax = plt.subplots(figsize=(5, 2))
t = ts.utc(range(2018, 2024))
- plt.plot(t.J, venus_elongation_degrees(t), 'ro')
+ ax.plot(t.J, venus_elongation_degrees(t), 'ro')
+ ax.set(title='Elongation of Venus (degrees)', xlabel='Year')
+ ax.grid()
- plt.tight_layout()
- plt.savefig('venus-elongation-undersampled.png')
+ fig.tight_layout()
+ fig.savefig('venus-elongation-undersampled.png')
.. image:: _static/venus-elongation-undersampled.png
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/skyfield-1.24/skyfield/documentation/stars.rst
new/skyfield-1.25/skyfield/documentation/stars.rst
--- old/skyfield-1.24/skyfield/documentation/stars.rst 2020-06-15
18:37:27.000000000 +0200
+++ new/skyfield-1.25/skyfield/documentation/stars.rst 2020-07-21
12:10:54.000000000 +0200
@@ -151,13 +151,13 @@
from matplotlib import pyplot as plt
- plt.figure()
- plt.title('The brightest stars in Orion')
- plt.scatter(ra.hours, dec.degrees, 8 - df['magnitude'], 'k')
- plt.xlim(7.0, 4.0)
- plt.ylim(-20, 20)
- plt.axes().grid(True)
- plt.savefig('bright_stars.png')
+ fig, ax = plt.subplots()
+ ax.scatter(ra.hours, dec.degrees, 8 - df['magnitude'], 'k')
+ ax.set_xlim(7.0, 4.0)
+ ax.set_ylim(-20, 20)
+ ax.grid(True)
+ ax.set(title='The brightest stars in Orion')
+ fig.savefig('bright_stars.png')
The result of the simple filtering and plotting is an (admittedly
primitive) rendering of Orion!
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/skyfield-1.24/skyfield/named_stars.py
new/skyfield-1.25/skyfield/named_stars.py
--- old/skyfield-1.24/skyfield/named_stars.py 2020-06-12 20:16:38.000000000
+0200
+++ new/skyfield-1.25/skyfield/named_stars.py 2020-07-24 11:24:47.000000000
+0200
@@ -1,3 +1,4 @@
+# TODO: Deprecate; maybe even remove, since it's not documented?
"""
Convenience functions for users to get a Star instance using a small database
of named stars.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/skyfield-1.24/skyfield/projections.py
new/skyfield-1.25/skyfield/projections.py
--- old/skyfield-1.24/skyfield/projections.py 2020-07-17 16:17:03.000000000
+0200
+++ new/skyfield-1.25/skyfield/projections.py 2020-07-24 00:42:26.000000000
+0200
@@ -43,8 +43,11 @@
# https://math.stackexchange.com/questions/409217/
p = center.position.au
u = p / length_of(p)
- c = u.mean(axis=1)
- c = c / length_of(c)
+ if len(u.shape) > 1:
+ c = u.mean(axis=1)
+ c = c / length_of(c)
+ else:
+ c = u
x_c, y_c, z_c = c
def project(position):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/skyfield-1.24/skyfield/tests/fixes.py
new/skyfield-1.25/skyfield/tests/fixes.py
--- old/skyfield-1.24/skyfield/tests/fixes.py 2020-07-20 17:55:20.000000000
+0200
+++ new/skyfield-1.25/skyfield/tests/fixes.py 2020-07-24 10:28:10.000000000
+0200
@@ -1,10 +1,13 @@
"""Helpers for making Skyfield tests stable."""
import datetime as dt
+import sys
+
from skyfield import earthlib
import skyfield.api
import skyfield.timelib
+IS_32_BIT = (sys.maxsize == 0x7fffffff)
_real_datetime_class = dt.datetime
class datetime(dt.datetime):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/skyfield-1.24/skyfield/tests/test_io.py
new/skyfield-1.25/skyfield/tests/test_io.py
--- old/skyfield-1.24/skyfield/tests/test_io.py 2020-07-10 11:52:13.000000000
+0200
+++ new/skyfield-1.25/skyfield/tests/test_io.py 2020-07-22 16:27:39.000000000
+0200
@@ -5,7 +5,10 @@
import tempfile
from contextlib import contextmanager
from datetime import date
-from mock import patch
+try:
+ from unittest.mock import patch
+except ImportError:
+ from mock import patch
from skyfield import api
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/skyfield-1.24/skyfield/tests/test_io_parsing.py
new/skyfield-1.25/skyfield/tests/test_io_parsing.py
--- old/skyfield-1.24/skyfield/tests/test_io_parsing.py 2020-06-12
20:16:38.000000000 +0200
+++ new/skyfield-1.25/skyfield/tests/test_io_parsing.py 2020-07-24
11:22:34.000000000 +0200
@@ -2,7 +2,7 @@
import gzip
from skyfield import iokit
-from skyfield.data.hipparcos import load_dataframe
+from skyfield.data import hipparcos, stellarium
from skyfield.functions import BytesIO
from skyfield.iokit import parse_tle
@@ -125,7 +125,7 @@
g.close()
b.seek(0)
try:
- df = load_dataframe(b)
+ df = hipparcos.load_dataframe(b)
except ImportError:
# raise SkipTest('pandas not available')
# Assay doesn't understand skipping tests yet; just pass
@@ -135,3 +135,21 @@
row = df.iloc[0]
assert abs(row.ra_degrees - 000.00091185) < 1e-30
assert abs(row.dec_degrees - +01.08901332) < 1e-30
+
+star_text = b"""\
+# star names by constellation
+# Andromeda (And)
+ 677|_("Alpheratz") 1,2,5,6,11,12
+ 677|_("Sirrah")
+ 5447|_("Mirach") 1,2,5,6,11,12,23
+ 9640|_("Almach") 1,2,5,6,11,12
+ 9640|_("Almaak")
+"""
+
+def test_stellarium_star_names():
+ f = BytesIO(star_text)
+ star_names = stellarium.parse_star_names(f)
+ assert star_names[0].hip == 677
+ assert star_names[0].name == 'Alpheratz'
+ assert star_names[4].hip == 9640
+ assert star_names[4].name == 'Almaak'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/skyfield-1.24/skyfield/tests/test_planetarylib.py
new/skyfield-1.25/skyfield/tests/test_planetarylib.py
--- old/skyfield-1.24/skyfield/tests/test_planetarylib.py 2020-07-17
16:17:03.000000000 +0200
+++ new/skyfield-1.25/skyfield/tests/test_planetarylib.py 2020-07-24
10:34:20.000000000 +0200
@@ -2,6 +2,7 @@
from skyfield.api import PlanetaryConstants, T0, load
from skyfield.constants import AU_KM, AU_M
from skyfield.positionlib import ICRF
+from .fixes import IS_32_BIT
def test_frame_rotation_matrices():
# To produce the following matrices:
@@ -47,7 +48,10 @@
R2, Rv = frame.rotation_and_rate_at(ts.tdb_jd(tdb))
assert (R == R2).all()
- assert (Rv == desired_rate).all() # Boom.
+ if IS_32_BIT:
+ assert abs(Rv - desired_rate).max() < 3e-26
+ else:
+ assert (Rv == desired_rate).all() # Boom.
# Second, a moment when the angle W is more than 2500 radians.
@@ -93,11 +97,17 @@
frame = pc.build_frame_named('MOON_ME_DE421')
R = frame.rotation_at(ts.tdb_jd(tdb))
delta = abs(R - desired_rotation)
- assert (R == desired_rotation).all()
+ if IS_32_BIT:
+ assert abs(R - desired_rotation).max() < 2e-16
+ else:
+ assert (R == desired_rotation).all()
R2, Rv = frame.rotation_and_rate_at(ts.tdb_jd(tdb))
assert (R == R2).all()
- assert (Rv == desired_rate).all()
+ if IS_32_BIT:
+ assert abs(Rv - desired_rate).max() < 2e-23
+ else:
+ assert (Rv == desired_rate).all()
def test_rotating_vector_into_frame():
et_seconds = 259056665.1855896
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/skyfield-1.24/skyfield/tests/test_positions.py
new/skyfield-1.25/skyfield/tests/test_positions.py
--- old/skyfield-1.24/skyfield/tests/test_positions.py 2020-07-21
03:38:20.000000000 +0200
+++ new/skyfield-1.25/skyfield/tests/test_positions.py 2020-07-24
10:28:50.000000000 +0200
@@ -5,7 +5,7 @@
from skyfield.functions import length_of, mxv, rot_z
from skyfield.positionlib import ICRF, ITRF_to_GCRS2, _GIGAPARSEC_AU
from skyfield.starlib import Star
-from .fixes import low_precision_ERA
+from .fixes import IS_32_BIT, low_precision_ERA
def test_subtraction():
p0 = ICRF((10,20,30), (40,50,60))
@@ -126,7 +126,8 @@
relative_error = (length_of(actual_motion - predicted_motion)
/ length_of(actual_motion))
- assert relative_error < 2e-12
+ acceptable_error = 4e-12 if IS_32_BIT else 2e-12
+ assert relative_error < acceptable_error
# Test that the CIRS coordinate of the TIO is consistent with the Earth
Rotation Angle
# This is mostly an internal consistency check
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/skyfield-1.24/skyfield/tests/test_stars.py
new/skyfield-1.25/skyfield/tests/test_stars.py
--- old/skyfield-1.24/skyfield/tests/test_stars.py 2020-06-12
20:16:38.000000000 +0200
+++ new/skyfield-1.25/skyfield/tests/test_stars.py 2020-07-24
05:40:14.000000000 +0200
@@ -5,4 +5,4 @@
with api.load.open('hip_main.dat.gz') as f:
df = load_dataframe(f)
star = api.Star.from_dataframe(df)
- assert repr(star) == 'Star(ra shape=214, dec shape=214, ra_mas_per_year
shape=214, dec_mas_per_year shape=214, parallax_mas shape=214, epoch shape=214)'
+ assert repr(star) == 'Star(ra shape=9933, dec shape=9933, ra_mas_per_year
shape=9933, dec_mas_per_year shape=9933, parallax_mas shape=9933, epoch
shape=9933)'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/skyfield-1.24/skyfield/tests/test_timelib.py
new/skyfield-1.25/skyfield/tests/test_timelib.py
--- old/skyfield-1.24/skyfield/tests/test_timelib.py 2020-07-17
15:39:21.000000000 +0200
+++ new/skyfield-1.25/skyfield/tests/test_timelib.py 2020-07-22
14:45:02.000000000 +0200
@@ -1,3 +1,4 @@
+import datetime as dt_module
import numpy as np
from assay import assert_raises
from pytz import timezone
@@ -102,6 +103,11 @@
2442046.5, 2442047.5, 2442048.5, 2442049.5, 2442050.5, 2442051.5,
]
+def test_building_time_from_python_date(ts):
+ d = dt_module.date(2020, 7, 22)
+ t = ts.utc(d)
+ assert t.utc == (2020, 7, 22, 0, 0, 0.0)
+
def test_converting_ut1_to_tt(ts):
ten_thousand_years = 365 * 10000
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/skyfield-1.24/skyfield/timelib.py
new/skyfield-1.25/skyfield/timelib.py
--- old/skyfield-1.24/skyfield/timelib.py 2020-07-21 03:27:53.000000000
+0200
+++ new/skyfield-1.25/skyfield/timelib.py 2020-07-22 14:43:58.000000000
+0200
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-import datetime as dt
+import datetime as dt_module
import re
from collections import namedtuple
from datetime import date, datetime
@@ -33,8 +33,8 @@
@property
def second(self): return self[5]
-if hasattr(dt, 'timezone'):
- utc = dt.timezone.utc
+if hasattr(dt_module, 'timezone'):
+ utc = dt_module.timezone.utc
else:
try:
from pytz import utc
@@ -42,9 +42,9 @@
# Lacking a full suite of timezones from pytz, we at least need a
# time zone object for UTC.
- class UTC(dt.tzinfo):
+ class UTC(dt_module.tzinfo):
'UTC'
- zero = dt.timedelta(0)
+ zero = dt_module.timedelta(0)
def utcoffset(self, dt):
return self.zero
def tzname(self, dt):
@@ -56,7 +56,7 @@
# Much of the following code is adapted from the USNO's "novas.c".
-_time_zero = dt.time()
+_time_zero = dt_module.time(tzinfo=utc)
_half_minute = 30.0 / DAY_S
_half_second = 0.5 / DAY_S
_half_microsecond = 0.5e-6 / DAY_S
@@ -150,7 +150,7 @@
if isinstance(year, datetime):
return self.from_datetime(year)
if isinstance(year, date):
- return self.from_datetime(dt.combine(year, _time_zero))
+ return self.from_datetime(datetime.combine(year, _time_zero))
if hasattr(year, '__len__') and isinstance(year[0], datetime):
return self.from_datetimes(year)