FIREFLY-2066: Consolidate the loading UI of Spectral Lines feature - #2015
jaladh-singhal wants to merge 29 commits into
Conversation
…nd plotting clear
Fix the layout styling issues with NoDataTableView
| // Recommended spectral line lists in the Spectral Lines panel: a JSON array of {label, src} objects, in order. | ||
| // Omit "src" to use one of Firefly's bundled lists - any other label with no src is dropped (logged as an error). | ||
| // Set to "[]" to offer no spectral line lists at startup. | ||
| charts.spectrum.linelists = "[{\"label\": \"SPHEREx line list\"}, {\"label\": \"Spitzer PAHFIT line list\"}, {\"label\": \"Herschel HSPOT line list\"}, {\"label\": \"JWST line list (remote)\", \"src\": \"https://gist.githubusercontent.com/jaladh-singhal/2b4230e2fc64586fbe7b51519d26ad3f/raw/21f503d13bc0e859d269d8acc782083f7fa84c7e/jwst_linelist.tbl\"}]" |
There was a problem hiding this comment.
NOTE: Last option "JWST line list (remote)" is just a test for recommended/pre-installed line list coming from a remote server rather than bundling with firefly static resources.
I plan to remove it when merging this PR.
|
@lrebull thanks for the feedback.
I'm not seeing this issue in Chrome - the labels are sticking to the lines. But I can see this issue in Firefox assuming that's what you used for testing? Will debug why and try to fix.
Yes, I meant to fix this but forgot. And now it's more pronounced with looong labels in the lists you all gave me. Will fix.
This is just a decorator to indicate that "hey, look beneath this popup where results screen is". I can see the click-behavior confusion due to blue color. How about I revert it to the same color of text (grey-ish)? OR do you want me to remove it altogether? I'm also open to changing the wording of response text to incorporate some version of "look beneath in results" if you have any better suggestions.
Hmm, I think this happens because this what plotly is doing by default to show all elements you plotted on chart. I'll have to override the chart layout to always only show the range of data traces. Will try to fix.
I changed the original redshift value in the file (from 1e-3 something) to 0.5 so that redshift correction is easily noticeable. Please disregard the scientific accuracy for just this spectrum file that has hand-crafted metadata 😄
This becomes clear if you open the chart options dialog because it tells that redshift correction is being applied to spectral lines in observed frame whereas to spectrum in rest frame. Because we settled on this one spectral line dialog to rule them all, I cannot show any wording specific to one spectral chart since it may be irrelevant for other spectral charts open. How about right after the table we add a note: "If spectral chart is in observed frame, redshift gets applied to the selected lines in the plot; see Chart Options dialog"? I plan to keep it after the table because the lines in table are always in rest frame, it's only when plotting (after table selection before "n lines plotted" response) it gets determined where they land on wavelength axis. |
robyww
left a comment
There was a problem hiding this comment.
Good job. I found it go be working as planned and I don't see any bugs.
Code
A couple of small suggestions and I want to have a conversation about how we generate ids and how the person doing firefly config uses them. I don't think we have it right yet.
UI
- The is a UI issue with the Upload table tables dialog. The dialog is coming up too narrow and the
Table Metasection is not fully displayed.
- in
Spectral Lines Optionthe table sometime looks like this:
| }; | ||
| }, [chartId]); | ||
|
|
||
| useSpectralLinesSync(chartId); |
There was a problem hiding this comment.
is it necessary to the a custom hook if this is the only place it is use? Or is there a plan to use it elsewhere?
There was a problem hiding this comment.
This is just to encapsulate useEffect logic which is specific to spectral lines. Otherwise there would be so many other imports from SpectralLines.jsx.
And yes in future if we initialize chart differently or there is some other call site that needs it, this can be reused. It was super helpful in testing too.
| const {xErrArray, yErrArray, xMax, xMin, yMax, yMin, xUnit, yUnit} = getSpectrumProps(tbl_id); | ||
|
|
||
| const {Xunit, Yunit, SpectralFrame, SpectralLines} = useSpectrumInputs({activeTrace, tbl_id, chartId, groupKey}); | ||
| const {Xunit, Yunit, SpectralFrame} = useSpectrumInputs({activeTrace, tbl_id, chartId, groupKey}); |
There was a problem hiding this comment.
useSpectrumInputs is written as a hook but it looks like it is only a utility function. Maybe it should be useSpectrumInputs
There was a problem hiding this comment.
I don't understand your comment completely. This wasn't a great naming choice but this use* pattern is what we have all over Spectrum|Scatter|BasicOptions.jsx UI components. My changes don't effect this, I'm just taking out a component it returns.
| "SPHEREx line list", "/edu/caltech/ipac/firefly/resources/spherex_lines.tbl", | ||
| "Spitzer PAHFIT line list", "/edu/caltech/ipac/firefly/resources/pahfit_lines.csv", | ||
| "Herschel HSPOT line list", "/edu/caltech/ipac/firefly/resources/hspot_lines.csv" |
There was a problem hiding this comment.
After looking at this. I have two concerns.
- because there is nota separate id only an id build from the title, If the title get changed (at it will) then another app the is specifying just one will break.
- This is really only only place our predefined lines list is documented. I don't have a solution it is just a concern.
I think you, I and @loitly should have a discussion about this before you merge.
I think the ID should be something like.
SPHEREx-v1Spitzer-PAHFITHSPOT
There was a problem hiding this comment.
Yes, let's talk about it. I don't quite understand the concerns.
There was a problem hiding this comment.
I'm generating IDs on the fly as we discussed but it happens one time any app is intialised server side and then client queries that cached {ID, label, src} so I don't see how it will break other apps.
|
Yes, i'm using firefox. Yeah, i really don't want to use the 'results' icon in a way differently here from where it gets used elsewhere; that seems messy. let me see if can rally the other scientists for input on this one ... A note after the table would work. again, need input from other scientists ... |
loitly
left a comment
There was a problem hiding this comment.
UI worked great. Just a few suggested changes.
|
Thanks for testing it @jonesmg.
I'm fixing it. Luisa also mentioned it.
It's already possible with plotly's interactive chart features. Take your mouse near the X-axis until it changes to the following cursor (< >). |
|
wow, i did not know that! making a note of it .. |






