@johnmorrisdotca/hoshi-stars 0.0.0-stage → 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.
- package/CHANGELOG.md +25 -0
- package/LICENSE +21 -0
- package/NOTICE.md +146 -0
- package/README.md +337 -2
- package/dist/boundaries.d.ts +95 -0
- package/dist/boundaries.js +195 -0
- package/dist/constellations.d.ts +72 -0
- package/dist/constellations.js +105 -0
- package/dist/data/boundaries.d.ts +4 -0
- package/dist/data/boundaries.js +449 -0
- package/dist/data/constellations.d.ts +1 -0
- package/dist/data/constellations.js +91 -0
- package/dist/data/lines.d.ts +2 -0
- package/dist/data/lines.js +92 -0
- package/dist/data/messier.d.ts +2 -0
- package/dist/data/messier.js +116 -0
- package/dist/data/milky-way.d.ts +5 -0
- package/dist/data/milky-way.js +7 -0
- package/dist/data/ngc-ic.d.ts +2 -0
- package/dist/data/ngc-ic.js +11794 -0
- package/dist/data/star-names-ja.d.ts +2 -0
- package/dist/data/star-names-ja.js +4 -0
- package/dist/data/stars.d.ts +4 -0
- package/dist/data/stars.js +5088 -0
- package/dist/deep-sky-core.d.ts +123 -0
- package/dist/deep-sky-core.js +139 -0
- package/dist/deep-sky-ngc-ic.d.ts +34 -0
- package/dist/deep-sky-ngc-ic.js +43 -0
- package/dist/deep-sky.d.ts +49 -0
- package/dist/deep-sky.js +59 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/lines.d.ts +49 -0
- package/dist/lines.js +64 -0
- package/dist/milky-way.d.ts +144 -0
- package/dist/milky-way.js +242 -0
- package/dist/projection.d.ts +127 -0
- package/dist/projection.js +284 -0
- package/dist/sky.d.ts +202 -0
- package/dist/sky.js +283 -0
- package/dist/stars.d.ts +162 -0
- package/dist/stars.js +195 -0
- package/dist/time-scale.d.ts +14 -0
- package/dist/time-scale.js +71 -0
- package/dist/when.d.ts +16 -0
- package/dist/when.js +18 -0
- package/package.json +184 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [Unreleased]
|
|
4
|
+
|
|
5
|
+
## [0.2.0] - 2026-11-08
|
|
6
|
+
|
|
7
|
+
- New entry point `@johnmorrisdotca/hoshi-stars/milky-way`: a brightness map of the Milky Way (about 11 kB of numbers) with the bright core toward Sagittarius and the Great Rift, the Coalsack and the Cygnus Rift as dimmer places. `milkyWayBrightness(point)` gives 0 to 1 toward a point of the sky, `milkyWayBands(levels, { step })` cuts it into ribbons of sky points to fill as soft bands, and `toGalactic` and `fromGalactic` change between right ascension and declination and galactic longitude and latitude. Made by `scripts/make-milky-way-data.py` from SAO star counts (NASA HEASARC; no licence stated, used with credit and removed on request), the IRAS 100 micron and COBE DIRBE dust maps (NASA, public domain) and a bulge of our own figures; see `NOTICE.md`.
|
|
8
|
+
- The demo: a **Milky Way** (天の川) button draws the band under the stars and the lines, in every projection, on by default; `layers=milky` is in the address and in the embed page's.
|
|
9
|
+
|
|
10
|
+
## [0.1.0] - 2026-11-08
|
|
11
|
+
|
|
12
|
+
- New `Star.nameJa`: the katakana name (`シリウス`, `ベテルギウス`) of each of the 136 named stars, which `starByName` also finds. The spellings are the IAU names written in Japanese letters by hand, with the usual Japanese forms; see `NOTICE.md`.
|
|
13
|
+
- The demo: a star's name or a constellation's is left out where it would sit on another label, bright stars first, and comes back when you zoom in; it opens about 90 degrees wide on a desk and 60 on a phone, centred on Orion; the Japanese page names the stars in katakana and the search finds a star by its katakana name.
|
|
14
|
+
- Every one of the 5,080 stars now has its `constellation` (`Star.constellation` is a `string`, no longer `string | undefined`): the catalogue's for the 2,736 with a Bayer letter or Flamsteed number, and the boundaries' for the other 2,344. `starsIn` therefore lists every star in a constellation, not only the lettered ones (Orion: 128 stars, not 73). `designation` is unchanged and is still `undefined` for a star with no letter or number.
|
|
15
|
+
- Fixed: a few Bayer letters were spelled in Latin and spaced from their number (`Xi 2 Cet`, `Nu 1 Dra`, `Mu Sco`, `Pi 3 Ori`; 66 stars). They are now Greek with the number joined, as every other star's: `ξ2 Cet`, `ν1 Dra`, `μ1 Sco`, `π3 Ori`, and found by those names. A name or designation typed the old way no longer finds the star.
|
|
16
|
+
- Fixed: `horizontalFrom` read its moment as TDB while everything else in the package takes UTC, so passing UTC put another planet's sky about 69 seconds early (0.28 degree on Mars). It now takes UTC and converts to Terrestrial Time inside, with the leap seconds from 1972 and Espenak and Meeus's delta T before; TDB minus TT (under 2 ms) is ignored. A caller who added the 69 seconds by hand must stop.
|
|
17
|
+
- A demo on GitHub Pages (https://johnmorrisdotca.github.io/hoshi-stars/): a sky chart you turn with a drag, zoom with the wheel or a pinch and search by name in English or Japanese; seven map projections, constellation lines and boundaries, the Messier objects, a faintest-star slider, a tap for a star's brightness, distance and colour, and "Put it in your page" code for HTML, ES modules, React, Vue, Angular, Svelte and an iframe of the embed page (`embed.html`, which draws what its address says). In English and Japanese, light and dark, at a phone's width and a desk's.
|
|
18
|
+
- New entry point `@johnmorrisdotca/hoshi-stars/lines`: the stick figures of the 88 constellations (`figures`, `figureOf`), each a list of star pairs to join and the stars used, from about 2 kB of data. Our own figures, decided from the star data; every star of a line lies inside its constellation.
|
|
19
|
+
- New entry points `@johnmorrisdotca/hoshi-stars/deep-sky` (the 110 Messier objects: `messier`, `deepSky`, `deepSkyObject`) and `@johnmorrisdotca/hoshi-stars/deep-sky/ngc-ic` (the same functions over 11,898 Messier, NGC and IC objects). Positions, types and names from Wikidata (CC0), checked against NASA/IPAC NED; each object has its cross-identifications, type, constellation, magnitude and size where known.
|
|
20
|
+
- 25 more common star names (136 in all), among them Castor, Mira, Nunki, Sabik, Thuban, Alderamin, Sheliak and Sulafat, spelled as the IAU Working Group on Star Names spells them.
|
|
21
|
+
- New entry point `@johnmorrisdotca/hoshi-stars/sky`: your sky. `horizontal` gives a star's altitude and azimuth (north through east) for a place and a moment, with optional refraction; also `isAboveHorizon`, `greenwichSiderealTime`, `localSiderealTime` and `precess` (J2000 to date). `horizontalFrom` does the same for a place on another planet from its IAU pole and prime meridian, passed in.
|
|
22
|
+
- New entry point `@johnmorrisdotca/hoshi-stars/boundaries`: `constellationAt` says which of the 88 constellations a J2000 (or of-date) position is in, and `boundaryOf` and `boundaries` give the IAU boundaries as closed J2000 outlines to draw, with a point at least every degree along each edge. From N. G. Roman's table of Delporte's boundaries (VizieR VI/42), precessed to B1875.0; 8 of 8 of Roman's own test positions and all 2,736 bright stars that name a constellation agree.
|
|
23
|
+
- New entry point `@johnmorrisdotca/hoshi-stars/constellations`: the 88 IAU constellations with abbreviation, Latin name and genitive, English name, and Japanese name (おおいぬ座) with its hiragana reading (`constellations`, `constellation`, `starsIn`).
|
|
24
|
+
- Map projections for star charts as their own import, `@johnmorrisdotca/hoshi-stars/projection`: `project` and `unproject` for stereographic, orthographic, gnomonic, azimuthal equidistant, equirectangular, Mollweide and Hammer-Aitoff (`hammer`), with the sky's east-left convention, `mirror`, `rotation` and `scale`.
|
|
25
|
+
- First version: the 5,080 stars of the Yale Bright Star Catalogue to magnitude 6.0 with names, positions, proper motion, distance and colour (`stars`, `starByHr`, `starByName`, `starPosition`, `starDistanceLightYears`, `starTemperatureK`, `blackBodyColour`, `starColour`). Moved unchanged from wakusei-planets' `/stars`.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 John Morris
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/NOTICE.md
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# Notice
|
|
2
|
+
|
|
3
|
+
Hoshi Stars is original work by John Morris, under the MIT licence in `LICENSE`.
|
|
4
|
+
|
|
5
|
+
## The stars
|
|
6
|
+
|
|
7
|
+
- **Bright stars (`@johnmorrisdotca/hoshi-stars`)**: the Yale Bright Star Catalogue, D. Hoffleit and W. H. Warren Jr. (1991), "The Bright Star Catalogue, 5th Revised Edition (Preliminary Version)", Astronomical Data Center (NASA Goddard Space Flight Center) and the Centre de Données astronomiques de Strasbourg, catalogue V/50, as NASA's HEASARC serves it (table bsc5p, https://heasarc.gsfc.nasa.gov/W3Browse/star-catalog/bsc5p.html, file heasarc_bsc5p.tdat.gz, read 2026-11-08; a US government source), the 5,080 stars to visual magnitude 6.0, written out as numbers by `scripts/make-star-data.py` into `src/data/stars.ts`. The catalogue's own documentation calls it public domain and the Astronomical Data Center asks that it and the authors be acknowledged, which this line does; there is no formal licence text, so this footing is informal.
|
|
8
|
+
- **Star names**: our own list after the IAU Working Group on Star Names (https://www.iau.org/science/scientific_bodies/working_groups/280/).
|
|
9
|
+
- **Star names in Japanese (`Star.nameJa`, `src/data/star-names-ja.ts`)**: the katakana spelling of each of the 136 IAU names, written by hand for this package. A transliteration of a name is not a creative work, so no licence is needed, and no list is copied: no Wikipedia text and no source with non-commercial or share-alike terms. The spellings follow the usual Japanese forms; those of the 27 stars on the National Astronomical Observatory of Japan's "おもな恒星の名前" page (https://eco.mtk.nao.ac.jp/koyomi/faq/stars.html, read 2026-11-08, copyright NAOJ) were compared with it, and all 27 agree (the comparison only; that page is not copied). The other 109 are our own reading of the IAU spelling and **wait for a Japanese reviewer**.
|
|
10
|
+
- **Star colour**: Ballesteros's B-V to temperature relation (F. J. Ballesteros 2012, EPL 97, 34008) and a piecewise black-body colour fit.
|
|
11
|
+
|
|
12
|
+
## The constellations
|
|
13
|
+
|
|
14
|
+
- **Constellations (`@johnmorrisdotca/hoshi-stars/constellations`)**: facts typed from published lists, in our own table (`src/data/constellations.ts`), with no artwork or lines.
|
|
15
|
+
- The 88 constellations, their three-letter abbreviations, Latin names, Latin genitives and English names: the International Astronomical Union's constellation list (https://www.iau.org/public/themes/constellations/). That address returned 404 on 2026-11-08, so the table was read on 2026-11-08 from a 2013 copy of the same IAU page ("The Constellations | IAU") kept at zfelleg.useribm.hu, and every Latin name, genitive and English name was checked against the text of that copy. Two spellings are ours: "Berenice's Hair" for Coma Berenices (the copy has "the Bernice's Hair") and "Hercules" for the constellation (the copy has "the Hercules"); the leading "the" of the English names is left off.
|
|
16
|
+
- The Japanese names: the National Astronomical Observatory of Japan, Ephemeris Computation Office, "星座の名前" (Constellation names; https://eco.mtk.nao.ac.jp/koyomi/faq/constellations.html), read 2026-11-08. It gives the abbreviation, the name in kana and the Latin name of all 88, and every abbreviation and Latin name matched the IAU table. The hiragana reading is worked out from that kana form in code.
|
|
17
|
+
- No Wikipedia text is used.
|
|
18
|
+
|
|
19
|
+
## The constellation boundaries
|
|
20
|
+
|
|
21
|
+
- **Boundaries (`@johnmorrisdotca/hoshi-stars/boundaries`)**: N. G. Roman (1987), "Identification of a Constellation from a Position", Publications of the Astronomical Society of the Pacific 99, 695, and VizieR catalogue VI/42, which holds her table of the constellation boundaries that the International Astronomical Union adopted from E. Delporte (1930), "Delimitation Scientifique des Constellations" (Cambridge University Press), put into electronic form by Barry Rappaport. The table (`data.dat`, 357 rows, on the equator and equinox of B1875.0) was read on 2026-11-08 from the Harvard mirror of VizieR (https://vizier.cfa.harvard.edu/ftp/cats/VI/42/), because the CDS hosts refused the connection from our machine; the ReadMe, `test.in`, `out.dat` and the FORTRAN `program.f` (for its precession, used in a test) were read there too. No licence stated; removed on request. The rows and the outlines worked out from them are written by `scripts/make-boundary-data.py` into `src/data/boundaries.ts`.
|
|
22
|
+
- **Precession to B1875.0**: the rigorous angles of the IAU 1976 system as J. Meeus gives them in "Astronomical Algorithms" (2nd ed., 1998), chapter 21, written out as formulas; no code is copied. The test compares it with Herget's precession as Roman's own program applies it.
|
|
23
|
+
|
|
24
|
+
## The constellation figures
|
|
25
|
+
|
|
26
|
+
- **Figures (`@johnmorrisdotca/hoshi-stars/lines`)**: our own. For each of the 88 constellations the stars to join were chosen for this package from the positions and brightness of the Yale stars and written as lists of Bright Star Catalogue (HR) numbers in `src/data/lines.ts`. No figure is copied or transcribed from a book, a star atlas, Sky & Telescope, H. A. Rey, the IAU's charts, Stellarium or d3-celestial; the common shapes (the Dipper, Orion's belt, the W) are the plain joins of bright stars that anyone would draw. Every star of a line lies inside the constellation (checked with the boundaries in `test/lines.test.ts`).
|
|
27
|
+
|
|
28
|
+
## The map projections
|
|
29
|
+
|
|
30
|
+
- **Projections (`@johnmorrisdotca/hoshi-stars/projection`)**: stereographic, orthographic, gnomonic, azimuthal equidistant, equirectangular, Mollweide and Hammer, written from the formulas in J. P. Snyder, "Map Projections: A Working Manual", U.S. Geological Survey Professional Paper 1395 (1987), a U.S. Government work in the public domain. The formulas are mathematics; no library's code is copied.
|
|
31
|
+
|
|
32
|
+
## The Milky Way
|
|
33
|
+
|
|
34
|
+
- **Milky Way brightness (`@johnmorrisdotca/hoshi-stars/milky-way`)**: a grid of 360 by 120 numbers of 0 to 31 (1 degree of galactic longitude by 0.5 degree of latitude, within 30 degrees of the plane) in `src/data/milky-way.ts`, written by `scripts/make-milky-way-data.py` from three sources. No image of the sky is read, copied or traced.
|
|
35
|
+
- **Star counts: the SAO Star Catalog** (Smithsonian Astrophysical Observatory Star Catalog, 258,944 stars to about visual magnitude 9.3; catalogue I/131A at the CDS), as NASA's HEASARC serves it (table `sao`, https://heasarc.gsfc.nasa.gov/W3Browse/star-catalog/sao.html, file https://heasarc.gsfc.nasa.gov/FTP/heasarc/dbase/tdat_files/heasarc_sao.tdat.gz, read 2026-11-08). **No licence is stated for this catalogue: it is used with credit to the Smithsonian Astrophysical Observatory and NASA's HEASARC, and removed on request.** Only the stars of visual magnitude 7.0 to 9.0 are counted, on an equal-area grid, and only the counts (a handful of smoothed numbers per square degree) are kept: no star of the catalogue is in the package. The counts show where the Milky Way's stars are thick and, where the catalogue falls short of its surroundings, where near dust (the Coalsack) hides the stars behind it.
|
|
36
|
+
- **Dust: the IRAS Sky Survey Atlas, 100 micron** (NASA/IPAC Infrared Science Archive; IRAS was a NASA, Dutch and British mission), as NASA's SkyView serves it (https://skyview.gsfc.nasa.gov, survey `IRAS 100`, read 2026-11-08), which labels the survey "Copyright: Public Domain" and its provenance "NASA IPAC/Jet Propulsion Laboratory". Where the atlas has unobserved strips, **COBE DIRBE's zodi-subtracted mission-average 100 micron map** (the COBE Team, NASA Goddard; SkyView survey `COBE DIRBE/ZSMA`, labelled "Copyright: Public Domain") fills them, on a scale matched in the plane. The map's glow compared with the glow around it says where the dust lanes are (the Great Rift, the Cygnus Rift); it is not an image of them. "IRAS" in SkyView is the ISSA atlas, not the Schlegel, Finkbeiner and Davis map nor IRIS, which others derived from it and which are not used.
|
|
37
|
+
- **The bulge and the disk: our own figures.** The bright core toward Sagittarius is a Gaussian some 8 degrees along the plane and 3.5 across, and the glow along the plane follows an exponential disk (scale length 2.6 kpc, the Sun 8.2 kpc from the centre) added up along each line of sight: round, published values of the Galaxy's size, not a copy of any map or model. The counts change the disk's glow only by how much each direction is richer or poorer than its neighbourhood.
|
|
38
|
+
- **Galactic frame**: the IAU's (north galactic pole at right ascension 192.85948 and declination 27.12825 degrees, and the north celestial pole at galactic longitude 122.93192 degrees, J2000), written as formulas.
|
|
39
|
+
- **Not used**: any photograph or drawing of the Milky Way (ESO's panorama, NASA's and ESA's pictures and Gaia's colour map were looked at, nowhere in the data or code, only to judge the result by eye); Planck's maps; the Schlegel, Finkbeiner and Davis dust map; Stellarium's textures (GPL) and anyone's artwork.
|
|
40
|
+
|
|
41
|
+
## Your sky
|
|
42
|
+
|
|
43
|
+
- **Horizon view (`@johnmorrisdotca/hoshi-stars/sky`)**: written from the formulas in J. Meeus, "Astronomical Algorithms", 2nd ed. (Willmann-Bell, 1998): Greenwich mean sidereal time (the IAU 1982 expression, chapter 12), equatorial to horizontal coordinates (chapter 13), atmospheric refraction (Saemundsson's formula, chapter 16) and precession from J2000 (the IAU 1976 constants, chapter 21). The formulas are mathematics and the worked examples (12.a, 12.b, 13.b, 21.b) are used only as test values; no book text or library code is copied.
|
|
44
|
+
- **UTC to Terrestrial Time (`horizontalFrom`)**: the leap seconds (TAI - UTC, 10 s in 1972 to 37 s in 2017, a table of facts published by the IERS and the BIPM) plus 32.184 s; before 1972, delta T by the polynomial fits of F. Espenak and J. Meeus ("Polynomial Expressions for Delta T", NASA Eclipse Web Site, 2006), written out as formulas in `src/time-scale.ts`; no code is copied. The test compares the leap-second part with wakusei-planets' conversion, a dev-only second opinion.
|
|
45
|
+
- **Another planet**: the convention is that of the IAU Working Group on Cartographic Coordinates and Rotational Elements (pole right ascension and declination, and W = W0 + rate d), as in Archinal et al., Celestial Mechanics and Dynamical Astronomy 130, 22 (2018). The tests type in the 2015 Mars values from that report; the package itself holds no planet data.
|
|
46
|
+
|
|
47
|
+
## The deep-sky objects
|
|
48
|
+
|
|
49
|
+
- **Messier, NGC and IC objects (`@johnmorrisdotca/hoshi-stars/deep-sky` and `.../deep-sky/ngc-ic`)**: Wikidata (https://www.wikidata.org), read on 2026-11-08 through its SPARQL endpoint (https://query.wikidata.org/sparql) by `scripts/make-deep-sky-data.py`, which writes `src/data/messier.ts` (110 objects) and `src/data/ngc-ic.ts` (11,788 objects). The sentence relied on is Wikidata's own, at https://www.wikidata.org/wiki/Wikidata:Licensing: "All structured data (i.e. the main, Property, Lexeme, and EntitySchema namespaces) is released into the public domain under Creative Commons Zero." Wikidata's labels and aliases are structured data, so the English names are CC0 too; no Wikipedia text is used.
|
|
50
|
+
- What is read: items with a catalog code (P528) in the Messier (Q14530), New General (Q14534) or Index (Q741672) catalogue, qualified by catalogue (P972), with a plain number, that have a right ascension (P6257) and a declination (P6258) in degrees; their type (P31, mapped to galaxy, globular cluster, open cluster, nebula, planetary nebula, supernova remnant or other through the subclasses of Q318, Q42372, Q13632, Q207436, Q11276 and Q11387), V-band apparent magnitude (P1215 with band Q4892529), angular diameter (P5348), English label and aliases, and constellation (P59, turned into the IAU abbreviation with `src/data/constellations.ts`). Statements ranked deprecated are ignored. The epoch qualifier (P6259) is J2000.0 or absent on every position (the property's default is J2000); a position with any other epoch or unit would be dropped, and none is. An item with positions that disagree by more than 1 arc-minute is left out (14 NGC and IC items); one that appears under two numbers within 1 arc-minute of each other is one object.
|
|
51
|
+
- The queries, word for word as in the script. Each begins with the same selection, shown as `<selection>`:
|
|
52
|
+
|
|
53
|
+
```sparql
|
|
54
|
+
<selection> is:
|
|
55
|
+
VALUES ?cat { wd:Q14530 wd:Q14534 wd:Q741672 }
|
|
56
|
+
?item p:P528 ?cs . ?cs ps:P528 ?id ; pq:P972 ?cat .
|
|
57
|
+
FILTER(REGEX(?id, "^(M|NGC|IC) ?[0-9]+[A-Za-z]?$"))
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
`ids`:
|
|
61
|
+
|
|
62
|
+
```sparql
|
|
63
|
+
SELECT DISTINCT ?item ?id ?cat WHERE {
|
|
64
|
+
<selection>
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
`coordinates`:
|
|
69
|
+
|
|
70
|
+
```sparql
|
|
71
|
+
SELECT DISTINCT ?item ?ra ?raUnit ?raEpoch ?raRank ?dec ?decUnit ?decEpoch ?decRank WHERE {
|
|
72
|
+
<selection>
|
|
73
|
+
?item p:P6257 ?rs . ?rs psv:P6257 ?rv ; wikibase:rank ?raRank . ?rv wikibase:quantityAmount ?ra ; wikibase:quantityUnit ?raUnit .
|
|
74
|
+
?item p:P6258 ?ds . ?ds psv:P6258 ?dv ; wikibase:rank ?decRank . ?dv wikibase:quantityAmount ?dec ; wikibase:quantityUnit ?decUnit .
|
|
75
|
+
OPTIONAL { ?rs pq:P6259 ?raEpoch }
|
|
76
|
+
OPTIONAL { ?ds pq:P6259 ?decEpoch }
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
`types`:
|
|
81
|
+
|
|
82
|
+
```sparql
|
|
83
|
+
SELECT DISTINCT ?item ?class ?rank WHERE {
|
|
84
|
+
<selection>
|
|
85
|
+
?item p:P31 ?ts . ?ts ps:P31 ?class ; wikibase:rank ?rank .
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
`classes`:
|
|
90
|
+
|
|
91
|
+
```sparql
|
|
92
|
+
SELECT DISTINCT ?class ?kind WHERE {
|
|
93
|
+
VALUES ?kind { wd:Q318 wd:Q42372 wd:Q13632 wd:Q207436 wd:Q11276 wd:Q11387 }
|
|
94
|
+
?class wdt:P279* ?kind .
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
`magnitudes`:
|
|
99
|
+
|
|
100
|
+
```sparql
|
|
101
|
+
SELECT DISTINCT ?item ?mag ?rank WHERE {
|
|
102
|
+
<selection>
|
|
103
|
+
?item p:P1215 ?ms . ?ms psv:P1215 ?mv ; wikibase:rank ?rank ; pq:P1227 wd:Q4892529 . ?mv wikibase:quantityAmount ?mag .
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
`labels`:
|
|
108
|
+
|
|
109
|
+
```sparql
|
|
110
|
+
SELECT DISTINCT ?item ?label ?constellationLabel WHERE {
|
|
111
|
+
<selection>
|
|
112
|
+
OPTIONAL { ?item rdfs:label ?label . FILTER(LANG(?label) = "en") }
|
|
113
|
+
OPTIONAL { ?item wdt:P59 ?constellation }
|
|
114
|
+
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
`aliases`:
|
|
119
|
+
|
|
120
|
+
```sparql
|
|
121
|
+
SELECT DISTINCT ?item ?alias WHERE {
|
|
122
|
+
<selection>
|
|
123
|
+
?item skos:altLabel ?alias . FILTER(LANG(?alias) = "en")
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
`sizes`:
|
|
128
|
+
|
|
129
|
+
```sparql
|
|
130
|
+
SELECT DISTINCT ?item ?size ?unit ?rank WHERE {
|
|
131
|
+
<selection>
|
|
132
|
+
?item p:P5348 ?ss . ?ss psv:P5348 ?sv ; wikibase:rank ?rank . ?sv wikibase:quantityAmount ?size ; wikibase:quantityUnit ?unit .
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
- **Cross-check against NASA/IPAC NED** (https://ned.ipac.caltech.edu, object-name lookup at https://ned.ipac.caltech.edu/srs/ObjectLookup, read 2026-11-08, by `scripts/check-deep-sky-ned.py`). NED's page on acknowledging it (https://ned.ipac.caltech.edu/Documents/Overview/Acknowledgments) asks for: "This research has made use of the NASA/IPAC Extragalactic Database, which is funded by the National Aeronautics and Space Administration and operated by the California Institute of Technology." NED is used here as a check and for the positions below, which are facts about where an object is. Every one of the 110 Messier objects and of the 11,788 NGC and IC objects was looked up. All 110 Messier objects were found, 102 within 1 arc-minute of Wikidata's position (median 0.024', 95th percentile 1.05') and 8 over: M8, M24, M29, M34, M35, M45, M50 and M86, which are star clusters and nebulae whose centre is a matter of convention, except M86, which has two declinations 3 arc-minutes apart on Wikidata. Of the NGC and IC objects NED knew 11,599 (the other 189 are nearly all lettered parts such as NGC 602A): 11,057 (95.3 per cent) within 1 arc-minute (median 0.007', 95th percentile 0.90'), 10,183 within 6 arc-seconds, and 542 over 1 arc-minute, the worst IC 2888 at 5,857' (about 98 degrees: a wrong value on Wikidata), then NGC 3132 at 5,515', IC 1930 and IC 917 at over 3,000'. **Wherever Wikidata's position is more than 1 arc-minute from NED's, NED's is used** (550 positions, listed with Wikidata's own and the distance in `scripts/deep-sky-ned-positions.tsv`); after that none is over 1 arc-minute. The 189 that NED does not know keep Wikidata's position and are unchecked.
|
|
137
|
+
- **Constellations of the Messier objects**: each is the constellation Wikidata names (P59). NASA HEASARC's Messier table (below) names the same constellation for every one of the 109 it lists, and in the test each Messier object lies within 35 degrees of a bright star of its constellation.
|
|
138
|
+
- **Messier magnitudes and sizes**: NASA's HEASARC Messier table (`heasarc_messier`, https://heasarc.gsfc.nasa.gov/W3Browse/general-catalog/messier.html, file https://heasarc.gsfc.nasa.gov/FTP/heasarc/dbase/tdat_files/heasarc_messier.tdat.gz, read 2026-11-08; a US government source), compiled from Table III of "Sky Catalog 2000.0, Volume 2" (Hirshfeld and Sinnott, Sky Publishing, 1985). The numbers used are a visual magnitude and a major axis in arc-minutes for each object, which are measurements, not expression. Wikidata's V magnitude for 14 Messier objects is more than a magnitude from it (the central star's for the planetary nebulae M27, M57, M76 and M97, and values more than a magnitude from HEASARC's for M10, M14, M19, M20, M22, M49, M71, M84, M88 and M91); HEASARC's value is used for all 108 it lists, Wikidata's for M73 and M102. A planetary nebula outside the Messier list gets no magnitude, for the same reason. HEASARC's size is used for the 107 Messier objects it gives one for (Wikidata has a size for only 6; M40, M73 and M102 have none).
|
|
139
|
+
- **M102**: the table has no entry for it. HEASARC's page says: "M 102 is now generally considered to be spurious, and the object so named was actually M 101." Wikidata and the modern lists (and this table) take M102 to be the lenticular galaxy NGC 5866 in Draco; NED answers "M102" with M101, so M102 was compared with NED's NGC 5866 (0.01 arc-minutes apart). **M40** (Winnecke 4, a double star) and **M73** (four stars, NGC 6994) are listed by Messier and are in the table as `other`.
|
|
140
|
+
|
|
141
|
+
## Deliberately not used
|
|
142
|
+
|
|
143
|
+
- ESA's Hipparcos, Tycho and Gaia catalogues: CC BY-NC 3.0 IGO (non-commercial), which an MIT package cannot pass on.
|
|
144
|
+
- HYG, AT-HYG and OpenNGC: CC BY-SA 4.0, which would put share-alike terms on this package's data. The NGC and IC objects come from Wikidata (CC0) instead, and none of OpenNGC's data is used.
|
|
145
|
+
- Stellarium's sky-culture files: GPL.
|
|
146
|
+
- d3-celestial's data files: the code is BSD-3-Clause but the data licence is not stated.
|
package/README.md
CHANGED
|
@@ -1,3 +1,338 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Hoshi Stars 星
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<p>Part of <strong>SpaceProgramX (SPX)</strong>, the space packages: <a href="https://github.com/johnmorrisdotca/wakusei-planets">Wakusei Planets</a> · <a href="https://github.com/johnmorrisdotca/hoshi-stars">Hoshi Stars</a> · <a href="https://github.com/johnmorrisdotca/chikyu-earth">Chikyu Earth</a> · <a href="https://github.com/johnmorrisdotca/uchusen-rockets">Uchusen Rockets</a></p>
|
|
4
|
+
|
|
5
|
+
**[Try the demo](https://johnmorrisdotca.github.io/hoshi-stars/)**: a sky chart you turn, zoom and search, in English and Japanese.
|
|
6
|
+
|
|
7
|
+
The stars you can see without a telescope: 5,080 of them, with names, positions, proper motion, distance and colour. Typed, no dependencies, about 100 kB gzipped. Hoshi (星) is the Japanese word for a star.
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install @johnmorrisdotca/hoshi-stars
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { starByName, starColour, starDistanceLightYears, starPosition, stars } from "@johnmorrisdotca/hoshi-stars";
|
|
15
|
+
|
|
16
|
+
const sirius = starByName("Sirius")!;
|
|
17
|
+
console.log(sirius.designation, sirius.magnitude, starColour(sirius)); // α CMa -1.46 #c9daff
|
|
18
|
+
console.log(starDistanceLightYears(sirius)?.toFixed(1), "light-years"); // 8.7
|
|
19
|
+
console.log(starPosition(starByName("Arcturus")!, Date.UTC(2100, 0, 1))); // carried by its proper motion
|
|
20
|
+
console.log(stars({ magnitude: 2 }).length, "stars as bright as magnitude 2"); // 50
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
| Function | Gives |
|
|
24
|
+
|---|---|
|
|
25
|
+
| `stars({ magnitude? })` | the stars as bright as a magnitude, brightest first |
|
|
26
|
+
| `starByHr(hr)`, `starByName(text)` | one star by its Bright Star Catalogue number, or its name (English or katakana) or designation |
|
|
27
|
+
| `starPosition(star, when?)` | right ascension and declination (degrees, J2000 frame) carried by proper motion |
|
|
28
|
+
| `starDistanceLightYears(star)` | the distance from the parallax |
|
|
29
|
+
| `starTemperatureK(bv)`, `blackBodyColour(kelvin)`, `starColour(star)` | temperature and a colour to draw |
|
|
30
|
+
|
|
31
|
+
Counts: 15 stars to magnitude 1, 50 to 2, 174 to 3, 518 to 4, 1,630 to 5 and 5,080 to 6.
|
|
32
|
+
|
|
33
|
+
## The 88 constellations
|
|
34
|
+
|
|
35
|
+
Their own import, about 2 kB gzipped, so the bright-star entry stays small. Each has its IAU abbreviation, Latin name and genitive, English name, and Japanese name with its hiragana reading (`おおいぬ座`, `おおいぬざ`).
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import { constellation, constellations, starsIn } from "@johnmorrisdotca/hoshi-stars/constellations";
|
|
39
|
+
|
|
40
|
+
const dog = constellation("CMa")!; // or "Canis Major", "Great Dog", "おおいぬ座", in any case
|
|
41
|
+
console.log(dog.name, dog.genitive, dog.english, dog.japanese, dog.reading); // Canis Major Canis Majoris Great Dog おおいぬ座 おおいぬざ
|
|
42
|
+
console.log(constellations().length); // 88
|
|
43
|
+
console.log(starsIn("Ori").slice(0, 2).map((s) => s.name)); // [ 'Rigel', 'Betelgeuse' ]
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
| Function | Gives |
|
|
47
|
+
|---|---|
|
|
48
|
+
| `constellations()` | all 88, alphabetical by Latin name |
|
|
49
|
+
| `constellation(text)` | one, by abbreviation, Latin name, genitive, English name, Japanese name or reading; `undefined` if none |
|
|
50
|
+
| `starsIn(text)` | the bright stars that lie in it, brightest first (`RangeError` for a text that is no constellation) |
|
|
51
|
+
|
|
52
|
+
## Which constellation, and the boundaries
|
|
53
|
+
|
|
54
|
+
`@johnmorrisdotca/hoshi-stars/boundaries` is its own import. `constellationAt` says which of the 88 constellations a position is in; `boundaryOf` and `boundaries` give the boundary lines to draw. The boundaries are the IAU's (Delporte 1930) as N. G. Roman (1987) tabulated them on the equinox of B1875.0 (VizieR VI/42); a position is precessed to B1875.0 first, with the IAU 1976 angles from Meeus.
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
import { starByName } from "@johnmorrisdotca/hoshi-stars";
|
|
58
|
+
import { boundaryOf, constellationAt } from "@johnmorrisdotca/hoshi-stars/boundaries";
|
|
59
|
+
|
|
60
|
+
console.log(constellationAt(starByName("Betelgeuse")!).name); // Orion
|
|
61
|
+
console.log(constellationAt({ rightAscension: 0, declination: 90 }).abbreviation); // UMi
|
|
62
|
+
console.log(constellationAt({ rightAscension: 135, declination: 65 }, Date.UTC(1950, 0, 1)).abbreviation); // a position of date: UMa
|
|
63
|
+
const outline = boundaryOf("Cru").outlines[0]!; // closed, J2000 degrees, first point repeated as the last
|
|
64
|
+
console.log(outline.length, outline[0]);
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
| Function | Gives |
|
|
68
|
+
|---|---|
|
|
69
|
+
| `constellationAt(position, when?)` | the `Constellation` the J2000 position is in (a position of date when `when` is given); `TypeError` or `RangeError` for bad input |
|
|
70
|
+
| `boundaryOf(text, { step? })` | one constellation's `outlines`: closed rings of `{ rightAscension, declination }` in J2000 degrees (Serpens has two) |
|
|
71
|
+
| `boundaries({ step? })` | all 88, in the order of `constellations()` |
|
|
72
|
+
|
|
73
|
+
- Every edge of the boundaries runs along a line of constant right ascension or constant declination on B1875.0, which after precession is a slightly tilted curve. Each edge is cut into pieces of at most `step` degrees of arc (1 by default, 0.01 to 90), so the whole sky is about 9,700 points at the default; join them with straight lines, and project each point (a ring that crosses 0 h jumps from near 360 to near 0 in raw degrees).
|
|
74
|
+
- Checked against Roman's own 8 test positions, every one of the 2,736 bright stars whose catalogue entry names a constellation (all agree), and the areas the IAU lists (Hydra 1302.8, Crux 68.4 square degrees; the 88 add up to the whole sky, 41,253).
|
|
75
|
+
- A point within a few arc-seconds of a boundary can fall either side: the table is to a hundredth of a second of time and the precession is the modern one, not 1930's.
|
|
76
|
+
- About 7 kB gzipped of data on top of the constellations table, and 100,000 lookups take about 40 ms.
|
|
77
|
+
|
|
78
|
+
## Constellation lines
|
|
79
|
+
|
|
80
|
+
`@johnmorrisdotca/hoshi-stars/lines` is its own import, about 2 kB gzipped, so a chart without lines pays nothing. Each of the 88 constellations has a stick figure: pairs of its bright stars to join with a line. The figures are our own, decided from the star data (`NOTICE.md`); every star of a line lies inside the constellation, so one figure never runs into the next.
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
import { figureOf, figures } from "@johnmorrisdotca/hoshi-stars/lines";
|
|
84
|
+
|
|
85
|
+
const orion = figureOf("Ori"); // or "Orion", "Hunter", "オリオン座"
|
|
86
|
+
console.log(orion.stars.length, orion.segments.length);
|
|
87
|
+
for (const [a, b] of orion.segments) console.log(a.name ?? a.designation, "to", b.name ?? b.designation);
|
|
88
|
+
console.log(figures().length); // 88
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
| Function | Gives |
|
|
92
|
+
|---|---|
|
|
93
|
+
| `figures()` | all 88 figures, in the order of `constellations()` |
|
|
94
|
+
| `figureOf(text)` | one, by any name `constellation` accepts: its `constellation`, the `stars` it uses and the `segments` (pairs of stars) to draw (`RangeError` for a text that is no constellation) |
|
|
95
|
+
|
|
96
|
+
- Project each star with `/projection` and draw each pair as a line. On a wide projection (equirectangular, Mollweide, Hammer) skip a line whose two ends land more than half the chart apart: it crosses the edge.
|
|
97
|
+
- A figure with one star and no lines is allowed where a figure makes no sense; every constellation at this version has lines.
|
|
98
|
+
|
|
99
|
+
## Map projections
|
|
100
|
+
|
|
101
|
+
`@johnmorrisdotca/hoshi-stars/projection` turns a sky position into a point on a flat chart, and back. Pure maths, no dependencies, and a page that does not import it does not pay for it. The kinds are `stereographic`, `orthographic`, `gnomonic`, `equidistant`, `equirectangular`, `mollweide` and `hammer` (Hammer-Aitoff).
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
import { starByName, starPosition } from "@johnmorrisdotca/hoshi-stars";
|
|
105
|
+
import { project, unproject } from "@johnmorrisdotca/hoshi-stars/projection";
|
|
106
|
+
|
|
107
|
+
const options = { centre: { rightAscension: 83.8, declination: -5.4 }, scale: 300 }; // Orion in the middle
|
|
108
|
+
const betelgeuse = project("stereographic", starPosition(starByName("Betelgeuse")!), options);
|
|
109
|
+
console.log(betelgeuse); // { x: -26.3, y: 67.4 }: left of the middle, above it
|
|
110
|
+
console.log(unproject("stereographic", betelgeuse!, options)); // back to degrees
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
- `x` runs right and `y` runs up. The default is the sky seen looking up: north is up and east is to the LEFT, so `x` grows toward decreasing right ascension. Pass `mirror: true` for the map convention, east right.
|
|
114
|
+
- `project` gives `undefined` for a point that is not on the visible side (the far hemisphere of `orthographic` and `gnomonic`, the antipode of `stereographic`). `unproject` gives `undefined` outside the map.
|
|
115
|
+
- `scale` is the radius of the sky in drawing units (default 1). `rotation` turns the chart anticlockwise, in degrees. For `equirectangular` to give degrees, pass `scale: 180 / Math.PI`.
|
|
116
|
+
- `mollweide` and `hammer` are equal-area ovals of the whole sky, 2 sqrt(2) by sqrt(2) times `scale`, turned so the centre is the middle.
|
|
117
|
+
- A million projections take 50 to 230 ms on a laptop (Mollweide is the slowest). The formulas are from J. P. Snyder, *Map Projections: A Working Manual* (USGS Professional Paper 1395, 1987).
|
|
118
|
+
|
|
119
|
+
## Your sky, and the sky from another planet
|
|
120
|
+
|
|
121
|
+
`@johnmorrisdotca/hoshi-stars/sky` says where a star stands over your head: its altitude above the horizon and its azimuth (degrees from north through east) at a place and a moment. Pure maths, no dependencies, and a page that does not import it does not pay for it.
|
|
122
|
+
|
|
123
|
+
```ts
|
|
124
|
+
import { starByName, starPosition } from "@johnmorrisdotca/hoshi-stars";
|
|
125
|
+
import { horizontal, isAboveHorizon, localSiderealTime } from "@johnmorrisdotca/hoshi-stars/sky";
|
|
126
|
+
|
|
127
|
+
const vancouver = { latitude: 49.28, longitude: -123.12 }; // degrees north, degrees east
|
|
128
|
+
const now = new Date("2026-11-08T06:00:00Z");
|
|
129
|
+
console.log(horizontal(starPosition(starByName("Sirius")!), vancouver, now)); // { altitude: ..., azimuth: ... }
|
|
130
|
+
console.log(horizontal(starPosition(starByName("Polaris")!), vancouver, now).altitude); // 49.8: within a degree of your latitude
|
|
131
|
+
console.log(isAboveHorizon(starPosition(starByName("Sirius")!), vancouver, now));
|
|
132
|
+
console.log(localSiderealTime(now, vancouver.longitude)); // the right ascension on your meridian
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
- `horizontal(position, observer, when, options?)` takes a J2000 position (any `{ rightAscension, declination }` in degrees, such as `starPosition(star)`), carries it to the date (`precess`, IAU 1976), finds the hour angle from the local mean sidereal time (`greenwichSiderealTime`, IAU 1982) and returns `{ altitude, azimuth }`. A position that is already of the date (a planet from an almanac) takes `equinox: "date"`.
|
|
136
|
+
- The altitude is geometric. `refraction: true` adds the bending of light by the air (Saemundsson's formula: about 0.48 degree at the horizon, 0.017 at 45 degrees up, none at the zenith), with `pressureHpa` (default 1010) and `temperatureC` (default 10); it is not applied below -1 degree. `isAboveHorizon` takes the same options.
|
|
137
|
+
- Accuracy: about an arc-minute. UTC stands for UT, and nutation, aberration, parallax and the star's own proper motion (add it with `starPosition(star, when)`) are left out. `heightM` is checked but changes nothing for a star.
|
|
138
|
+
|
|
139
|
+
### From another planet
|
|
140
|
+
|
|
141
|
+
The sky of another planet turns about that planet's own pole. `horizontalFrom(position, spin, observer, when)` takes the pole and prime meridian as the IAU Working Group on Cartographic Coordinates and Rotational Elements (WGCCRE) gives them, so the planet data stays with you (this package never imports wakusei-planets):
|
|
142
|
+
|
|
143
|
+
```ts
|
|
144
|
+
import { starByName, starPosition } from "@johnmorrisdotca/hoshi-stars";
|
|
145
|
+
import { horizontalFrom } from "@johnmorrisdotca/hoshi-stars/sky";
|
|
146
|
+
|
|
147
|
+
// Mars, IAU 2015 values at J2000: pole right ascension and declination, and W = w0 + rate * days since J2000
|
|
148
|
+
const mars = { pole: { rightAscension: 317.269202, declination: 54.432516 }, primeMeridian: { w0: 176.049863, rate: 350.891982443297 } };
|
|
149
|
+
const deneb = starPosition(starByName("Deneb")!);
|
|
150
|
+
console.log(horizontalFrom(deneb, mars, { latitude: 90, longitude: 0 }, new Date()).altitude); // 79.8: Deneb is 10 degrees from Mars's pole
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
- **The stars look the same from every planet.** The nearest star, Proxima Centauri, shifts about 40 arc-seconds seen from Pluto (parallax 0.77 arc-second times 49 AU at the farthest), a typical star far less, so a J2000 position serves anywhere in the solar system. Only the pole and the turning change.
|
|
154
|
+
- `rate` is degrees a day and may be negative (Venus and Uranus turn the other way). The pole's slow drift and the periodic terms of the IAU tables are not applied: pass the pole for the date if you want them. The moment is UTC, like every moment here; it is turned into Terrestrial Time inside (leap seconds from 1972, delta T before), which turns Mars by 0.28 degree. A leap second announced after 2017 is not known until the table in `src/time-scale.ts` gets its row. Latitude is the angle from the planet's equator on a sphere.
|
|
155
|
+
- A spin equal to the Earth's gives the Earth's sky (pole at declination 90 and right ascension 270, `w0` 280.46061837, `rate` 360.98564736629), apart from the precession since J2000.
|
|
156
|
+
- A hundred thousand `horizontal` conversions take about 26 ms on a laptop. The formulas are from J. Meeus, *Astronomical Algorithms* (2nd ed.), chapters 12, 13, 16 and 21.
|
|
157
|
+
|
|
158
|
+
## Deep-sky objects
|
|
159
|
+
|
|
160
|
+
Two imports, so a page pays only for what it uses. `@johnmorrisdotca/hoshi-stars/deep-sky` is the 110 Messier objects (about 3 kB gzipped); `@johnmorrisdotca/hoshi-stars/deep-sky/ngc-ic` adds the NGC and IC objects, 11,898 in all (about 150 kB gzipped). Both have the same three functions. The data is Wikidata's (CC0), read on 2026-11-08 and checked against NASA/IPAC NED; the numbers are in [NOTICE.md](NOTICE.md).
|
|
161
|
+
|
|
162
|
+
```ts
|
|
163
|
+
import { deepSky, deepSkyObject, messier } from "@johnmorrisdotca/hoshi-stars/deep-sky";
|
|
164
|
+
|
|
165
|
+
const m31 = deepSkyObject("M31")!; // or "NGC 224", "Messier 31", "Andromeda Galaxy", in any case
|
|
166
|
+
console.log(m31.id, m31.ngc, m31.name, m31.type, m31.magnitude); // M31 NGC 224 Andromeda Galaxy galaxy 3.4
|
|
167
|
+
console.log(m31.rightAscension.toFixed(3), m31.declination.toFixed(3)); // 10.685 41.269 (degrees, J2000)
|
|
168
|
+
console.log(messier().length, deepSky({ type: "globular cluster" }).length); // 110 29
|
|
169
|
+
console.log(deepSky({ magnitude: 4 }).map((o) => o.id)); // [ 'M7', 'M31', 'M42', 'M44', 'M45' ]
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
| Function | Gives |
|
|
173
|
+
|---|---|
|
|
174
|
+
| `messier()` | the 110, M1 to M110 (in `/deep-sky` only) |
|
|
175
|
+
| `deepSky({ catalogue?, magnitude?, type? })` | the objects that meet the options, in catalogue order: Messier, then NGC, then IC. `catalogue` is `"messier"`, `"ngc"` or `"ic"` (objects with a number in it); `magnitude` the faintest to include |
|
|
176
|
+
| `deepSkyObject(text)` | one object by `M31`, `NGC 224`, `IC 434`, any other NGC or IC number it carries, or an English name; `undefined` if none |
|
|
177
|
+
|
|
178
|
+
An object has `id`, `messier`, `ngc`, `ic` (each a string such as `"NGC 224"`), `otherIds`, `name`, `type` (`galaxy`, `globular cluster`, `open cluster`, `nebula`, `planetary nebula`, `supernova remnant` or `other`), `constellation` (the IAU abbreviation), `rightAscension` and `declination` (degrees, J2000), `magnitude` (visual, or `undefined`) and `sizeArcmin` (the major axis, or `undefined`).
|
|
179
|
+
|
|
180
|
+
- **M102** is the Messier object nobody can agree on: Messier's own description fits M101, and the modern lists take it for the galaxy NGC 5866, which is what this table does. **M40** is a double star (Winnecke 4) and **M73** four stars in a row; both are `other`, because Messier listed them.
|
|
181
|
+
- **Magnitudes and sizes of the Messier objects** are the published visual magnitudes and major axes of NASA HEASARC's Messier table, because Wikidata's V-band magnitudes for 14 of them are more than a magnitude off (the central star's, for the four planetary nebulae). The NGC and IC magnitudes are Wikidata's, except that a planetary nebula has none (Wikidata's is its central star's); about four in ten have none, and almost none has a size.
|
|
182
|
+
- **Positions** are Wikidata's. Every Messier object was compared with NED and a sample of the others too; the objects that were more than an arc-minute apart are listed in [NOTICE.md](NOTICE.md), and where Wikidata was wrong the table has NED's position.
|
|
183
|
+
|
|
184
|
+
## The Milky Way
|
|
185
|
+
|
|
186
|
+
`@johnmorrisdotca/hoshi-stars/milky-way` is a brightness map of the Milky Way in about 11 kB: the band along the galactic equator, the bright core toward Sagittarius, and the Great Rift, the Coalsack and the Cygnus Rift as dimmer places. It is made by `scripts/make-milky-way-data.py` from SAO star counts, NASA's IRAS 100 micron dust map and a bulge of our own figures (see [NOTICE.md](NOTICE.md)); no picture of the sky is traced.
|
|
187
|
+
|
|
188
|
+
```ts
|
|
189
|
+
import { milkyWayBands, milkyWayBrightness } from "@johnmorrisdotca/hoshi-stars/milky-way";
|
|
190
|
+
|
|
191
|
+
console.log(milkyWayBrightness({ rightAscension: 266.4, declination: -28.9 }) > 0.7); // true: the core, in Sagittarius
|
|
192
|
+
console.log(milkyWayBands([0.2, 0.5]).map((band) => band.strips.length)); // ribbons of sky points to fill as soft bands
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
`milkyWayBrightness(point)` is 0 (dark sky) to 1 (the core); `milkyWayBands(levels, { step })` gives ribbons of sky points for `project`; `toGalactic` and `fromGalactic` change the frame. The demo draws it as soft bands under the stars, in every projection, and its **Milky Way** button turns it off.
|
|
196
|
+
|
|
197
|
+
## Put a chart in a page
|
|
198
|
+
|
|
199
|
+
The package gives numbers; a chart is a few lines of SVG. In React, for example (Vue, Svelte, Angular, Vite, webpack, a plain `<script type="module">` from a CDN, Node and TypeScript are in the [guides](https://johnmorrisdotca.github.io/hoshi-stars/docs/)):
|
|
200
|
+
|
|
201
|
+
```tsx
|
|
202
|
+
import { starColour, stars, type Star } from "@johnmorrisdotca/hoshi-stars";
|
|
203
|
+
import { figureOf } from "@johnmorrisdotca/hoshi-stars/lines";
|
|
204
|
+
import { project } from "@johnmorrisdotca/hoshi-stars/projection";
|
|
205
|
+
|
|
206
|
+
const view = { centre: { rightAscension: 84, declination: 0 }, scale: 150 };
|
|
207
|
+
|
|
208
|
+
function place(star: Star): { x: number; y: number } | undefined {
|
|
209
|
+
const at = project("stereographic", star, view);
|
|
210
|
+
return at && { x: 200 + at.x, y: 200 - at.y };
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function orionSvg(): string {
|
|
214
|
+
let svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 400" role="img" aria-label="Orion"><rect width="400" height="400" fill="#0b1020"/>`;
|
|
215
|
+
for (const [a, b] of figureOf("Ori").segments) {
|
|
216
|
+
const from = place(a);
|
|
217
|
+
const to = place(b);
|
|
218
|
+
if (from && to) svg += `<line x1="${from.x}" y1="${from.y}" x2="${to.x}" y2="${to.y}" stroke="#6f93e0"/>`;
|
|
219
|
+
}
|
|
220
|
+
for (const star of stars({ magnitude: 4 })) {
|
|
221
|
+
const at = place(star);
|
|
222
|
+
if (at) svg += `<circle cx="${at.x}" cy="${at.y}" r="${Math.max(1, 4.2 - star.magnitude * 0.7)}" fill="${starColour(star)}"/>`;
|
|
223
|
+
}
|
|
224
|
+
return svg + "</svg>";
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export function Orion() {
|
|
228
|
+
return <div dangerouslySetInnerHTML={{ __html: orionSvg() }} />;
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
For a page that cannot run script, use the embed page in an iframe; the demo's "Put it in your page" panel writes the address for the chart you are looking at:
|
|
233
|
+
|
|
234
|
+
```html
|
|
235
|
+
<!doctype html>
|
|
236
|
+
<html lang="en">
|
|
237
|
+
<head>
|
|
238
|
+
<meta charset="utf-8" />
|
|
239
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
240
|
+
<title>Hoshi Stars in an iframe</title>
|
|
241
|
+
</head>
|
|
242
|
+
<body>
|
|
243
|
+
<iframe
|
|
244
|
+
src="https://johnmorrisdotca.github.io/hoshi-stars/embed.html?proj=stereographic&ra=84&dec=0&zoom=1.5&mag=5&layers=lines,names&c=Ori"
|
|
245
|
+
title="A chart of the sky around Orion"
|
|
246
|
+
width="480"
|
|
247
|
+
height="360"
|
|
248
|
+
loading="lazy"
|
|
249
|
+
style="border: 0"
|
|
250
|
+
></iframe>
|
|
251
|
+
</body>
|
|
252
|
+
</html>
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Docs: https://johnmorrisdotca.github.io/hoshi-stars/docs/ , with a Japanese page for every guide. The embed page is https://johnmorrisdotca.github.io/hoshi-stars/embed.html .
|
|
256
|
+
|
|
257
|
+
## Where the data comes from
|
|
258
|
+
|
|
259
|
+
The Yale Bright Star Catalogue (Hoffleit and Warren 1991), credited in [NOTICE.md](NOTICE.md). The larger catalogues (Hipparcos, Tycho, Gaia) are ESA's, licensed for non-commercial use only, so an MIT package cannot pass them on. Stars fainter than magnitude 6.0 are not in this package. The deep-sky objects are Wikidata's (CC0), with NASA HEASARC's Messier table and NED as checks. The Milky Way's brightness comes from SAO star counts (NASA HEASARC; no licence stated, used with credit and removed on request) and NASA's IRAS and COBE dust maps.
|
|
260
|
+
|
|
261
|
+
## Coming
|
|
262
|
+
|
|
263
|
+
A star-chart function as its own import. This package is the sky behind [wakusei-planets](https://github.com/johnmorrisdotca/wakusei-planets); it does not depend on it.
|
|
264
|
+
|
|
265
|
+
## The family
|
|
266
|
+
|
|
267
|
+
<!-- family:start (made by scripts/family-readme.mjs from scripts/family-template.mjs; change those, not this) -->
|
|
268
|
+
Hoshi Stars is one of thirty-seven packages, each made for the same site, each at
|
|
269
|
+
[github.com/johnmorrisdotca](https://github.com/johnmorrisdotca) or [github.com/spxis](https://github.com/spxis). The code of every one is MIT.
|
|
270
|
+
|
|
271
|
+
**Games — board**
|
|
272
|
+
|
|
273
|
+
- [Domino](https://github.com/johnmorrisdotca/domino) (ドミノ): dominoes and Mexican Train. [Demo](https://johnmorrisdotca.github.io/domino/).
|
|
274
|
+
- [Gunjin](https://github.com/johnmorrisdotca/gunjin) (軍人): five hidden-rank strategy games with pass-the-device play. [Demo](https://johnmorrisdotca.github.io/gunjin/).
|
|
275
|
+
- [Narabe](https://github.com/johnmorrisdotca/narabe) (並べ): one rules engine for abstract board games, from gomoku and Reversi to Go and checkers. [Demo](https://johnmorrisdotca.github.io/narabe/).
|
|
276
|
+
- [Sugoroku](https://github.com/johnmorrisdotca/sugoroku) (双六): backgammon and its variants, with the doubling cube and match play. [Demo](https://johnmorrisdotca.github.io/sugoroku/).
|
|
277
|
+
- [Tenka](https://github.com/johnmorrisdotca/tenka) (天下): world conquest for two to six, on a map of the real world. [Demo](https://johnmorrisdotca.github.io/tenka/).
|
|
278
|
+
|
|
279
|
+
**Games — cards & tiles**
|
|
280
|
+
|
|
281
|
+
- [Hitotsu](https://github.com/johnmorrisdotca/hitotsu) (一つ): a colour-card shedding game for two to eight, with the house rules people play. [Demo](https://johnmorrisdotca.github.io/hitotsu/).
|
|
282
|
+
- [Jarajara](https://github.com/johnmorrisdotca/jarajara) (ジャラジャラ): mahjong tiles drawn as SVG, stacked layouts, and the matching solitaire Awase. [Demo](https://johnmorrisdotca.github.io/jarajara/).
|
|
283
|
+
- [Kumimoji](https://github.com/johnmorrisdotca/kumimoji) (組み文字): a crossword tile race, in English and Japanese kana. [Demo](https://johnmorrisdotca.github.io/kumimoji/).
|
|
284
|
+
- [Toranpu](https://github.com/johnmorrisdotca/toranpu) (トランプ): a deck of playing cards, card games with computer players, and solitaires. [Demo](https://johnmorrisdotca.github.io/toranpu/).
|
|
285
|
+
|
|
286
|
+
**Games — puzzles**
|
|
287
|
+
|
|
288
|
+
- [Houseki](https://github.com/johnmorrisdotca/houseki) (宝石): gem and stone matching puzzles: falling triplets, stone collapse, colour chains and gem swap. [Demo](https://johnmorrisdotca.github.io/houseki/).
|
|
289
|
+
- [Jirai](https://github.com/johnmorrisdotca/jirai) (地雷): minesweeper on shaped grids with verified no-guess boards. [Demo](https://johnmorrisdotca.github.io/jirai/).
|
|
290
|
+
- [Karakuri](https://github.com/johnmorrisdotca/karakuri) (からくり): eight hyper-casual puzzle games, some of them physics: draw a shield, pull pins, cut ropes, slide blocks, pour tubes. [Demo](https://johnmorrisdotca.github.io/karakuri/).
|
|
291
|
+
- [Kazu](https://github.com/johnmorrisdotca/kazu) (数): grid number puzzles: Sudoku and its variants, Futoshiki and Skyscrapers. [Demo](https://johnmorrisdotca.github.io/kazu/).
|
|
292
|
+
- [Kyuubu](https://github.com/johnmorrisdotca/kyuubu) (キューブ): a turning cube for the browser, 2×2 to 7×7, with record solves to replay. [Demo](https://johnmorrisdotca.github.io/kyuubu/).
|
|
293
|
+
- [Meikyuu](https://github.com/johnmorrisdotca/meikyuu) (迷宮): mazes on squares, hexagons, triangles and circles, made from a seed and drawn through with a finger or the mouse. [Demo](https://johnmorrisdotca.github.io/meikyuu/).
|
|
294
|
+
- [Suido](https://github.com/johnmorrisdotca/suido) (水道): a pipe puzzle: turn the pieces until the water reaches every drain. [Demo](https://johnmorrisdotca.github.io/suido/).
|
|
295
|
+
- [Tobiishi](https://github.com/johnmorrisdotca/tobiishi) (飛び石): peg solitaire with nine boards and seeded solvable challenges. [Demo](https://johnmorrisdotca.github.io/tobiishi/).
|
|
296
|
+
- [Tsunagi](https://github.com/johnmorrisdotca/tsunagi) (繋ぎ): a line-joining logic puzzle whose every level has exactly one answer. [Demo](https://johnmorrisdotca.github.io/tsunagi/).
|
|
297
|
+
|
|
298
|
+
**Games — dice & random**
|
|
299
|
+
|
|
300
|
+
- [Korokoro](https://github.com/johnmorrisdotca/korokoro) (コロコロ): dice, with notation, exact odds, real sounds and the dice of many games. [Demo](https://johnmorrisdotca.github.io/korokoro/).
|
|
301
|
+
- [Tane](https://github.com/johnmorrisdotca/tane) (種): seeded random numbers and daily seeds, the same in every browser and on every server. [Demo](https://johnmorrisdotca.github.io/tane/).
|
|
302
|
+
|
|
303
|
+
**Language**
|
|
304
|
+
|
|
305
|
+
- [Bushu](https://github.com/johnmorrisdotca/bushu) (部首): find a kanji by the parts it is made of. [Demo](https://johnmorrisdotca.github.io/bushu/).
|
|
306
|
+
- [Hikidashi](https://github.com/johnmorrisdotca/hikidashi) (引き出し): a drawer of small Japanese text tools: era dates, kanji numerals, readings and sentence difficulty. [Demo](https://johnmorrisdotca.github.io/hikidashi/).
|
|
307
|
+
- [Kotoba](https://github.com/johnmorrisdotca/kotoba) (言葉): word lists and word-game rules in English, French, German and Japanese. [Demo](https://johnmorrisdotca.github.io/kotoba/).
|
|
308
|
+
|
|
309
|
+
**Geography & data**
|
|
310
|
+
|
|
311
|
+
- [address-plus](https://github.com/johnmorrisdotca/address-plus) (アドレスプラス): parse and format addresses in the United States, Canada, Japan, Australia, France, Germany and the United Kingdom. [Demo](https://johnmorrisdotca.github.io/address-plus/).
|
|
312
|
+
- [Chikyu Earth](https://github.com/johnmorrisdotca/chikyu-earth) (地球): a line-drawn globe that turns at the Earth's own rate, with an optional realistic Earth from space and markers for any place. [Demo](https://johnmorrisdotca.github.io/chikyu-earth/).
|
|
313
|
+
- [Chizu](https://github.com/johnmorrisdotca/chizu) (地図): maps of the world and of countries' regions, in English and Japanese, with a quiz and callouts. [Demo](https://johnmorrisdotca.github.io/chizu/).
|
|
314
|
+
- [Hako Devices](https://github.com/johnmorrisdotca/hako-devices) (箱): line drawings and 3D views of computers, phones, consoles and NAS boxes, from published sizes. [Demo](https://johnmorrisdotca.github.io/hako-devices/).
|
|
315
|
+
- [Hata](https://github.com/johnmorrisdotca/hata) (旗): country and regional flags as SVG, at their true proportions and keyed by ISO code. [Demo](https://johnmorrisdotca.github.io/hata/).
|
|
316
|
+
- [Hoshi Stars](https://github.com/johnmorrisdotca/hoshi-stars) (星): the stars you can see without a telescope, with names, colours and distances, the constellations with their lines and boundaries, and the Messier objects, drawn on any of seven sky maps. [Demo](https://johnmorrisdotca.github.io/hoshi-stars/).
|
|
317
|
+
- [Kuni](https://github.com/johnmorrisdotca/kuni) (国): countries and their regions, with ISO codes and names in English and Japanese. [Demo](https://johnmorrisdotca.github.io/kuni/).
|
|
318
|
+
- [Uchusen Rockets](https://github.com/johnmorrisdotca/uchusen-rockets) (宇宙船): rockets drawn from sourced sizes, as line drawings and 3D views you can take apart and turn, with a check that a rocket really goes together. [Demo](https://johnmorrisdotca.github.io/uchusen-rockets/).
|
|
319
|
+
- [Wakusei Planets](https://github.com/johnmorrisdotca/wakusei-planets) (惑星): the Sun, the planets and their moons, as line drawings, shaded drawings and painted surface maps, with their real sizes, tilt and rotation. [Demo](https://johnmorrisdotca.github.io/wakusei-planets/).
|
|
320
|
+
|
|
321
|
+
**Sports**
|
|
322
|
+
|
|
323
|
+
- [Dougu Sports](https://github.com/johnmorrisdotca/dougu-sports) (道具): sports emblems as SVG: trophies, medals, crests, and the ball and gear of every sport, with optional 3D turning. [Demo](https://johnmorrisdotca.github.io/dougu-sports/).
|
|
324
|
+
- [Kyogijo Stadiums](https://github.com/johnmorrisdotca/kyogijo-stadiums) (競技場): sports fields, rinks, courts and ballparks drawn to scale as SVG, with each team and the score on them. [Demo](https://johnmorrisdotca.github.io/kyogijo-stadiums/).
|
|
325
|
+
- [Senshu Jerseys](https://github.com/johnmorrisdotca/senshu-jerseys) (選手): sports jerseys, sweaters, kits, caps, helmets and retired-number banners as SVG, front and back, with optional 2.5D turning. [Demo](https://johnmorrisdotca.github.io/senshu-jerseys/).
|
|
326
|
+
- [Taisen Brackets](https://github.com/johnmorrisdotca/taisen-brackets) (対戦): a sport-agnostic tournament bracket, drawn as SVG, from a list of ties. [Demo](https://johnmorrisdotca.github.io/taisen-brackets/).
|
|
327
|
+
|
|
328
|
+
**Developer tools**
|
|
329
|
+
|
|
330
|
+
- [REST in Pieces](https://github.com/spxis/rest-in-pieces) (レスト・イン・ピーシーズ): seeded test data and REST APIs for frontend development, with latency and error drills. [Demo](https://spxis.github.io/rest-in-pieces/).
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
**This package is Hoshi Stars.** The demos of all thirty-seven share one header and footer, so each links the rest.
|
|
334
|
+
<!-- family:end -->
|
|
335
|
+
|
|
336
|
+
## Licence
|
|
337
|
+
|
|
338
|
+
MIT: see [LICENSE](LICENSE). Data credits are in [NOTICE.md](NOTICE.md).
|