Imexamine¶
-
class
imexam.imexamine.
Imexamine
[source]¶ Bases:
object
The imexamine class controls plotting and analysis functions.
do imexamine like routines on the current frame.
read the returned cursor key value to decide what to do
region_size is the default radius or side of the square for stat info
Methods Summary
aper_phot
(x, y[, data, genplot, fig, error])Perform aperture photometry.
close
()For use with the Imexamine object standalone.
column_fit
(x, y[, data, form, genplot, fig])Compute the 1d fit to the column of data.
com_center
(x, y[, data, delta, oversampling])Return the center of mass of the object at x,y
contour
(x, y[, data, fig])plot contours in a region around the specified location.
curve_of_growth
(x, y[, data, genplot, fig])Display a curve of growth plot.
cutout
(x, y[, data, size, fig])Make a fits cutout around the pointer location without wcs.
do_option
(x, y, key)Run the imexam option.
gauss_center
(x, y[, data, delta, sigma_factor])Return the Gaussian 2D fit center of the object at (x,y).
Return the imexam options as a key list.
return the default plot name.
histogram
(x, y[, data, genplot, fig])Calulate a histogram of the data values.
line_fit
(x, y[, data, form, genplot, fig, col])compute the 1D fit to the line of data using the specified form.
new_plot_window
(x, y[, data])make the next plot in a new plot window.
option_descrip
(key[, field])Return the looked up dictionary of options.
plot_column
(x, y[, data, fig])column plot of data at point y.
plot_line
(x, y[, data, fig])line plot of data at point x.
Print the imexam options to screen.
radial_profile
(x, y[, data, form, genplot, fig])Display the radial profile plot (intensity vs radius) for the object.
register
(user_funcs)register a new imexamine function made by the user as an option.
report_stat
(x, y[, data])report the statisic of values in a box with side region_size.
set all pars to their defaults.
save
([filename, fig])Save to file the figure that’s currently displayed.
save_figure
([fig])Save to file the figure that’s currently displayed.
set_aper_phot_pars
([user_dict])the user may supply a dictionary of par settings.
set parameters for column plots.
set parameters for 1D line fit plots.
set paramters for the center of mass function
set parameters for contour plots.
set parameters for curve of growth plots.
set parameters for cutout images.
set_data
([data])initialize the data that imexamine uses.
set parameters for histogram plots.
set parameters for 1D line fit plots.
set parameters for line plots.
Define the dictionary which maps imexam keys to their functions.
set_plot_name
([filename])set the default plot name for the “s” key.
set parameters for radial profile plots.
set parameters for surface plots.
setlog
([filename, on, level])Turn on and off logging to a logfile or the screen.
Print the available astropy models for plot fits.
show_xy_coords
(x, y[, data])print the x,y,value to the screen.
surface
(x, y[, data, fig])plot a surface around the specified location.
reset the default parameters for all functions.
Methods Documentation
-
aper_phot
(x, y, data=None, genplot=True, fig=None, error=None)[source]¶ Perform aperture photometry.
Uses photutils functions, photutils must be available
- Parameters
x (int) – The x location of the object
y (int) – The y location of the object
data (numpy array) – The data array to work on
genplot (bool) – plot the apertures to a figure; if false then the tuple of (apertures, annulus_apertures,rawflux_table, sky_per_pix) is returned.
fig (figure object for redirect) – Used for interaction with the ginga GUI
error (float array) – If error is not None, then it should be given the error array for the corresponding data image. error is assumed to include all sources of error, including the Poisson error of the sources See the docs for photutils for more details. The returned table will include a ‘aperture_sum_err’ column in addition to ‘aperture_sum’. ‘aperture_sum_err’ provides the propagated uncertainty associated with ‘aperture_sum’.
- Returns
plot or the tuple of apertures, annulus_apertures, rawflux_table, sky_per_pix.
Where apertures and annulus_apertures are photuils objects, or None
-
column_fit
(x, y, data=None, form=None, genplot=True, fig=None)[source]¶ Compute the 1d fit to the column of data.
- Parameters
x (int) – The x location of the object
y (int) – The y location of the object
data (numpy array) – The data array to work on
form (string) – This is the functional form specified in the column fit parameters
genplot (int) – produce the plot or return the fit model
fig (figure name for redirect) – Used for interaction with the ginga GUI
Notes
delta is the range of data values to use around the x,y location
The background is currently ignored
if centering is True, then the center is fit with a 2d gaussian, but this is currently not done for Polynomial1D
-
com_center
(x, y, data=None, delta=None, oversampling=1.0)[source]¶ Return the center of mass of the object at x,y
- Parameters
x (int) – The x location of the object
y (int) – The y location of the object
data (numpy array) – The data array to work on
delta (int) – The range of data values (bounding box) to use around the x,y location for calculating the center
oversampling (int) – Oversampling factors of pixel indices. If oversampling is a scalar this is treated as both x and y directions having the same oversampling factor; otherwise it is treated as (x_oversamp, y_oversamp)
-
contour
(x, y, data=None, fig=None)[source]¶ plot contours in a region around the specified location.
-
curve_of_growth
(x, y, data=None, genplot=True, fig=None)[source]¶ Display a curve of growth plot.
- Parameters
Notes
the object photometry is taken from photutils
-
cutout
(x, y, data=None, size=None, fig=None)[source]¶ Make a fits cutout around the pointer location without wcs.
-
gauss_center
(x, y, data=None, delta=10, sigma_factor=0)[source]¶ Return the Gaussian 2D fit center of the object at (x,y).
- Parameters
x (int) – The x location of the object
y (int) – The y location of the object
data (numpy array) – The data array to work on
delta (int) – The range of data values (bounding box) to use around the x,y location for calculating the center
sigma_factor (float, optional) – The sigma clipping factor to use on the data fit
-
histogram
(x, y, data=None, genplot=True, fig=None)[source]¶ Calulate a histogram of the data values.
- Parameters
x (int, required) – The x location of the object
y (int, required) – The y location of the object
data (numpy array, optional) – The data array to work on
genplot (boolean, optional) – If false, returns the hist, bin_edges tuple
fig (figure name for redirect) – Used for interaction with the ginga GUI
Notes
This functional originally used the pylab histogram routine for plotting. In order to accomodate returning just the histogram data, this was changed to the numpy histogram, with a subsequent plot if genplot is True.
Does not yet support numpy v1.11 strings for bin estimation.
-
line_fit
(x, y, data=None, form=None, genplot=True, fig=None, col=False)[source]¶ compute the 1D fit to the line of data using the specified form.
- Parameters
x (int) – The x location of the object
y (int) – The y location of the object
data (numpy array) – The data array to work on
form (string) – This is the functional form specified in the line fit parameters see show_fit_models()
genplot (bool) – produce the plot or return the fit
fig (figure for redirect) – Used for interaction with the ginga GUI
col (bool (False)) – Plot column instead of line
Notes
The background is currently ignored
If centering is True in the parameter set, then the center is fit with a 2d gaussian, not performed for Polynomial1D
-
new_plot_window
(x, y, data=None)[source]¶ make the next plot in a new plot window.
Notes
x,y, data, are not used here, but the calls are setup to take them for all imexam options. Is there a better way to do the calls in general? Once the new plotting window is open all plots will be directed towards it. The old window cannot be used again.
-
option_descrip
(key, field=1)[source]¶ Return the looked up dictionary of options.
- Parameters
key (string) – The key which was pressed, it relates to the function to call
field (int) – This tells where in the option dictionary the function name can be found
-
radial_profile
(x, y, data=None, form=None, genplot=True, fig=None)[source]¶ Display the radial profile plot (intensity vs radius) for the object.
From the parameters Dictionary: If pixel is True, then every pixel at each radius is plotted. If pixel is False, then the sum of all pixels in integer bins is plotted
Background may be subtracted and centering can be done with a 2D Gaussian fit. These options are read from the plot parameters dict.
-
register
(user_funcs)[source]¶ register a new imexamine function made by the user as an option.
- Parameters
user_funcs (dict) – Contains a dictionary where each key is the binding for the (function,description) tuple
Notes
The new binding will be added to the dictionary of imexamine functions as long as the key is unique. The new functions do not have to have default dictionaries associated with them.
-
report_stat
(x, y, data=None)[source]¶ report the statisic of values in a box with side region_size.
The statistic can be any numpy function
-
save
(filename=None, fig=None)[source]¶ Save to file the figure that’s currently displayed.
this is used for the standalone plotting
- Parameters
filename (string) – Name of the file the plot will be saved to. The extension on the filename determines the filetype
fig (figure name for redirect) – Used for interaction with the ginga GUI
-
save_figure
(fig=None)[source]¶ Save to file the figure that’s currently displayed.
this is used for the imexam loop, because there is a standard api for the loop
- Parameters
data (numpy array) – The data array to work on
fig (figure for redirect) – Used for interaction with the ginga GUI
-
set_option_funcs
()[source]¶ Define the dictionary which maps imexam keys to their functions.
Notes
The user can modify this dictionary to add or change options, the first item in the tuple is the associated function the second item in the tuple is the description of what the function does when that key is pressed
-
set_plot_name
(filename=None)[source]¶ set the default plot name for the “s” key.
- Parameters
filename (string) – The name which is used to save the current plotting window to a file The extension on the name decides which file type is used
-
setlog
(filename=None, on=True, level=20)[source]¶ Turn on and off logging to a logfile or the screen.
-