Skip to content

Firefly-2121: Fix Various Table Recognizer and Related UCD Issues - #2066

Open
aventura121 wants to merge 1 commit into
devfrom
FIREFLY-2121-ucd-fixes
Open

aventura121 wants to merge 1 commit into
devfrom
FIREFLY-2121-ucd-fixes

Conversation

@aventura121

@aventura121 aventura121 commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Firefly-2121 "Analyze and add test for VoCoreUtils.js and VoTableRecognizer.js"

This pull request addresses issues stemming from the recognizer hardcoding ra/dec, and the app not handling coordinates properly in several edge cases.

Description

# What's tested before after
1 RA/Dec table that also has other position-like columns correct same
2 Galactic columns, tagged no markers right place
3 Galactic names (glon/glat), no tags wrong place right place
4 Drift speeds next to a galactic position wrong place right place
5 Galactic table over 50,000 rows wrong place right place
6 SIMBAD search from a galactic row galactic numbers sent as RA/Dec converted to RA/Dec first
7 Save a galactic table as a region file galactic numbers labeled J2000 not offered
8 Galactic table as a TAP upload galactic columns pre-filled as RA/Dec not pre-filled

Where the branch does less than dev (7, 8), dev's result was wrong, so the branch leaves it out.

Dev mixes up the grids in four ways:

  1. It only looks for RA/Dec tags (UCDs), so galactic columns go unnoticed unless their names look like a position (step 2).
  2. Untagged columns with position-like names, such as glon/glat, are read as RA/Dec (step 3).
  3. Drift-speed columns are taken as the position, because their tag contains pos.eq.ra (step 4).
  4. Even when it knows a table is galactic, several features use the numbers as RA/Dec anyway (steps 5–8).

The branch follows the tags:

  • It takes the position columns and their grid from the tags. Without tags, it reads the grid from the column names: glon/glat mean galactic; elon/elat mean ecliptic; ra/dec and any other lon/lat, such as obj_lon, mean RA/Dec, as on dev.
  • Features that use a row's position, such as the coverage map and the SIMBAD search, convert it to RA/Dec first.
  • Features that pass the columns on as they are, the region file and the TAP upload, only use RA/Dec columns.
  • The one name it doesn't read as RA/Dec is sglon/sglat, supergalactic, a different grid (VoTableRecognizer.js:723). Without tags those columns aren't used; dev read them as RA/Dec.

How to test

Run each step on both builds and compare:

Load the table (every step):

  1. Open the build's URL. Use a fresh page for every step, so earlier tables don't carry over.
  2. Click the Tables (TAP) tab.
  3. In the box next to Select TAP Service, pick the step's service: HEASARC or IRSA.
  4. At the top right, next to View:, click Edit ADQL.
  5. Paste the step's query into the ADQL Query box.
  6. Click Search at the bottom left. The table appears at the bottom of the page.

The Coverage tab at the top left shows HiPS display failed on both builds: a CDS outage, not this branch.

Show it on the sky (steps 1–5):

  1. Click the Survey Maps (HiPS) tab.
  2. Click 2MASS color J (1.23um), H (1.66um), K (2.16um), then Load at the bottom left. The sky image appears at the top left, with the table's markers on it.
  3. Just above the image, click Equ / Spherical and pick Aitoff.
  4. Move the mouse over the image. Four magnifiers appear at its top left; click the third.
  5. Click ⤡, the last icon in the row just above HiPS / MOC.

The whole sky now fills the window as an oval. The bright band is the Milky Way; each red box is a group of nearby rows, labeled with how many. < Close at the top left goes back.

Which build is right? Steps 2–8 also give an RA/Dec version of the query: the same rows, with their position as ra/dec. Both builds read RA/Dec correctly, so it shows where the sources really are. Run it on the after build, the same way.

RA/Dec tables are safe

RA/Dec tables behave as on dev: the new code only runs for a table with no RA/Dec tags. The exceptions, all deliberate:

  • Columns tagged as something other than the position are no longer taken as it: offsets, errors, drift speeds, Sun-centered positions and orbits (VoTableRecognizer.js:625). A column found by its name is also skipped when its tag's first word names a different quantity (isPositionPair at VoTableRecognizer.js:698). Dev placed those rows by numbers that aren't positions. Step 4 shows one.
  • Empty position cells give no position, instead of RA 0, Dec 0 (TableAnalysis.js:446). Centering an image on the row (ActiveRowToImageWatcher.js:180) already gave none on dev for a null cell; now an empty-text cell gives none too.
  • A negative RA now lands in the right place on the coverage map of a table under 50,000 rows, which the browser builds from positions the server sends (SearchServerCommands.java:151, :177). An RA from 0 to 360 passes through unchanged.
  • A latitude beyond ±90, such as a -999 placeholder, is skipped when the browser builds the coverage map (HpxIndexCntlr.js:673). On dev, one such row makes the map build throw, and every later row is lost.
  • Untagged ra/dec next to one tagged galactic or ecliptic pair: the tagged pair is now the position (VoTableRecognizer.js:354-355); dev took ra/dec by name. The markers land in the same place when the table's two positions agree, because the tagged position is converted to RA/Dec. The region file and the TAP upload still use ra/dec (TableAnalysis.js:50).
