Skip to content

fix(obslist): read observing-list designations with the catalog import's parser - #693

Merged
brickbots merged 2 commits into
mainfrom
fix/obslist-one-designation-parser
Nov 10, 2026
Merged

brickbots merged 2 commits into
mainfrom
fix/obslist-one-designation-parser

Conversation

@brickbots

Copy link
Copy Markdown
Owner

When you load an observing list, PiFinder finds each object in its catalog.
Before this change, some names found the wrong object or no object.
"H 24" found a Herschel 400 galaxy, but in a double-star list it is a double star.
"Cr 399" found nothing, and "Collinder 399" found a different cluster entry.
Now PiFinder reads each name the same way as when it builds its catalog.
If PiFinder cannot be sure which object a name means, it uses the coordinates in the list, or skips the entry.

This fixes fault 6 of mrosseel's review on #670. Thank you, @mrosseel, for the review and the test cases.

What changes for a user

Name in the list Before After
H 24 Herschel 400 #24 (NGC 5676) nothing (list coordinates, if any)
h 99 the object with the name "h 99" nothing (list coordinates, if any)
B 33 Barnard 33 or van den Bos 33, whichever loaded first nothing (list coordinates, if any)
Barnard 33 nothing Barnard 33
Cr 399 nothing Collinder 399
Collinder 399 Lyngå 847 (a different catalog entry) Collinder 399
Col 399 Collinder 399 Collinder 399
A saved list with Herschel 400 #24 H 24, read back as Herschel 400 #24 Herschel 24, read back as Herschel 400 #24
M 2-9 the Minkowski nebula, if a name matches; never M 29 the same
NGC 0497 NGC 497 NGC 497
Sh2-155 Sh2 155 (by name) Sh2 155

A rule from the catalog work applies here too: a name must find the correct object whenever it finds one. A name that finds nothing is acceptable. A name that finds the wrong object is not.

Three parsers before, one now

Parser Before Now
parse_designation (catalog import) Knows a fixed list of catalog prefixes. Refuses a bare H, A or B, WDS, PK, and compound numbers such as M 2-9. Unchanged. It moves to the new module PiFinder/designations.py with CATALOG_CODE_ALIASES and listing_named. catalog_import_utils re-exports all three, so import code and its tests do not change.
_parse_catalog_name (list formats) with resolve_object (lookup) Took any letters before a number as a catalog code. Then mapped Cr to COL, C to CAL and Collinder to Cr. None of these is a database code (Col, C), so Collinder numbers and Caldwell numbers never matched by catalog. H 24 matched Herschel 400 #24. _parse_catalog_name asks parse_designation. resolve_object reads each SkySafari catalog number with listing_named. A CSV CatalogCode column and a NexTour category go through the same parser. The alias maps CATALOG_ALIASES and SKYSAFARI_CATALOG_NAMES are removed.
_name_key (name lookup, from #673) Matched any name in the names table. The table has double-star names from SAC and WDS such as H 24, h 99 and B 33, and 67 Lyngå entries with names such as Collinder 399. Same key, and still only a fallback after the catalog lookup. It now refuses a designation with a bare A, B or H prefix (designations.is_ambiguous_designation). #673's cases still hold: M 2-9 is not M 29, and NGC 0497 matches NGC 497.

Details

  • ObsListEntry.catalog_code now always holds a PiFinder catalog code or is empty. The readers fill it through the parser, never with a source spelling such as Cr.

  • The native .pifinder format stores PiFinder's own catalog key. Its catalog_code is looked up exactly, with no parsing, so {"catalog_code": "H", "sequence": 24} is still Herschel 400 #1 make POSS/SDSS Fov prettier #24.

  • read_list now calls one function, resolve_entry, for the catalog lookup. Two error-handling tests patch this function instead of resolve_object.

  • The SkySafari writer writes the PiFinder designation (Col 399). The removed map never changed the output, because its keys (CAL, COL) never matched a PiFinder code.

  • Abell 39 now finds Abell planetary nebula 39. This is the import's alias (abell → Abl).

  • Docs: the Resolution entry in docs/ax/catalog/CONTEXT.md and the CSV section of docs/ax/catalog/obslist-formats/README.md now describe the shared parser.

  • PiFinder saves observing lists as SkySafari files. Before, it wrote H 24 and B 33 for Herschel 400 and Barnard objects. The parser refuses those, so a saved list would lose these objects' catalog identity when you load it again. The writer now writes a designation that the parser reads back to the same object: Herschel 24 and Barnard 33 (new designations.designation). Other catalogs are written as before (NGC 224, Col 399). WDS objects have no readable designation, so they still save by name and load from their coordinates.

  • Lists saved before this change. A SkySafari list that PiFinder saved earlier holds H 24 or B 33 for those objects. Such an entry now loads from its coordinates: the position stays, but the entry is not linked to the Herschel 400 or Barnard object. Save the list again to fix it.

Not in this change

Tests

  • New tests/test_obslist_designations.py: each case in the table above, in plain text, SkySafari, CSV and native lists; the ambiguity check; the save round trip for Herschel 400 and Barnard objects; the re-export; and a check that designations.py imports only the standard library.
  • nox: lint, format, type_hints, smoke_tests and unit_tests pass.

Refs #670, #673.

🤖 Generated with Claude Code

brickbots and others added 2 commits November 9, 2026 11:58
…t's parser

Fault 6 of mrosseel's review on #670: the observing-list lookup had its own
parser, so "H 24" (a double star) resolved to Herschel 400 #24, "Cr 399"
resolved to nothing and "Collinder 399" resolved to a Lyngå object.

- Move parse_designation, CATALOG_CODE_ALIASES and listing_named into the
  runtime-safe PiFinder/designations.py; catalog_import_utils re-exports them.
- obslist_formats reads every designation (and CSV/NexTour catalog columns)
  through parse_designation, so ObsListEntry.catalog_code is always a
  PiFinder catalog code. The native format's key stays an exact lookup.
- obslist resolves SkySafari catalog numbers with listing_named; the
  CATALOG_ALIASES and SKYSAFARI_CATALOG_NAMES maps are gone.
- The name lookup (#673's _name_key) keeps its cases ("M 2-9" is not M 29,
  "NGC 0497" is NGC 497) but refuses a bare A/B/H designation
  (is_ambiguous_designation), which sources use for different objects.
- Catalog CONTEXT.md and the obslist-formats README describe the shared parser.

Refs #670, #673.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hat read back

PiFinder saves observing lists as SkySafari files with "<code> <seq>". The
shared parser refuses a bare "H 24" or "B 33" (double stars in SAC and WDS),
so a saved list would lose those objects' catalog identity on reload.
write_skylist now writes designations.designation(): "Herschel 24" and
"Barnard 33"; other catalogs are unchanged. WDS has no readable designation
and still saves by name.

Refs #670.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@brickbots
brickbots merged commit 4da2a0a into main Nov 10, 2026
4 checks passed
brickbots added a commit that referenced this pull request Nov 10, 2026
Brings in #691 (Hipparcos values, IAU WGSN names), #692 (star matching
on independent evidence) and #693 (designations.py). No textual
conflicts: catalog_import_utils.py, test_catalog_corrections.py and
docs/ax/catalog.md merged cleanly.

Refs #670

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant