Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions astro_data/named_stars.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Every star the IAU has named, from the IAU Catalog of Star Names kept by its Working Group on Star Names (WGSN). Each star is listed by its Hipparcos number: Vega is Nam 91262. 578 stars carry 579 names. The 73 names of objects without a Hipparcos number, mostly faint planet-host stars, are left out. Epsilon Bootis (Nam 72105) has two IAU names, Izar and Pulcherrima, and the IAU does not say which star of the pair each one names, so neither is shown as its name.
27 changes: 25 additions & 2 deletions docs/ax/catalog.md
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,11 @@ before the next build.

Each stage has the last word over the stages before it. Loader order
matters: a loader can only join sky objects that earlier loaders created
(so Sharpless loads before Caldwell, whose C 9 is Sh2 155).
(so Sharpless loads before Caldwell, whose C 9 is Sh2 155). The Named
Stars loader (`Nam`) loads last: its listings join no sky object at
insert, and the star-identity stage joins each to its star by HIP number,
where the lowest id survives, so a star another catalog lists keeps that
catalog's sky object.

When a loader joins a sky object an earlier loader created, it may only
fill what is empty — never replace — with two named exceptions:
Expand Down Expand Up @@ -594,6 +598,22 @@ and would give a listing another star's values, while a miss costs one
line in a corrections file. A listing with no match stays its own sky
object.

- **A HIP-numbered listing is its star.** The Named Stars catalog (`Nam`)
lists each star the IAU Catalog of Star Names gives a HIP number, and its
sequence is that number (Vega is Nam 91262), so the number stays the
star's as the WGSN adopts names (`HIP_NUMBERED_CATALOGS`). Such a listing
is identified by its number alone, with the rule "HIP number": it is not
cross-matched, takes no part in the rules below, and takes no `hip`
correction. It changes no other listing's match, and joins whatever the
rules and corrections identify as its HIP number in the merge. Where they
miss a star another catalog lists, the Named Stars listing is a sky object
of its own beside it, until a `hip` correction identifies the missed
listing; position never joins them. The listing's position and V are
Hipparcos's: V is the star's own where Hipparcos says so (9.4), and
otherwise its system's combined light, which is what a finder shows of
a star listed alone. A star with no other listing keeps that V, and
without one it would drop out of every magnitude filter.

- **The match** is the one Hipparcos star within the listing's radius
whose V lies within 1 mag of the listing's first magnitude, the
primary's; for a variable listed by its range (TLK's [max, min]),
Expand Down Expand Up @@ -811,7 +831,10 @@ star-identity stage identified by that number, and nothing else:
- A name with no HIP number, one whose star PiFinder doesn't hold or
didn't identify, and the two names of HIP 72105 (Izar and Pulcherrima,
with no component to choose between them) are skipped; the import logs
how many, and the names other sky objects carry too.
how many, and the names other sky objects carry too. Since the Named
Stars catalog lists every HIP number the WGSN names (9.3), every name
with a HIP number has its star: Nam 72105 is ε Boo, the pair, with
neither IAU name, as before.

Steinicke's Bmag is never used as a fallback V on its own: for
non-galaxies it is often NGC 2000.0's photographic figure, and for M 43
Expand Down
2 changes: 1 addition & 1 deletion docs/ax/catalog/CONTEXT.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The readable, human-facing label for a catalog as a whole — `"Collinder"`, `"C
_Avoid_: catalog name (prefer the full term), catalog title, long name.

**Sequence**:
Integer position of an object inside one catalog (e.g. `13` for M 13). Must be unique within a catalog (enforced by `CatalogBase.check_sequences()`).
Integer position of an object inside one catalog (e.g. `13` for M 13). Must be unique within a catalog (enforced by `CatalogBase.check_sequences()`). In the Named Stars catalog (`Nam`) it is the star's Hipparcos (HIP) number, so it stays the star's as names are added: Vega is Nam 91262.
_Avoid_: number, index, ordinal.

**Object ID** (`object_id`):
Expand Down
16 changes: 15 additions & 1 deletion docs/source/catalogs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,19 @@ M
----------
Messier catalog

Nam
----
Named Stars: every star with a name from the IAU Catalog of Star Names, 578 in
all, from Vega and Miaplacidus down to faint stars named for the planets they
host. Each star is listed by its Hipparcos number, so Vega is Nam 91262. Type a
name in **Name Search** to find the star, or sort by **Nearest**. The 73 IAU names
of objects without a Hipparcos number are not included. See
`IAU Catalog of Star Names <https://exopla.net/star-names/modern-iau-star-names/>`_.