flowchart TD
    A["getCenterColumns()<br/>VoTableRecognizer.js:503"] --> B{"CENTER_COLUMN set?<br/>:505"}
    B -- yes --> B1["use it"]
    B -- no --> C{"How many RA/Dec-tagged pairs? *<br/>:343-349"}
    C -- "exactly 1" --> C1["use it<br/>:344"]
    C -- "2 or more" --> C2["UType, then ObsCore name tie-break †<br/>:393, :412"]
    C -- "0" --> D{"NEW: exactly 1 galactic<br/>or ecliptic pair?<br/>:354-355"}
    D -- yes --> D1["use it"]
    D -- no --> E["UType, ObsCore names,<br/>then the name guess<br/>:393, :412, :431"]
    classDef new fill:#d4f4dd,stroke:#2e7d32,color:#000
    classDef changed fill:#fff3cd,stroke:#b8860b,color:#000
    class D,D1 new
    class C,E changed
Loading

Green is new, yellow is changed, and plain boxes give the same result as dev for an RA/Dec table.

* "RA/Dec-tagged" now leaves out columns tagged as an offset, an error or a drift speed (VoTableRecognizer.js:167-168, isCoordColumn at :670, the list of such tags at :625). A pair with meta.main on only one column is now paired from its tags (:195-202); where dev found such a pair by its column names, the branch returns the same pair.

† The tie-break now reads the grid from the tags (:400, :423); for RA/Dec tags that is J2000, as before.

1. RA/Dec tables don't change

A table with RA/Dec columns looks the same on both builds, even when it also has RA/Dec of 1900 and 1950, galactic and drift-speed columns.

Service: HEASARC

Query:

SELECT * FROM bsc5p WHERE vmag < 1.5

Do: load the table, then show it on the sky.

  • Both builds: the same 22 stars in the same places.
Step 1: before | after

Code: VoTableRecognizer.js:343-344: one RA/Dec-tagged pair, used before any new code runs.

Validation

2. Galactic columns, tagged

A table whose position columns are tagged galactic now gets markers on the sky, where its RA/Dec version puts them; dev draws none.

Service: HEASARC

Query:

SELECT name, lii, bii FROM ascagps

RA/Dec version:

SELECT name, ra, dec FROM ascagps

Do: load the table, then show it on the sky.

  • Before: no markers.
  • After: markers along the Milky Way, as in the RA/Dec version. One source, AX J170047-4139, lands in a different box: the archive's own galactic and RA/Dec numbers for it are 31° apart.
Step 2: before | after

Code: VoTableRecognizer.js:354-355, :370. 74 of the 163 longitudes are negative; the server now sends them as 0 to 360 (SearchServerCommands.java:151, :177), tested by SearchServerCommandsTest.

3. Galactic names, no tags

Untagged columns named glon/glat are now read as galactic; dev reads them as RA/Dec and draws them on empty sky.

Service: HEASARC

Query (renamed columns lose their tags):

SELECT name, lii AS glon, bii AS glat FROM ascagps

RA/Dec version:

SELECT name, ra, dec FROM ascagps

Do: load the table, then show it on the sky.

  • Before: the markers sit on empty sky, far from the Milky Way.
  • After: the same picture as step 2's after build: along the Milky Way.
Step 3: before | after

Code: VoTableRecognizer.js:467, :718-723.

4. Drift speeds aren't positions

Columns tagged as a drift speed (pos.pm;pos.eq.ra) are no longer taken as the position of a table without RA/Dec columns; dev piles 19 of the 22 stars into one spot.

Service: HEASARC

Query:

SELECT name, pmra, pmdec, glon, glat, vmag FROM bsc5p WHERE vmag < 1.5

RA/Dec version:

SELECT name, ra, dec, vmag FROM bsc5p WHERE vmag < 1.5

Do: load the table, then show it on the sky.

  • Before: 19 of the 22 stars bunch up in one patch of empty sky; the 3 fastest drifters land further out.
  • After: each star in its place, the same picture as step 1 and the RA/Dec version.
Step 4: before | after

Code: VoTableRecognizer.js:167-168, isCoordColumn at :670.

5. Galactic table over 50,000 rows

A galactic table over 50,000 rows now gets its markers in the right place; dev's server places them by the galactic numbers read as RA/Dec, far from the Milky Way.

Service: IRSA

Query (68,222 rows):

SELECT glon, glat FROM fp_psc WHERE CONTAINS(POINT('ICRS', ra, dec), CIRCLE('ICRS', 266.7, -28.5, 0.35))=1

RA/Dec version:

SELECT ra, dec FROM fp_psc WHERE CONTAINS(POINT('ICRS', ra, dec), CIRCLE('ICRS', 266.7, -28.5, 0.35))=1

