Skip to content

Quicklook viewer#2090

Draft
MNBrod wants to merge 99 commits intopypeit:developfrom
MNBrod:quicklook_viewer
Draft

Quicklook viewer#2090
MNBrod wants to merge 99 commits intopypeit:developfrom
MNBrod:quicklook_viewer

Conversation

@MNBrod
Copy link
Collaborator

@MNBrod MNBrod commented Mar 14, 2026

Adds a Quicklook GUI to PypeIt.

The changes are mostly isolated to /pypeit/display/ with a few exceptions:

pypeit/logger was changed to fix a bug where repeated invocations of pypeit's logger from the same process would not carry through a user's requested log file. This was a simple "move that block of code up a but" fix.

pypeit/scripts/ql.py was changed to accept manual extraction info as a command line argument, and pass that along appropriately.

pyproject.toml was changed to add the HTTP packages needed to handle a remote backend as optional dependencies (i.e. they are not installed by default).

The overall architecture of the plugin is described in the docstrings of qlview.py and at the bottom of the readthedocs page. Quick overview:

  • ui.py has all the widget stuff
  • state.py has a small struct-like class for keeping GUI state neat
  • file_browser.py has the logic for file sorting/display
  • slit_overlay.py draws slits over raw images and helps with clicking callbacks and the like. It's mostly stolen from show2dspec, but adapted to use Ginga slightly differently.
  • backend.py provides an "abstract" interface for talking to a filesystem and pypeit. There are currently two implementation, a local backend that passes through to whatever machine Ginga is running on, and an HTTP backend that allows PypeIt and the science files to be running on another machine on the network (which will be what Keck uses operationally, eventually). I have not tested the HTTP server much at all, that's on the to-do list.
  • servers has the HTTP server itself in it. This isn't really related to "display" per se, but there's no where else that it seemed to fit in PypeIt.
  • qlview.py has the meat of the plugin
  • display.py was updated to add this plugin. I went for Eric's show1dspec implementation approach

A readthedocs page has been started at pypeit/doc/quicklook_viewer.rst, I will be adding to it over the next few days (filling out sections and providing screenshots). This page was added to the end of the "Reference" section for now, it can be moved somewhere more fitting if someone has a better idea. I tried to be thorough with docstrings, many are Claude generated, but most are mine (Claude's are probably better...).

Items on my to-do list:

I am still making changes to this, but the core of the plugin is basically done and I can get feedback while adding more instruments/fixing minor stuff.

  • Finish the sphinx page
  • Thoroughly test each instrument. So far, I have only extensively used the GUI with longslit and multislit MOSFIRE data, and some DEIMOS. The code for HIRES, NIRES, LRIS R/B, and NIRSPEC is totally AI generated and I have not reviewed it.
  • Remove the Keck specific stuff. All I know about so far is using a "INSTRUME" FITS header to identify what instrument a file came from, that should be an easy enough fix
  • Figure out what tests look like for this. There are no pytest tests at the moment, nor am I sure what the right way to handle that is (especially for testing things like the HTTP server - I can write tests for that easily, but it shouldn't be part of the dev suite, right?)
  • Test the HTTP backend
  • Improve dithering support, right now it handles AB (in a clunky way) and can do a 2dcoadd of two science files, but you can't do more than 2, and it takes forever (fixing that is a bigger pypeit task, but there's some low hanging parallelization stuff there).
  • Better feedback on what's happening behind the scenes. Either a subwindow that lets you tail the log, or watching the log for more keywords and bodging a progress bar out of that.
  • I have some calibration scripts I can add to pypeit, they take the default ql.py and inst ql params and parallelizes it out from there (runs all setups at the same time, and all detectors/mosaics at the same time).

What Feedback I Need:

Generally, if people who are already familiar with PypeIt would be most helpful right now (so that I don't have to disentangle "I wish pypeit did ____" from "I wish the GUI did ____" myself) could play around with the GUI and report bugs/wanted features, that would be great. I would use a multislit dataset from DEIMOS for now - it has the highest density of slits (i.e. most places for it to go wrong) and also yields cleaner outputs than a single IR AB pair will. MOSFIRE is also a reasonable choice.

I have been using this GUI with Keck SAs and observers for a while, so the general shape of things seems OK at the moment.

There was a substantial refactor in February '26, so the commit history beyond that is a bit cluttered, apologies.

MNBrod added 30 commits March 12, 2026 16:07
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