skymap 0.0.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +40 -1
- data/README.md +229 -1
- data/data/constellations/iau/boundaries.csv +5110 -0
- data/data/constellations/iau/lines.csv +753 -0
- data/data/stars.csv +9097 -0
- data/lib/skymap/canvas.rb +13 -0
- data/lib/skymap/catalog/constellation_boundaries.rb +43 -0
- data/lib/skymap/catalog/constellation_lines.rb +37 -0
- data/lib/skymap/catalog/stars.rb +35 -0
- data/lib/skymap/chart.rb +22 -0
- data/lib/skymap/constellation_boundary.rb +5 -0
- data/lib/skymap/constellation_line.rb +5 -0
- data/lib/skymap/context.rb +51 -0
- data/lib/skymap/horizon.rb +32 -0
- data/lib/skymap/layers/cardinal_directions.rb +27 -0
- data/lib/skymap/layers/constellation_boundaries.rb +67 -0
- data/lib/skymap/layers/constellation_lines.rb +46 -0
- data/lib/skymap/layers/moon.rb +40 -0
- data/lib/skymap/layers/stars.rb +39 -0
- data/lib/skymap/point.rb +12 -0
- data/lib/skymap/projection/stereographic.rb +21 -0
- data/lib/skymap/renderer/boundary.rb +7 -0
- data/lib/skymap/renderer/dot.rb +7 -0
- data/lib/skymap/renderer/label.rb +7 -0
- data/lib/skymap/renderer/line.rb +7 -0
- data/lib/skymap/renderer/moon.rb +7 -0
- data/lib/skymap/renderer/svg.rb +132 -0
- data/lib/skymap/star.rb +5 -0
- data/lib/skymap/star_size.rb +27 -0
- data/lib/skymap/version.rb +1 -1
- data/lib/skymap.rb +26 -0
- metadata +84 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2a51ef1b61aec62bb35240049a14adc40f006027f59fc30178eb973791901094
|
|
4
|
+
data.tar.gz: 1f8a1488c057a526bf1eaa7f36cb24fa78fc903e0a957fd6c946a1189ddebad6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3151561266fea54c8845be6747e32d511da079ff8f0616bed97d359e39cadeddcb72d46e79f9f94a3dd8bbd27f00dd7598db65ef2a008ee68366978c1993537d
|
|
7
|
+
data.tar.gz: 205fab1dc18044a3117bc7cdd291ff18aaf5c07e47cc77e72f306acbaf1166b2b34b0b0edacc8676340d6df8b6afe96e5e09f1ad6ed9d8e96966ab38a7b51ab4
|
data/CHANGELOG.md
CHANGED
|
@@ -7,9 +7,48 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.2.0] - 2026-10-27
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- `Skymap::Layers::ConstellationBoundaries` draws the boundaries between the
|
|
15
|
+
constellations as thin dashed lines, stopping at the horizon
|
|
16
|
+
- `Skymap::Catalog::ConstellationBoundaries` gives the borders of the 88 IAU
|
|
17
|
+
constellations, in J2000 coordinates
|
|
18
|
+
- `Skymap::Layers::Moon` draws the Moon with its phase, where it is in the sky,
|
|
19
|
+
from an ephemeris given with `ephem:`
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- The data of the constellations lives in `data/constellations/iau/`:
|
|
24
|
+
`data/constellations/iau.csv` is now `data/constellations/iau/lines.csv`
|
|
25
|
+
|
|
26
|
+
## [0.1.0] - 2026-10-05
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
|
|
30
|
+
- `Skymap::Chart` draws the sky seen by an [Astronoby] observer at a given
|
|
31
|
+
instant and returns it as an SVG string, using a stereographic projection
|
|
32
|
+
with the zenith at the center and the horizon at the edge
|
|
33
|
+
- `Skymap::Canvas` sets the size of the SVG and the padding around the horizon
|
|
34
|
+
- `Chart#render` takes layers, drawn in order on top of the sky
|
|
35
|
+
- `Skymap::Layers::Stars` draws stars sized by their magnitude and scaled with
|
|
36
|
+
the canvas, down to a `magnitude_limit:` (5 by default)
|
|
37
|
+
- `Skymap::Catalog::Stars` gives the 9,096 stars of the Yale Bright Star
|
|
38
|
+
Catalogue
|
|
39
|
+
- `Skymap::Layers::ConstellationLines` draws the lines of the constellations,
|
|
40
|
+
stopping at the horizon
|
|
41
|
+
- `Skymap::Catalog::ConstellationLines` gives the lines of the 88 IAU
|
|
42
|
+
constellations, each with a `bold`, `normal` or `thin` weight
|
|
43
|
+
- `Skymap::Layers::CardinalDirections` labels the cardinal directions around
|
|
44
|
+
the horizon
|
|
45
|
+
|
|
10
46
|
## [0.0.1] - 2026-09-25
|
|
11
47
|
|
|
12
48
|
- Initial release to reserve the gem name on RubyGems.org
|
|
13
49
|
|
|
14
|
-
[Unreleased]: https://github.com/rhannequin/skymap/compare/v0.0
|
|
50
|
+
[Unreleased]: https://github.com/rhannequin/skymap/compare/v0.2.0...HEAD
|
|
51
|
+
[0.2.0]: https://github.com/rhannequin/skymap/compare/v0.1.0...v0.2.0
|
|
52
|
+
[0.1.0]: https://github.com/rhannequin/skymap/compare/v0.0.1...v0.1.0
|
|
15
53
|
[0.0.1]: https://github.com/rhannequin/skymap/releases/tag/v0.0.1
|
|
54
|
+
[Astronoby]: https://github.com/rhannequin/astronoby
|
data/README.md
CHANGED
|
@@ -5,6 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
Skymap is a Ruby library for generating maps of the sky.
|
|
7
7
|
|
|
8
|
+
<p align="center">
|
|
9
|
+
<img
|
|
10
|
+
src="https://raw.githubusercontent.com/rhannequin/skymap/main/sky_map.svg"
|
|
11
|
+
width="480"
|
|
12
|
+
alt="The sky over Paris on September 24, 2026 at 22:00 UTC, with the stars, the constellation lines, the constellation boundaries and the Moon"
|
|
13
|
+
>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
8
16
|
> [!WARNING]
|
|
9
17
|
> This project is in its very early stages, please expect breaking changes.
|
|
10
18
|
|
|
@@ -25,7 +33,217 @@ gem install skymap
|
|
|
25
33
|
|
|
26
34
|
## Usage
|
|
27
35
|
|
|
28
|
-
|
|
36
|
+
Skymap draws the sky seen by an observer at a given instant, and returns it
|
|
37
|
+
as an SVG string:
|
|
38
|
+
|
|
39
|
+
```ruby
|
|
40
|
+
require "skymap"
|
|
41
|
+
|
|
42
|
+
observer = Astronoby::Observer.new(
|
|
43
|
+
latitude: Astronoby::Angle.from_degrees(48.8575),
|
|
44
|
+
longitude: Astronoby::Angle.from_degrees(2.3514)
|
|
45
|
+
)
|
|
46
|
+
instant = Astronoby::Instant.from_time(Time.utc(2026, 9, 24, 22))
|
|
47
|
+
canvas = Skymap::Canvas.new(size: 800, padding: 24)
|
|
48
|
+
stars = Skymap::Catalog::Stars.new.to_a
|
|
49
|
+
|
|
50
|
+
chart = Skymap::Chart.new(observer: observer, instant: instant, canvas: canvas)
|
|
51
|
+
svg = chart.render(
|
|
52
|
+
Skymap::Layers::ConstellationBoundaries.new(
|
|
53
|
+
boundaries: Skymap::Catalog::ConstellationBoundaries.new
|
|
54
|
+
),
|
|
55
|
+
Skymap::Layers::ConstellationLines.new(
|
|
56
|
+
lines: Skymap::Catalog::ConstellationLines.new,
|
|
57
|
+
stars: stars
|
|
58
|
+
),
|
|
59
|
+
Skymap::Layers::Stars.new(stars: stars),
|
|
60
|
+
Skymap::Layers::CardinalDirections.new
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
File.write("sky_map.svg", svg)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The observer and the instant are [Astronoby] objects. Astronoby computes where
|
|
67
|
+
each star is in the sky and Skymap draws it.
|
|
68
|
+
|
|
69
|
+
The map is a disk: the zenith is at the center and the horizon is the edge. It
|
|
70
|
+
uses a [stereographic projection], the most common one for sky charts because
|
|
71
|
+
it keeps the shapes of constellations, even near the horizon. North is at the
|
|
72
|
+
top and East is on the left, as on a map you would hold above your head.
|
|
73
|
+
|
|
74
|
+
### Canvas
|
|
75
|
+
|
|
76
|
+
The canvas is the square SVG the map is drawn on. `size` is its width and
|
|
77
|
+
height, and `padding` is the space between the horizon and the edge of the
|
|
78
|
+
SVG.
|
|
79
|
+
|
|
80
|
+
### Layers
|
|
81
|
+
|
|
82
|
+
A map is the sky, with the layers given to `Chart#render` drawn on top of it,
|
|
83
|
+
in order: each layer is drawn over the previous ones. Without layers,
|
|
84
|
+
`Chart#render` draws an empty sky. Leave a layer out to hide what it draws.
|
|
85
|
+
|
|
86
|
+
#### Stars
|
|
87
|
+
|
|
88
|
+
`Skymap::Layers::Stars` draws stars, bigger the brighter they are.
|
|
89
|
+
`Skymap::Catalog::Stars` gives the 9,096 stars of the Yale Bright Star
|
|
90
|
+
Catalogue (see [Data sources](#data-sources)), but the layer accepts any list
|
|
91
|
+
of `Skymap::Star`.
|
|
92
|
+
|
|
93
|
+
By default, only stars of magnitude 5 or brighter are drawn, which is about
|
|
94
|
+
what you can see from a suburban sky. Use `magnitude_limit:` to draw more or
|
|
95
|
+
fewer stars:
|
|
96
|
+
|
|
97
|
+
```ruby
|
|
98
|
+
Skymap::Layers::Stars.new(stars: stars, magnitude_limit: 6)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
#### Constellation boundaries
|
|
102
|
+
|
|
103
|
+
`Skymap::Layers::ConstellationBoundaries` draws the boundaries between the
|
|
104
|
+
constellations as thin dashed lines, and stops the ones that cross the horizon
|
|
105
|
+
at the edge of the sky. `Skymap::Catalog::ConstellationBoundaries` gives the
|
|
106
|
+
borders of the 88 IAU constellations (see [Data sources](#data-sources)).
|
|
107
|
+
|
|
108
|
+
Layers are drawn in the order they are given: put the boundaries first to draw
|
|
109
|
+
them below the lines and the stars.
|
|
110
|
+
|
|
111
|
+
#### Constellation lines
|
|
112
|
+
|
|
113
|
+
`Skymap::Layers::ConstellationLines` draws the lines of the constellations.
|
|
114
|
+
`Skymap::Catalog::ConstellationLines` gives the lines of the 88 IAU
|
|
115
|
+
constellations (see [Data sources](#data-sources)).
|
|
116
|
+
|
|
117
|
+
Figures are drawn whole, even when some of their stars are fainter than the
|
|
118
|
+
magnitude limit of the stars layer, and lines that cross the horizon stop at
|
|
119
|
+
the edge of the sky. The stars given to the layer must include the stars of
|
|
120
|
+
the lines: lines to a star that is not given are left out.
|
|
121
|
+
|
|
122
|
+
Each line has a weight, as drawn on the IAU charts: `bold` for the best-known
|
|
123
|
+
shapes (the asterisms, such as the Big Dipper or the Teapot of Sagittarius),
|
|
124
|
+
`normal` for the rest of the figures and `thin` for the secondary lines. The
|
|
125
|
+
layer draws the lines it's given, so select the ones you want, for example
|
|
126
|
+
only the asterisms:
|
|
127
|
+
|
|
128
|
+
```ruby
|
|
129
|
+
asterisms = Skymap::Catalog::ConstellationLines.new.select do |line|
|
|
130
|
+
line.weight == :bold
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
Skymap::Layers::ConstellationLines.new(lines: asterisms, stars: stars)
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
#### Moon
|
|
137
|
+
|
|
138
|
+
`Skymap::Layers::Moon` draws the Moon where it is in the sky, with its phase.
|
|
139
|
+
The Moon is drawn upright, as the observer sees it from the ground, so a
|
|
140
|
+
crescent over the western horizon is tilted as it is in the real sky. On the
|
|
141
|
+
chart, this means the lit side does not always face the Sun's position.
|
|
142
|
+
|
|
143
|
+
Astronoby needs an ephemeris to compute where the Moon is: download one once,
|
|
144
|
+
load it and give it to the layer (see the
|
|
145
|
+
[Astronoby documentation][astronoby-ephem] to pick one):
|
|
146
|
+
|
|
147
|
+
```ruby
|
|
148
|
+
Astronoby::Ephem.download(name: "inpop19a.bsp", target: "inpop19a.bsp")
|
|
149
|
+
ephem = Astronoby::Ephem.load("inpop19a.bsp")
|
|
150
|
+
|
|
151
|
+
Skymap::Layers::Moon.new(ephem: ephem)
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
The Moon is drawn larger than it is, as on most sky maps: at its true size it
|
|
155
|
+
would be a dot as small as the faintest stars. Its radius is 3% of the radius
|
|
156
|
+
of the sky. When the center of the Moon is below the horizon, it is left out.
|
|
157
|
+
|
|
158
|
+
#### Cardinal directions
|
|
159
|
+
|
|
160
|
+
`Skymap::Layers::CardinalDirections` labels the cardinal directions (N, E, S,
|
|
161
|
+
W) in the padding, with a size that follows it: a padding of about 3% of the
|
|
162
|
+
size gives readable labels.
|
|
163
|
+
|
|
164
|
+
## Data sources
|
|
165
|
+
|
|
166
|
+
### Stars
|
|
167
|
+
|
|
168
|
+
`data/stars.csv` is extracted from the [Yale Bright Star Catalogue, 5th
|
|
169
|
+
Revised Edition][bsc5] (VizieR V/50): the 9,096 stars of the catalog with
|
|
170
|
+
their Harvard Revised number (`hr`), J2000 coordinates (`right_ascension` in
|
|
171
|
+
hours, `declination` in degrees) and visual magnitude (`magnitude`). The 14
|
|
172
|
+
non-stellar entries kept only for numbering are left out.
|
|
173
|
+
|
|
174
|
+
> Hoffleit, D., Warren Jr., W. H., 1991, _The Bright Star Catalogue, 5th
|
|
175
|
+
> Revised Ed. (Preliminary Version)_, Astronomical Data Center, NSSDC/ADC.
|
|
176
|
+
|
|
177
|
+
The file is generated with `bin/build_catalog`, which downloads the catalog
|
|
178
|
+
from CDS.
|
|
179
|
+
|
|
180
|
+
This research has made use of the VizieR catalogue access tool, CDS,
|
|
181
|
+
Strasbourg, France ([DOI: 10.26093/cds/vizier][vizier-doi]). The original
|
|
182
|
+
description of the VizieR service was published in 2000, A&AS 143, 23.
|
|
183
|
+
|
|
184
|
+
### Constellations
|
|
185
|
+
|
|
186
|
+
`data/constellations/iau/lines.csv` holds the lines of the 88 IAU
|
|
187
|
+
constellations (Mensa and Microscopium have none), one row per segment:
|
|
188
|
+
|
|
189
|
+
- `constellation`: the IAU abbreviation of the constellation.
|
|
190
|
+
- `from_hr`, `to_hr`: the ends of the segment, as HR numbers of stars of
|
|
191
|
+
`data/stars.csv`. An end with two HR numbers, such as `5190 5193`, is the
|
|
192
|
+
midpoint of these two stars: the IAU charts draw some lines to a pair of
|
|
193
|
+
close stars rather than to one of them.
|
|
194
|
+
- `weight`: `bold` for the lines the charts draw thickest, the best-known
|
|
195
|
+
shapes such as the Big Dipper or the Teapot of Sagittarius, `normal` for the
|
|
196
|
+
rest of the main figures, `thin` for the secondary lines.
|
|
197
|
+
|
|
198
|
+
The lines are transcribed from the [IAU constellation maps][oae-maps] of the
|
|
199
|
+
IAU Office of Astronomy for Education, adapted from the original charts by
|
|
200
|
+
the IAU and Sky & Telescope magazine (Roger Sinnott & Rick Fienberg), with the
|
|
201
|
+
constellation patterns of Alan MacRobert, and released under the [Creative
|
|
202
|
+
Commons Attribution 4.0 International][cc-by-4] license.
|
|
203
|
+
|
|
204
|
+
The file was transcribed once from the vector PDF of each map, by matching the
|
|
205
|
+
ends of the lines drawn on the maps to the stars of the catalog, and checked
|
|
206
|
+
against the maps. It is not regenerated by a script.
|
|
207
|
+
|
|
208
|
+
### Constellation boundaries
|
|
209
|
+
|
|
210
|
+
`data/constellations/iau/boundaries.csv` holds the borders between the 88 IAU
|
|
211
|
+
constellations, one row per point of a border, in order:
|
|
212
|
+
|
|
213
|
+
- `border`: the number of the border. Each border between two constellations
|
|
214
|
+
is listed once.
|
|
215
|
+
- `constellations`: the IAU abbreviations of the two constellations the border
|
|
216
|
+
separates.
|
|
217
|
+
- `right_ascension` (hours) and `declination` (degrees): the coordinates of
|
|
218
|
+
the point, in J2000. The borders of the constellations are straight lines of
|
|
219
|
+
right ascension and declination in B1875, and curves in J2000: there is a
|
|
220
|
+
point about every degree to follow them.
|
|
221
|
+
|
|
222
|
+
The borders come from the [Catalogue of Constellation Boundary Data][vi49] by
|
|
223
|
+
Davenhall and Leggett (VizieR VI/49), in the version of Bill J. Gray that
|
|
224
|
+
lists the constellation on each side of a border. They are the boundaries
|
|
225
|
+
defined by Delporte in 1930, in B1875 coordinates.
|
|
226
|
+
|
|
227
|
+
> Davenhall, A. C., Leggett, S. K., 1989, _Catalogue of Constellation Boundary
|
|
228
|
+
> Data_, Royal Observatory Edinburgh.
|
|
229
|
+
|
|
230
|
+
The file is generated with `bin/build_boundaries`, which downloads the
|
|
231
|
+
catalog from CDS, keeps each shared border once, adds the points along the
|
|
232
|
+
borders and precesses them to J2000 with Astronoby.
|
|
233
|
+
|
|
234
|
+
### Ephemeris of the tests
|
|
235
|
+
|
|
236
|
+
The tests of the Moon use `spec/fixtures/de440s_moon_2025_2030_excerpt.bsp`, an
|
|
237
|
+
excerpt of DE440s, the planetary and lunar ephemeris of the [Jet Propulsion
|
|
238
|
+
Laboratory][jpl-ephemerides], distributed by [NAIF][naif]. It only keeps the
|
|
239
|
+
Earth-Moon barycenter, the Sun, the Moon and the Earth, from 2025 to 2030. As
|
|
240
|
+
NAIF asks for modified kernels, its comment area names this project as the
|
|
241
|
+
last to modify it, and points to the original kernel. It is not part of the
|
|
242
|
+
gem.
|
|
243
|
+
|
|
244
|
+
> Park, R. S., Folkner, W. M., Williams, J. G., Boggs, D. H., 2021, _The JPL
|
|
245
|
+
> Planetary and Lunar Ephemerides DE440 and DE441_, The Astronomical Journal,
|
|
246
|
+
> 161, 105.
|
|
29
247
|
|
|
30
248
|
## Development
|
|
31
249
|
|
|
@@ -62,6 +280,16 @@ Everyone interacting in the Skymap project's codebases, issue trackers, chat
|
|
|
62
280
|
rooms and mailing lists is expected to follow the
|
|
63
281
|
[code of conduct](CODE_OF_CONDUCT.md).
|
|
64
282
|
|
|
283
|
+
[Astronoby]: https://github.com/rhannequin/astronoby
|
|
284
|
+
[stereographic projection]: https://en.wikipedia.org/wiki/Stereographic_map_projection
|
|
65
285
|
[Standard Ruby]: https://github.com/standardrb/standard
|
|
66
286
|
[trusted publishing]: https://guides.rubygems.org/trusted-publishing/
|
|
67
287
|
[MIT License]: https://opensource.org/licenses/MIT
|
|
288
|
+
[bsc5]: https://cdsarc.cds.unistra.fr/viz-bin/cat/V/50
|
|
289
|
+
[vizier-doi]: https://doi.org/10.26093/cds/vizier
|
|
290
|
+
[astronoby-ephem]: https://github.com/rhannequin/astronoby/blob/main/docs/ephem.md
|
|
291
|
+
[oae-maps]: https://www.astro4edu.org/
|
|
292
|
+
[vi49]: https://cdsarc.cds.unistra.fr/viz-bin/cat/VI/49
|
|
293
|
+
[jpl-ephemerides]: https://ssd.jpl.nasa.gov/planets/eph_export.html
|
|
294
|
+
[naif]: https://naif.jpl.nasa.gov/naif/rules.html
|
|
295
|
+
[cc-by-4]: https://creativecommons.org/licenses/by/4.0/
|