Do: load the table, but before you click Search, change Row Limit (next to it) from 50000 to 200000. Then show it on the sky.

  • Before: all 68,222 rows on empty sky, far from the Milky Way.
  • After: all 68,222 rows on the bright center of the Milky Way, as in the RA/Dec version.
Step 5: before | after

Code: HpxIndexCntlr.js:261.

6. Search SIMBAD from the row

From a galactic row, SIMBAD now searches at the star; dev searches 43° away.

Service: HEASARC

Query (one row, the star Mizar):

SELECT name, alt_name, glon, glat, vmag FROM bsc5p WHERE name = 'HR 5054'

RA/Dec version:

SELECT name, alt_name, ra, dec, vmag FROM bsc5p WHERE name = 'HR 5054'

Do:

  1. Load the table.
  2. In the toolbar at the table's top right, click the first icon (the microscope), then Go to and Search Simbad at row with 5" radius.
  3. SIMBAD opens in a new browser tab. Read Coord= in its address. The page itself shows an error during the CDS outage; only the address matters.
  • Before: Coord=113.11+61.58, Mizar's galactic numbers read as RA/Dec.
  • After: Coord=200.98141370159107+54.92448073783569.
  • RA/Dec version: Coord=200.9812+54.9253, 3″ from the after build's (the table rounds glon/glat to 0.01°).

Code: TableAnalysis.js:449; DefaultSearchActions.js:297, :322.

7. Save as a region file

A galactic table is no longer offered as a region file; dev offers it and writes the galactic numbers under a J2000 label.

Service: HEASARC

Query (the same as step 6):

SELECT name, alt_name, glon, glat, vmag FROM bsc5p WHERE name = 'HR 5054'

RA/Dec version:

SELECT name, alt_name, ra, dec, vmag FROM bsc5p WHERE name = 'HR 5054'

Do:

  1. Load the table.
  2. In the toolbar at the table's top right, click the floppy-disk icon. The Save table dialog opens.
  3. Open the File format list and look for Region (.reg). If it's there, pick it, click Save, and open the saved file.
  • Before: Region (.reg) is offered; the file reads J2000; color=blue, then point 113.11 61.58 # 10 point=circle.
  • After: Region (.reg) isn't offered.
  • RA/Dec version: Region (.reg) is offered; the file reads J2000; color=blue, then point 200.9812 54.9253 # 10 point=circle.

Code: TableSave.jsx:120.

8. Use the table as a TAP upload

A galactic table used as a TAP upload no longer gets its position columns pre-filled; dev pre-fills glon, glat, which the search then reads as RA/Dec.

Service: HEASARC

Query (the same as step 6):

SELECT name, alt_name, glon, glat, vmag FROM bsc5p WHERE name = 'HR 5054'

RA/Dec version:

SELECT name, alt_name, ra, dec, vmag FROM bsc5p WHERE name = 'HR 5054'

Do:

  1. Load the table.
  2. In the toolbar at the table's top right, click the first icon (the microscope), then Use table as an upload to TAP search.
  3. At the top right, next to View:, click UI assisted.
  4. Under Spatial, read the Position Columns line that ends (from the uploaded table).
  • Before: Position Columns: glon, glat (from the uploaded table)
  • After: Position Columns: Unspecified Column(s) (from the uploaded table)
  • RA/Dec version: Position Columns: ra, dec (from the uploaded table)

Code: UploadTableSelector.jsx:375, :381; UploadTableChooser.js:200; SpatialSearch.jsx:156; DefaultSearchActions.js:231.

Other changed files

  • TableAnalysis.js: findTableEqCenterColumns (:50) is the RA/Dec-only lookup that steps 7 and 8 use; makeWorldPtUsingCenterColumns returns J2000 (:81). Helpers: toNum (Point.js:248) and convertToJ2000 (VisUtil.js:151).
  • ActiveRowToImageWatcher.js:180: centering an image on the highlighted row uses the same J2000 row position.
  • ttFeatureWatchers.js:223, :229: Prepare Download sends only RA/Dec position columns and converts the cutout center to J2000.
  • ServDescProducts.js:129: service-descriptor cutouts convert the row position to J2000.
  • ObsCoreUtil.java:63: the server returns null ra/dec instead of throwing when a row has no RA/Dec position.
  • WisePlotRequests.js:61: WISE time-series images read only RA/Dec columns; WISE tables use RA/Dec, so nothing changes.
  • VOAnalyzer-test.js also tests the recognizer behind steps 1–4: "by UCD, coordinate system", "columns described as something else are not the position", and the name-guess test.each cases.
  • VoCoreUtils-test.js is new: it tests isUCDWith and findCsysFromUCD, as the ticket asked. VoCoreUtils.js is unchanged.

@aventura121 aventura121 added this to the 2027.1 milestone Nov 13, 2026
@aventura121 aventura121 self-assigned this Nov 13, 2026
@aventura121
aventura121 force-pushed the FIREFLY-2121-ucd-fixes branch from a4d878b to aa89100 Compare November 13, 2026 19:25
@aventura121
aventura121 marked this pull request as ready for review November 13, 2026 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant