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

Think about an interactive way to return imexam() results to the current session #68

Open sosey opened 8 years ago

sosey commented 8 years ago

Tricky in the blocking loop I have to use for DS9, maybe easier for the Ginga viewer. The return would be one or more variable the user has access to after the imexam event loop closes.

sosey commented 8 years ago

@hcferguson I'll work on the interactive solution, just realized I forgot to show how to pull just the data, without the interactive plot, in a way to save it to vars, this is how I run my package tests:

from imexam.imexamine import Imexamine
from astropy.io import fits

data=fits.getdata('iacs01t4q_flt.fits')
plots=Imexamine()
plots.set_data(data)
radii,flux=plots.radial_profile(532,415,genplot=False)

In [23]: radii
Out[23]: array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])

In [25]: flux
Out[25]: 
array([  282.78869629,  1523.00508499,   533.63273644,   124.50294375,
          73.30728304,   107.81776118,    60.45689106,    47.39679968,
          16.43066466,     6.33795738])

The above works if you already know the locations, genplot is an option for most of the plots I believe. I'll think about the best interactive way to return the arrays from the various functions. I'll add this as an example in the jupyter notebook directory.

sosey commented 8 years ago

This is the other method I use to grab info from the current figure:

plots.plot_line(50, 50)
f = plt.gca()
xplot, yplot = f.lines[0].get_xydata().T