spacetelescope / imexam

imexam is a python tool for simple image examination, and plotting, with similar functionality to IRAF's imexamine
http://imexam.readthedocs.io
BSD 3-Clause "New" or "Revised" License
74 stars 45 forks source link

viewing and blinking fits images with ds9 #105

Open sosey opened 7 years ago

sosey commented 7 years ago

This was moved over from discussion with @jehturner in https://github.com/astroconda/astroconda-contrib/issues/183#issuecomment-286491174

Oh, right. Why not? Sorry, I remember you talking about imexam, now that you mention it (and I think I tried it along time ago). Is this meant to supercede numdisplay then? One thing I do like is being able to display to ximtool as well, which I prefer for data inspection, but that's not important for these particular operational scripts.

Well, that didn't crash in my little test above (though I'd need to figure out how to deal with the started vs non-started ds9 in the script). Thanks for the suggestion.

Yup, it should fully replace numdisplay. Can ask what you're doing in ximtool that you prefer it for >inspection? If it's something not already in imexam, it could be added to the defaults or as a user >defined function. imexam replaces both numdisplay and the iraf imexamine functionality. There's more >info in the docs: http://imexam.rtfd.io/

you can grab the list of open windows using imexam.list_active_ds9() which returns a dictionary of >available windows, you can use the keys to connect, or if you've named them (ds9 -title junk), their >names, which are the first items in the list for each connection: screen shot 2017-03-13 at 8 48 54 pm

Thanks for the extra info. It looks like load_fits() does allow just displaying an image without an interaction loop where needed, though if I subsequently do viewer.imexam() (on a MEF file) I get:

KeyError: 'HDUList indices must be integers, extension names as strings, or (extname, version) tuples; got None I'm having trouble quickly spotting what is the right usage for specifying MEF extensions in the help (eg. the docstring for load_fits() has "*args, **kwargs" but doesn't explain what the options are).

Regarding ximtool, it's just a few bits of the user interface -- in particular, I really need ctrl-b / ctrl-f (along with "AReg") to flip back and forth instantaneously between image buffers for comparison. Blinking at a fixed rate doesn't cut it -- my brain doesn't work like that. That's a feature of the viewer rather than the display library though. This may be something that can be done in Ginga, or added to it, now that it can be installed more easily with Astroconda.

PS. DS9 does have , but it only cycles in one direction and is too slow, which isn't really useful (I did once hack it to cycle both ways but for some reason had to use a less convenient keystroke and the lag was still a problem).

Actually, FYI, I found load_mef_as_multi() but 1) our usual mode of use is to display a single, specified MEF extension at a time and 2) it still gives the same KeyError from the imexam() method (unless I'm doing something wrong). Sorry to deviate a bit from the issue subject...

If it thinks the file is MEF and you don't specify an extension it will try and load [1], if it thinks it's a >simple then the data in [0].

In [30]: viewer.load_fits('iacs01t4q_flt.fits') In [31]: viewer.get_frame_info() Out[31]: {'extname': 'SCI', 'extver': 1, 'filename': '/Users/sosey/test_images/iacs01t4q_flt.fits', 'iscube': False, 'mef': True, 'naxis': 0, 'numaxis': 2, 'user_array': None} you should also be able to:

viewer.load_fits('image.fits[1]') viewer.load_fits('image.fits',extver=4)

I can't seem to replicate the imexam() issue with MEF files I have, but I'll open an issue over in the >imexam repo for updating the documentation to make using load_fits more clear. The function docs are >down a level: viewer.window.load_fits? because the connect() module works in composition to make it >a bit more flexible with different viewers and so you can use the imexamine stuff as a separate library. >(imexam also supports ginga widgets and its html5 display)

alas, I too miss the fast blinking. I get around that by calling viewer.frame('next') a bunch of times to go >back and forth. I'll think about linking this to an imexam option for the ds9 display.