Repository navigation
Firefly-2121: Fix Various Table Recognizer and Related UCD Issues - #2066
Conversation
a4d878b to
aa89100
Compare
|
I think I heard that HEASARC got hacked? In any case, the very first test fails for me, maybe because HEASARC isn't fully functional? : |
|
test 5 works for me, as it's talking to our TAP server. |
|
OK, now HEASARC is working for me, so everything is working great until I got to number 7. The first time I saved the region file, I got not only the region file save as an option, but it worked properly and saved it with the ra/dec in the file! I tried to reproduce it while recording and not only did I get the region file save as an option, but it saved an empty region file. I initially thought maybe it was because I had just done the "go to simbad" test so maybe it had already calculated ra/dec and so was just using those numbers? but that's not it. Movie attached where you can see me try to work this out. More from me in a bit. video1972256944.mp4 |
|
everything else i tried, worked. |
robyww
left a comment
There was a problem hiding this comment.
This all looks very good. I appreciate all the analysis, clean up, test, and identification of bugs (and fixes). VoTableRecognizer.js in particular looks much more solid.
I would like you to do a little more before you are done.
- VOAnalyzer-test.js is in the wrong place. I think it was left there after a refactor a couple of years ago. Can you move it to the
voAnalyzer/__tests__dir? - Add a todo to
fetchPartialTableHealpixIndex(), around line 269, that we should update theHealpixIndexsearch processor to handle a coordinate system parameter. I am not sure we will ever do this work but I would like to have a marker of where to begin. - update the region save code to output the correct coordinate system so the region download does not need to be disabled (see detail in the comment).
| // ra and dec are null when the table has no equatorial position columns. | ||
| // Arrays.asList accepts the nulls; List.of throws on them. |
There was a problem hiding this comment.
interesting, i don't think I knew that.
| //TODO determine when best to use full index and when to use partial. Is there any other factor beyond total rows | ||
| // the partial index is computed on the server, which reads the position columns as J2000 ra/dec. | ||
| // a galactic or ecliptic table must use the full index, which is built in the browser and converts to J2000. | ||
| if (csys !== CoordinateSys.EQ_J2000) return false; |
There was a problem hiding this comment.
This fixes the bug but maybe not the bigger problem. It would be possible to get a very large, non-j2000 table that the client cannot handle without Partial Index.
Fortunately I thinks those type of table are rare.
The code if fine but I am just highlighting the issue.
| */ | ||
| export class VoTableRecognizer { | ||
| constructor(tableModel, posCoord = 'eq') { | ||
| constructor(tableModel, posCoord) { |
There was a problem hiding this comment.
should the posCoord param just be taken out? It does no appear to be used and it appears that defaulting it just created a bug.
There was a problem hiding this comment.
It's used by findTableEqCenterColumns() to prefer ra/dec.
| function findCsysFromColumnName(lonColName, lonWord) { | ||
| if (lonWord === 'ra') return CoordinateSys.EQ_J2000; | ||
| const prefix = lonColName.toLowerCase().split(lonWord)[0].replace(/[-_]/g, ''); | ||
| if (prefix === 'g' || prefix === 'gal') return CoordinateSys.GALACTIC; | ||
| if (prefix === 'e' || prefix === 'ecl') return CoordinateSys.ECL_J2000; | ||
| if (prefix === 'sg') return undefined; | ||
| return CoordinateSys.EQ_J2000; |
There was a problem hiding this comment.
findCsysFromColumnName() is a nice addition to the guessing logic.
| const prefix = lonColName.toLowerCase().split(lonWord)[0].replace(/[-_]/g, ''); | ||
| if (prefix === 'g' || prefix === 'gal') return CoordinateSys.GALACTIC; | ||
| if (prefix === 'e' || prefix === 'ecl') return CoordinateSys.ECL_J2000; | ||
| if (prefix === 'sg') return undefined; |
There was a problem hiding this comment.
why returned undefined here? and not CoordinateSys.SUPERGALACTIC
There was a problem hiding this comment.
Updated to return it
| // skip the row: for an EQ_J2000 table getIpixForWp would throw and the full index would lose every later row; | ||
| // for any other frame convertCelestial would turn the bad latitude into a wrong but valid J2000 position | ||
| if (!tableWp || Math.abs(tableWp.y) > 90) return; | ||
| const wp= convertCelestial(tableWp); |
There was a problem hiding this comment.
i think this could be convertToJ2000() to be more consistent with your other changes.
| const table = getTblById(tbl_id); | ||
| //should we send table.title along with center columns to write into the region file? | ||
| const cenCols = findTableCenterColumns(table, true); | ||
| const cenCols = findTableEqCenterColumns(table, true); |
There was a problem hiding this comment.
I don't think this is the best way to fix this issue. Region files support other coordinate systems. In the region case I think you should send the coordinate system string. You can assign to the request the same way 'center_col' is assigned on line 260.
Then change the small file RegionTableWriter.java (around line 20) to write other coordinate systems out.
DS9 regions can support
Coordinate Systems
For each region, it is important to specify the coordinate system used to interpret the region, i.e., to set the context in whichsposition and size values are interpreted. For this purpose, the following keywords are recognized:
PHYSICAL # pixel coords of original file using LTM/LTV
IMAGE # pixel coords of current file
FK4, B1950 # sky coordinate systems
FK5, J2000 # sky coordinate systems
GALACTIC # sky coordinate systems
ECLIPTIC # sky coordinate systems
ICRS # currently same as J2000
LINEAR # linear wcs as defined in file
AMPLIFIER # mosaic coords of original file using ATM/ATV
DETECTOR # mosaic coords of original file using DTM/DTV
so J2000,B1950,GALACTIC,ECLIPTIC could be passed in the request.
This is a fairly small change that I think you could go ahead and do in this PR instead of us making another ticket.
hi @lrebull, thanks for sharing. apologies, the description could have been clearer about which save it refers to. step 7 is for the floppy disk icon in the *table panel. (in that case, the branch's build, it shouldn't offer the region file). i think the behavior you're seeing for the image's save icon may be zoom dependent, and it does the conversion too. p.s. if you see Trey's comment, we'll change it to offer the region file. |
Sounds good:
|
10f35d0 to
086d296
Compare
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
glon/glat), no tagsWhere 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:
glon/glat, are read as RA/Dec (step 3).pos.eq.ra(step 4).The branch follows the tags:
glon/glatmean galactic;elon/elatmean ecliptic;ra/decand any otherlon/lat, such asobj_lon, mean RA/Dec, as on dev.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):
The Coverage tab at the top left shows
HiPS display failedon both builds: a CDS outage, not this branch.Show it on the sky (steps 1–5):
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:
VoTableRecognizer.js:625). A column found by its name is also skipped when its tag's first word names a different quantity (isPositionPairatVoTableRecognizer.js:698). Dev placed those rows by numbers that aren't positions. Step 4 shows one.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.SearchServerCommands.java:151,:177). An RA from 0 to 360 passes through unchanged.HpxIndexCntlr.js:673). On dev, one such row makes the map build throw, and every later row is lost.ra/decnext to one tagged galactic or ecliptic pair: the tagged pair is now the position (VoTableRecognizer.js:354-355); dev tookra/decby 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 usera/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 changedGreen 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,isCoordColumnat:670, the list of such tags at:625). A pair withmeta.mainon 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:
Do: load the table, then show it on the sky.
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:
RA/Dec version:
Do: load the table, then show it on the sky.
AX J170047-4139, lands in a different box: the archive's own galactic and RA/Dec numbers for it are 31° apart.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 bySearchServerCommandsTest.3. Galactic names, no tags
Untagged columns named
glon/glatare now read as galactic; dev reads them as RA/Dec and draws them on empty sky.Service: HEASARC
Query (renamed columns lose their tags):
RA/Dec version:
Do: load the table, then show it on the sky.
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:
RA/Dec version:
Do: load the table, then show it on the sky.
Code:
VoTableRecognizer.js:167-168,isCoordColumnat: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):
RA/Dec version:
Do: load the table, but before you click Search, change Row Limit (next to it) from
50000to200000. Then show it on the sky.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):
RA/Dec version:
Do:
Coord=in its address. The page itself shows an error during the CDS outage; only the address matters.Coord=113.11+61.58, Mizar's galactic numbers read as RA/Dec.Coord=200.98141370159107+54.92448073783569.Coord=200.9812+54.9253, 3″ from the after build's (the table roundsglon/glatto 0.01°).Code:
TableAnalysis.js:449;DefaultSearchActions.js:297,:322.7. Save as a region file
UPDATE: region files now support galactic and ecliptic tables, saved under a GALACTIC or ECLIPTIC label instead of J2000.
A galactic table is no longer offered as a region file; dev offers it and writes the galactic numbers under a
J2000label.Service: HEASARC
Query (the same as step 6):
RA/Dec version:
Do:
Region (.reg). If it's there, pick it, click Save, and open the saved file.Region (.reg)is offered; the file readsJ2000; color=blue, thenpoint 113.11 61.58 # 10 point=circle.Region (.reg)isn't offered.Region (.reg)is offered; the file readsJ2000; color=blue, thenpoint 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):
RA/Dec version:
Do:
(from the uploaded table).Position Columns: glon, glat (from the uploaded table)Position Columns: Unspecified Column(s) (from the uploaded table)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;makeWorldPtUsingCenterColumnsreturns J2000 (:81). Helpers:toNum(Point.js:248) andconvertToJ2000(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.jsalso tests the recognizer behind steps 1–4: "by UCD, coordinate system", "columns described as something else are not the position", and the name-guesstest.eachcases.VoCoreUtils-test.jsis new: it testsisUCDWithandfindCsysFromUCD, as the ticket asked.VoCoreUtils.jsis unchanged.