Focusing
Imexam in Pyraf 😮
Start terminal, navigate to your data directory and start ds9 ('&' runs it in the background):
$ ds9&
Start pyraf:
$ pyraf
Display your focusing image (leave off ".fits", final number is which ds9 frame to use):
--> display focus12000 1
Run Imexam. Pyraf will move cursor to ds9 window without raising it.
--> imexam
Plot radial profile by pointing at star and pressing 'r' (no need to click on the ds9 window). Last three numbers are estimates of the fwhm, pick one.
 Quit Imexam by pressing 'q' in the ds9 window (not in the Pyraf window). Pyraf is ready for the next command: display, imexam, display, imexam, etc.
Imexam with python 😕
Documentation: https://imexam.readthedocs.io/en/0.9.1/imexam/imexam_command.htmlOpen terminal, start python and import imexam:
> python
> import imexam
Start your imexam connection:
> viewer = imexam.connect()
This should open up a ds9 window. If you get an error about a path or a permission error, I found one extra step that should make things work. If you get this error:
Open a ds9 window (via shortcut or via a separate terminal)
In your python window, run ‘imexam.list_active_ds9()’. This should produce something like {'7f000001:51634': ('ds9', ‘user’, 'DS9', 'gs’)}. Use this window name in your connect line, as in, run: ‘viewer = imexam.connect('7f000001:51634’)
Load your focusing image. Change the file path to whatever img you are using:
> viewer.load_fits(‘./focusing/test.fits’)
Scale the image (automatically does z-scale, but you can also do ‘asinh’, etc.):
> viewer.scale()
Start imexam:
> viewer.imexam()
Mouse over to the ds9 window.  With the cursor on your target, press ‘r’, and a radial profile plot should pop up. Â
If it doesn’t pop up, try again, making sure it registers the key you’re pressing.
If you want to save the plot, press ’s’— it saves to the disk as ‘imexam_plot.pdf’.
If you want to plot in new windows to compare the plots, press ‘2’ before pressing ‘r’ again