imexam
imexam copied to clipboard
Think about an interactive way to return imexam() results to the current session
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.
@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.
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