The IAU name is the name the PiFinder shows for each of these stars, in every
catalog that lists it. A name with accents, such as Mönch, can also be found
by typing it without them.

NGC
----------
NGC 2000.0, The Complete New General Catalogue and Index Catalogue of Nebulae and Star Clusters by J.L.E. Dreyer (edited by R.W. Sinnott).
Expand Down Expand Up @@ -110,7 +123,8 @@ Sh2

Str
----
Named bright stars. Especially useful for aligning GoTo telescopes.
Named bright stars. Especially useful for aligning GoTo telescopes. For every
star the IAU has named, see Nam.

Ta2
----------
Expand Down
5 changes: 3 additions & 2 deletions docs/source/menu_map.rst
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,9 @@ By Catalog
extragalactic globulars, Harris globulars, Herschel 400, IC, Lyngå open
clusters, Messier, NGC, Sharpless emission nebulae, and the TAAS 200 list.
Stars...
Star catalogs: bright named stars, the SAC double, asterism and red-star
lists, RASC and WDS doubles, and TLK's hand-picked variable stars.
Star catalogs: bright named stars, every IAU-named star, the SAC double,
asterism and red-star lists, RASC and WDS doubles, and TLK's hand-picked
variable stars.
Recent
The objects you've viewed this session, most recent first. It starts empty
each session.
Expand Down
3 changes: 3 additions & 0 deletions python/PiFinder/catalog_imports/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
("wds_loader", "load_wds"),
("harris_loader", "load_harris"),
("lynga_loader", "load_lynga"),
# Last, so each star another catalog lists keeps its sky object when the
# star-identity stage joins the Named Stars listing to it by HIP number.
("named_stars_loader", "load_named_stars"),
]