Fixes FIREFLY-2066
SpectralLinesPanel- loading is a separate concern from per-trace display options, and the panel is shared app-wide, not per-chartcharts.spectrum.linelistsapp-config property ({label, src?}array,srccan be a bundled resource or remote URL) instead of one hardcoded combined CSV - retiredlinelist_combined.csvfor separatehspot_lines.csv/pahfit_lines.csv/spherex_lines.tblresources plus a remote JWST list as a src-as-URL examplespectral-lines), rebuilt only on explicit "Load Lines"/"Clear All", never automatically on checkbox/mapping changeSpectralLinesProcessorwarns server-side when an available line list's wavelength column has no units metadata, and the upload column mapper shows similar feedback for the uploaded file's wavelength columnAdditional changes/cleanup:
UploadTableSelectorenhanced for use inSpectralLinesPanel: addedallowClear(adds a chip to clear the uploaded file),uploadTblOptions(keeps the upload out of the main Results view), and a per-fieldgetFeedbackhook (surfaces the uploaded wavelength column's detected/assumed unit)SpectrumOptions: Standardized default resolution logic for redshift options (getEffectiveSpectralFrameOption) and de-duplicated a few hardcoded spectral-frame/redshift constantsSpectrumUnitConversion(for SPHEREx spectrum results)BasicTableViewTesting
All the test files linked in the ticket.
https://firefly-2066-spec-lines-loading.irsakubedev.ipac.caltech.edu/firefly
Core functionality
Upload line list
Redshift correction
0.5and "Apply" -> spectral lines should redshift right of their lines-table wavelength. Switch to "Rest Frame" with the same redshift and "Apply" -> lines return to their original wavelength and the spectrum blueshifts left instead. Net effect: lines and spectrum end up in the same relative position, just with the X-axis shifted - confirming the correction applies correctly in both framesRegression