skymap 0.0.1 → 0.1.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 +21 -2
- data/README.md +150 -1
- data/data/constellations/iau.csv +753 -0
- data/data/stars.csv +9097 -0
- data/lib/skymap/canvas.rb +13 -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_line.rb +5 -0
- data/lib/skymap/context.rb +48 -0
- data/lib/skymap/layers/cardinal_directions.rb +27 -0
- data/lib/skymap/layers/constellation_lines.rb +71 -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/dot.rb +7 -0
- data/lib/skymap/renderer/label.rb +7 -0
- data/lib/skymap/renderer/line.rb +7 -0
- data/lib/skymap/renderer/svg.rb +85 -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 +19 -0
- metadata +76 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 98d71fa1603df92409f0387d0f7d1d162de5ee8d5c332b8171ce019c2f54d684
|
|
4
|
+
data.tar.gz: 414e303a6a023f3ad4eb5d0937fd3aefbb5ad20ebb6f3bb095737cb290e17a8c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6b00bb7e7fb4ff5d22e8948793fbd7a108fa64c56c0d5724cf9ab8cfc698fd99b5dccd14e5eb1dd6bcc3fbfd650b75574290b7a06db3b9653268f1c183325300
|
|
7
|
+
data.tar.gz: 12d6fb6e7000639230d6184a80939b1425bee1f3b4de886b19532b1bf23dbcd1b8128ce49f58012628fd1fdf49350bf9eabf9ffb62297a8a55f7b9d20414b5f8
|
data/CHANGELOG.md
CHANGED
|
@@ -5,11 +5,30 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
## [
|
|
8
|
+
## [0.1.0] - 2026-10-05
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- `Skymap::Chart` draws the sky seen by an [Astronoby] observer at a given
|
|
13
|
+
instant and returns it as an SVG string, using a stereographic projection
|
|
14
|
+
with the zenith at the center and the horizon at the edge
|
|
15
|
+
- `Skymap::Canvas` sets the size of the SVG and the padding around the horizon
|
|
16
|
+
- `Chart#render` takes layers, drawn in order on top of the sky
|
|
17
|
+
- `Skymap::Layers::Stars` draws stars sized by their magnitude and scaled with
|
|
18
|
+
the canvas, down to a `magnitude_limit:` (5 by default)
|
|
19
|
+
- `Skymap::Catalog::Stars` gives the 9,096 stars of the Yale Bright Star
|
|
20
|
+
Catalogue
|
|
21
|
+
- `Skymap::Layers::ConstellationLines` draws the lines of the constellations,
|
|
22
|
+
stopping at the horizon
|
|
23
|
+
- `Skymap::Catalog::ConstellationLines` gives the lines of the 88 IAU
|
|
24
|
+
constellations, each with a `bold`, `normal` or `thin` weight
|
|
25
|
+
- `Skymap::Layers::CardinalDirections` labels the cardinal directions around
|
|
26
|
+
the horizon
|
|
9
27
|
|
|
10
28
|
## [0.0.1] - 2026-09-25
|
|
11
29
|
|
|
12
30
|
- Initial release to reserve the gem name on RubyGems.org
|
|
13
31
|
|
|
14
|
-
[
|
|
32
|
+
[0.1.0]: https://github.com/rhannequin/skymap/compare/v0.0.1...v0.1.0
|
|
15
33
|
[0.0.1]: https://github.com/rhannequin/skymap/releases/tag/v0.0.1
|
|
34
|
+
[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 and the constellation lines"
|
|
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,142 @@ 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::ConstellationLines.new(
|
|
53
|
+
lines: Skymap::Catalog::ConstellationLines.new,
|
|
54
|
+
stars: stars
|
|
55
|
+
),
|
|
56
|
+
Skymap::Layers::Stars.new(stars: stars),
|
|
57
|
+
Skymap::Layers::CardinalDirections.new
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
File.write("sky_map.svg", svg)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
The observer and the instant are [Astronoby] objects. Astronoby computes where
|
|
64
|
+
each star is in the sky and Skymap draws it.
|
|
65
|
+
|
|
66
|
+
The map is a disk: the zenith is at the center and the horizon is the edge. It
|
|
67
|
+
uses a [stereographic projection], the most common one for sky charts because
|
|
68
|
+
it keeps the shapes of constellations, even near the horizon. North is at the
|
|
69
|
+
top and East is on the left, as on a map you would hold above your head.
|
|
70
|
+
|
|
71
|
+
### Canvas
|
|
72
|
+
|
|
73
|
+
The canvas is the square SVG the map is drawn on. `size` is its width and
|
|
74
|
+
height, and `padding` is the space between the horizon and the edge of the
|
|
75
|
+
SVG.
|
|
76
|
+
|
|
77
|
+
### Layers
|
|
78
|
+
|
|
79
|
+
A map is the sky, with the layers given to `Chart#render` drawn on top of it,
|
|
80
|
+
in order: each layer is drawn over the previous ones. Without layers,
|
|
81
|
+
`Chart#render` draws an empty sky. Leave a layer out to hide what it draws.
|
|
82
|
+
|
|
83
|
+
#### Stars
|
|
84
|
+
|
|
85
|
+
`Skymap::Layers::Stars` draws stars, bigger the brighter they are.
|
|
86
|
+
`Skymap::Catalog::Stars` gives the 9,096 stars of the Yale Bright Star
|
|
87
|
+
Catalogue (see [Data sources](#data-sources)), but the layer accepts any list
|
|
88
|
+
of `Skymap::Star`.
|
|
89
|
+
|
|
90
|
+
By default, only stars of magnitude 5 or brighter are drawn, which is about
|
|
91
|
+
what you can see from a suburban sky. Use `magnitude_limit:` to draw more or
|
|
92
|
+
fewer stars:
|
|
93
|
+
|
|
94
|
+
```ruby
|
|
95
|
+
Skymap::Layers::Stars.new(stars: stars, magnitude_limit: 6)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
#### Constellation lines
|
|
99
|
+
|
|
100
|
+
`Skymap::Layers::ConstellationLines` draws the lines of the constellations.
|
|
101
|
+
`Skymap::Catalog::ConstellationLines` gives the lines of the 88 IAU
|
|
102
|
+
constellations (see [Data sources](#data-sources)).
|
|
103
|
+
|
|
104
|
+
Figures are drawn whole, even when some of their stars are fainter than the
|
|
105
|
+
magnitude limit of the stars layer, and lines that cross the horizon stop at
|
|
106
|
+
the edge of the sky. The stars given to the layer must include the stars of
|
|
107
|
+
the lines: lines to a star that is not given are left out.
|
|
108
|
+
|
|
109
|
+
Each line has a weight, as drawn on the IAU charts: `bold` for the best-known
|
|
110
|
+
shapes (the asterisms, such as the Big Dipper or the Teapot of Sagittarius),
|
|
111
|
+
`normal` for the rest of the figures and `thin` for the secondary lines. The
|
|
112
|
+
layer draws the lines it's given, so select the ones you want, for example
|
|
113
|
+
only the asterisms:
|
|
114
|
+
|
|
115
|
+
```ruby
|
|
116
|
+
asterisms = Skymap::Catalog::ConstellationLines.new.select do |line|
|
|
117
|
+
line.weight == :bold
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
Skymap::Layers::ConstellationLines.new(lines: asterisms, stars: stars)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
#### Cardinal directions
|
|
124
|
+
|
|
125
|
+
`Skymap::Layers::CardinalDirections` labels the cardinal directions (N, E, S,
|
|
126
|
+
W) in the padding, with a size that follows it: a padding of about 3% of the
|
|
127
|
+
size gives readable labels.
|
|
128
|
+
|
|
129
|
+
## Data sources
|
|
130
|
+
|
|
131
|
+
### Stars
|
|
132
|
+
|
|
133
|
+
`data/stars.csv` is extracted from the [Yale Bright Star Catalogue, 5th
|
|
134
|
+
Revised Edition][bsc5] (VizieR V/50): the 9,096 stars of the catalog with
|
|
135
|
+
their Harvard Revised number (`hr`), J2000 coordinates (`right_ascension` in
|
|
136
|
+
hours, `declination` in degrees) and visual magnitude (`magnitude`). The 14
|
|
137
|
+
non-stellar entries kept only for numbering are left out.
|
|
138
|
+
|
|
139
|
+
> Hoffleit, D., Warren Jr., W. H., 1991, _The Bright Star Catalogue, 5th
|
|
140
|
+
> Revised Ed. (Preliminary Version)_, Astronomical Data Center, NSSDC/ADC.
|
|
141
|
+
|
|
142
|
+
The file is generated with `bin/build_catalog`, which downloads the catalog
|
|
143
|
+
from CDS.
|
|
144
|
+
|
|
145
|
+
This research has made use of the VizieR catalogue access tool, CDS,
|
|
146
|
+
Strasbourg, France ([DOI: 10.26093/cds/vizier][vizier-doi]). The original
|
|
147
|
+
description of the VizieR service was published in 2000, A&AS 143, 23.
|
|
148
|
+
|
|
149
|
+
### Constellations
|
|
150
|
+
|
|
151
|
+
`data/constellations/iau.csv` holds the lines of the 88 IAU constellations
|
|
152
|
+
(Mensa and Microscopium have none), one row per segment:
|
|
153
|
+
|
|
154
|
+
- `constellation`: the IAU abbreviation of the constellation.
|
|
155
|
+
- `from_hr`, `to_hr`: the ends of the segment, as HR numbers of stars of
|
|
156
|
+
`data/stars.csv`. An end with two HR numbers, such as `5190 5193`, is the
|
|
157
|
+
midpoint of these two stars: the IAU charts draw some lines to a pair of
|
|
158
|
+
close stars rather than to one of them.
|
|
159
|
+
- `weight`: `bold` for the lines the charts draw thickest, the best-known
|
|
160
|
+
shapes such as the Big Dipper or the Teapot of Sagittarius, `normal` for the
|
|
161
|
+
rest of the main figures, `thin` for the secondary lines.
|
|
162
|
+
|
|
163
|
+
The lines are transcribed from the [IAU constellation maps][oae-maps] of the
|
|
164
|
+
IAU Office of Astronomy for Education, adapted from the original charts by
|
|
165
|
+
the IAU and Sky & Telescope magazine (Roger Sinnott & Rick Fienberg), with the
|
|
166
|
+
constellation patterns of Alan MacRobert, and released under the [Creative
|
|
167
|
+
Commons Attribution 4.0 International][cc-by-4] license.
|
|
168
|
+
|
|
169
|
+
The file was transcribed once from the vector PDF of each map, by matching the
|
|
170
|
+
ends of the lines drawn on the maps to the stars of the catalog, and checked
|
|
171
|
+
against the maps. It is not regenerated by a script.
|
|
29
172
|
|
|
30
173
|
## Development
|
|
31
174
|
|
|
@@ -62,6 +205,12 @@ Everyone interacting in the Skymap project's codebases, issue trackers, chat
|
|
|
62
205
|
rooms and mailing lists is expected to follow the
|
|
63
206
|
[code of conduct](CODE_OF_CONDUCT.md).
|
|
64
207
|
|
|
208
|
+
[Astronoby]: https://github.com/rhannequin/astronoby
|
|
209
|
+
[stereographic projection]: https://en.wikipedia.org/wiki/Stereographic_map_projection
|
|
65
210
|
[Standard Ruby]: https://github.com/standardrb/standard
|
|
66
211
|
[trusted publishing]: https://guides.rubygems.org/trusted-publishing/
|
|
67
212
|
[MIT License]: https://opensource.org/licenses/MIT
|
|
213
|
+
[bsc5]: https://cdsarc.cds.unistra.fr/viz-bin/cat/V/50
|
|
214
|
+
[vizier-doi]: https://doi.org/10.26093/cds/vizier
|
|
215
|
+
[oae-maps]: https://www.astro4edu.org/
|
|
216
|
+
[cc-by-4]: https://creativecommons.org/licenses/by/4.0/
|