POST_PROCESSING_FUNCTIONS = [
Expand Down
90 changes: 90 additions & 0 deletions python/PiFinder/catalog_imports/named_stars_loader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
"""
Named Stars catalog loader for PiFinder.

One listing for each star the IAU Catalog of Star Names (the WGSN's) gives a
Hipparcos number for, numbered by that number: Vega is Nam 91262. The number
stays the star's as the WGSN adopts new names, and it identifies the star:
the star-identity stage joins the listing to the star other catalogs list by
that number, never by position (docs/ax/catalog.md §9.3).

The listing carries no names of its own. The WGSN supplementary source
(add_wgsn_names) gives each identified star its IAU name, so a star never
gets its name twice.
"""

import logging
import math
from pathlib import Path
from typing import List, Optional

import PiFinder.utils as utils
from PiFinder.composite_object import MagnitudeObject, SizeObject
from .catalog_import_utils import (
NewCatalogObject,
delete_catalog_from_database,
insert_catalog,
insert_catalog_max_sequence,
)
from .database import objects_db
from .star_identity import HIP_NUMBERED_CATALOGS, Hipparcos, load_hipparcos
from .supplementary_sources import WGSN_PATH, read_wgsn

CATALOG_CODE = "Nam"
assert CATALOG_CODE in HIP_NUMBERED_CATALOGS
DESCRIPTION_PATH = Path(utils.astro_data_dir, "named_stars.desc")


def named_star_listings(
hipparcos: Hipparcos, path: Path = WGSN_PATH
) -> List[NewCatalogObject]:
"""One listing per HIP number the WGSN names, in HIP order.

The position is Hipparcos's, carried to J2000 by its proper motion. The V
is Hipparcos's: the star's own where Hipparcos says so (Hipparcos.own_vmag),
otherwise the light of the whole system it measured, which is what a
finder shows of a star its catalog lists alone. A name without a HIP
number has no listing.
"""
hips = sorted({name.hip for name in read_wgsn(path) if name.hip is not None})
listings = []
for hip in hips:
index = hipparcos.index_of(hip)
if index is None:
raise ValueError(f"WGSN names HIP {hip}, which Hipparcos lacks")
vmag = float(hipparcos.vmag[index])
listings.append(
NewCatalogObject(
object_type="*",
catalog_code=CATALOG_CODE,
sequence=hip,
ra=float(hipparcos.ra[index]),
dec=float(hipparcos.dec[index]),
mag=MagnitudeObject([] if math.isnan(vmag) else [vmag]),
size=SizeObject([]),
)
)
return listings


def load_named_stars(
hipparcos: Optional[Hipparcos] = None, path: Path = WGSN_PATH
) -> None:
"""Load the Named Stars catalog: every IAU-named Hipparcos star."""
logging.info("Loading Named Stars")
assert objects_db is not None, "init_shared_database() runs first"
hipparcos = hipparcos if hipparcos is not None else load_hipparcos()
conn, _ = objects_db.get_conn_cursor()
delete_catalog_from_database(CATALOG_CODE)
insert_catalog(CATALOG_CODE, DESCRIPTION_PATH)
listings = named_star_listings(hipparcos, path)
objects_db.bulk_mode = True
try:
for listing in listings:
# The listing names nothing to join: the star-identity stage joins
# it to its star by HIP number.
listing.insert(find_object_id=False)
conn.commit()
finally:
objects_db.bulk_mode = False
insert_catalog_max_sequence(CATALOG_CODE)
logging.info("Named Stars: %d stars", len(listings))
61 changes: 54 additions & 7 deletions python/PiFinder/catalog_imports/star_identity.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Star identity: a star is identified by its Hipparcos number.

The star catalogs (Str, SaM, SaR, TLK, RDS, WDS) list many of the same stars,
The star catalogs (Str, SaM, SaR, TLK, RDS, WDS, Nam) list many of the same stars,
and few of their listings carry a designation the loaders' lookup resolves, so
each loader leaves a star a sky object of its own: Mizar was SaM's and Str's.
This stage cross-matches each star sky object to hip_main.dat and merges the
Expand Down Expand Up @@ -41,7 +41,12 @@
from .corrections import CorrectionError, parse_designator, resolve_listing

# The catalogs whose listings are stars, in loader order.
STAR_CATALOGS = ("SaM", "SaR", "Str", "RDS", "TLK", "WDS")
STAR_CATALOGS = ("SaM", "SaR", "Str", "RDS", "TLK", "WDS", "Nam")

# The catalogs whose sequence is the star's HIP number (Named Stars, Nam 91262
# is Vega). Such a listing is identified by its number alone: it is not
# cross-matched, and no rule or `hip` correction applies to it.
HIP_NUMBERED_CATALOGS = frozenset({"Nam"})

# A match is made only where it is reliably right, at the cost of missing
# some stars; those are matched by `hip` corrections (catalog.md §9.3). The
Expand Down Expand Up @@ -101,7 +106,7 @@
# Prefixes that are catalog numbers, not double-star discoverers.
_NOT_DISCOVERERS = frozenset(
{"HD", "HR", "SAO", "HIP", "BD", "CD", "CPD", "COD", "NGC", "IC", "M", "ADS"}
| {code.upper() for code in ("SaM", "SaR", "Str", "RDS", "TLK", "WDS", "H")}
| {code.upper() for code in ("SaM", "SaR", "Str", "RDS", "TLK", "WDS", "Nam", "H")}
)
_DESIGNATION_RE = re.compile(r"([A-Za-z]{1,8})\s*(\d+)")
_HD_RE = re.compile(r"HD\s*(\d+)")
Expand Down Expand Up @@ -301,6 +306,8 @@ class StarObject:
# its position stands in for its star's (STAND_IN_POSITIONS).
precise: bool = False
stand_in: bool = False
# The HIP number of a listing of a HIP-numbered catalog: its sequence.
hip_number: Optional[int] = None
listings: List[str] = field(default_factory=list)
names: List[str] = field(default_factory=list)
# The DM number its source gives outside its names (WDS's), and for a SAC
Expand Down Expand Up @@ -378,6 +385,8 @@ def read_star_objects(
dm=dm_numbers.get(listing),
system_first=systems.get(listing),
)
if row["catalog_code"] in HIP_NUMBERED_CATALOGS and star.hip_number is None:
star.hip_number = row["sequence"]
star.listings.append(f"{row['catalog_code']} {row['sequence']}")
for row in cursor.execute(
"SELECT object_id, common_name FROM names WHERE object_id IN"
Expand All @@ -398,8 +407,8 @@ class Match:
separation_arcmin: Optional[float] = None
# Why there is no match: "no V", "V gate", "ambiguous", or a veto.
reason: Optional[str] = None
# The rule that made it: "position", "catalog number", "WDS designation"
# or "SAC system".
# The rule that made it: "position", "catalog number", "WDS designation",
# "SAC system", or "HIP number" for a HIP-numbered catalog's listing.
rule: Optional[str] = None
# A SAC continuation row joins its system's first row's sky object,
# with that row's HIP, or none.
Expand Down Expand Up @@ -831,6 +840,12 @@ def read_hip_identifications(
if code not in STAR_CATALOGS or object_id not in stars:
problems.append(f"{label}: {designator} is no star catalog's listing")
continue
if stars[object_id].hip_number is not None:
problems.append(
f"{label}: {designator} is numbered by its HIP; it takes no"
" hip correction"
)
continue
if hipparcos.index_of(hip) is None:
problems.append(f"{label}: Hipparcos has no HIP {hip}")
continue
Expand Down Expand Up @@ -881,6 +896,33 @@ def redundant_corrections(
]


def hip_numbered_matches(
stars: Mapping[int, StarObject], hipparcos: Hipparcos
) -> Dict[int, Match]:
"""The matches of the HIP-numbered catalogs' listings: each its number.

Fails on a number Hipparcos lacks, and on a sky object that holds a
HIP-numbered listing and is not that listing's alone (a loader joined
another listing to it): its number would identify the other too.
"""
matches: Dict[int, Match] = {}
for object_id, star in sorted(stars.items()):
hip = star.hip_number
if hip is None:
continue
if hipparcos.index_of(hip) is None:
raise ValueError(f"{star.listings[0]}: Hipparcos has no HIP {hip}")
if len(star.listings) > 1:
raise ValueError(
f"HIP {hip}'s listing shares its sky object with other"
f" listings: {', '.join(star.listings)}"
)
matches[object_id] = Match(
object_id, hip=hip, separation_arcmin=0.0, rule="HIP number"
)
return matches


def d_star_type(members: Sequence[StarObject]) -> str:
"""The D* rule for a star: D* if any listing's catalog types it D*.

Expand Down Expand Up @@ -926,17 +968,22 @@ def identify_stars(
conn = db.conn
cursor = conn.cursor()
stars = read_star_objects(cursor)
# A HIP-numbered listing is its star: it takes no part in the rules, so
# it changes no other listing's match, and it joins the stars they match
# to its number in the merge below.
listed = {oid: star for oid, star in stars.items() if star.hip_number is None}
corrected, problems = read_hip_identifications(
cursor, stars, hip_identifications, hipparcos
)
matches = match_stars(stars, hipparcos)
matches = match_stars(listed, hipparcos)
problems += redundant_corrections(corrected, matches)
if problems:
raise CorrectionError(problems)
if corrected:
matches = match_stars(
stars, hipparcos, {oid: hip for oid, (_, hip) in corrected.items()}
listed, hipparcos, {oid: hip for oid, (_, hip) in corrected.items()}
)
matches.update(hip_numbered_matches(stars, hipparcos))

hips: Dict[int, int] = {}
merged_into: Dict[int, int] = {}
Expand Down
1 change: 1 addition & 0 deletions python/PiFinder/designations.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"lyn": "Lyn",
"m": "M",
"messier": "M",
"nam": "Nam",
"ngc": "NGC",
"rds": "RDS",
"saa": "SaA",
Expand Down
10 changes: 10 additions & 0 deletions python/PiFinder/ui/menu_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,12 @@ def _(key: str) -> Any:
"objects": "catalog",
"value": "Str",
},
{
"name": _("Named Stars"),
"class": UIObjectList,
"objects": "catalog",
"value": "Nam",
},
{
"name": _("SAC Doubles"),
"class": UIObjectList,
Expand Down Expand Up @@ -389,6 +395,10 @@ def _(key: str) -> Any:
"name": _("Bright Named"),
"value": "Str",
},
{
"name": _("Named Stars"),
"value": "Nam",
},
{
"name": _("SAC Doubles"),
"value": "SaM",
Expand Down
7 changes: 6 additions & 1 deletion python/PiFinder/ui/object_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -915,8 +915,13 @@ def key_right(self):
self.show_object_details(self._current_item_index)

def key_number(self, number):
if not self.jump_input_display:
# As many digits as the list's largest number: a Named Stars HIP
# number or a WDS sequence has six.
largest = max((obj.sequence for obj in self._menu_items_sorted), default=0)
self.jump_to_number.width = max(4, len(str(largest)))
self.jump_to_number.append_number(number)
if str(self.jump_to_number) == "----":
if not self.jump_to_number.has_number():
self.jump_input_display = False
return

Expand Down
Loading
Loading