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])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. 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])Return the 2d gaussian fit center of the data. get_options
()Return the imexam options as a key list. get_plot_name
()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])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_options
()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. reset_defpars
()set all pars to their defaults. save
([filename, fig])Save to file the figure that’s currently displayed. save_figure
(x, y[, data, 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_colplot_pars
()set parameters for column plots. set_column_fit_pars
()set parameters for 1D line fit plots. set_contour_pars
()set parameters for contour plots. set_curve_pars
()set parameters for curve of growth plots. set_cutout_pars
()set parameters for cutout images. set_data
([data, dtype])initialize the data that imexamine uses. set_histogram_pars
()set parameters for histogram plots. set_line_fit_pars
()set parameters for 1D line fit plots. set_lineplot_pars
()set parameters for line plots. set_option_funcs
()Define the dictionary which maps imexam keys to their functions. set_plot_name
([filename])set the default plot name for the “s” key. set_radial_pars
()set parameters for radial profile plots. set_surface_pars
()set parameters for surface plots. setlog
([filename, on, level])Turn on and off logging to a logfile or the screen. show_fit_models
()Print the available astropy models for plot fits. show_xy_coords
(x, y[, data])print the x,y,value to the screen. showplt
()Show the plot. surface
(x, y[, data, fig])plot a surface around the specified location. unlearn_all
()reset the default parameters for all functions. Methods Documentation
-
aper_phot
(x, y, data=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
-
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
-
contour
(x, y, data=None, fig=None)[source]¶ plot contours in a region around the specified location.
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
fig: figure for redirect
Used for interaction with the ginga GUI
-
curve_of_growth
(x, y, data=None, genplot=True, fig=None)[source]¶ Display a curve of growth plot.
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
fig: figure name for redirect
Used for interaction with the ginga GUI
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.
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
size: int
The radius of the cutout region
fig: figure for redirect
Used for interaction with the ginga GUI
-
do_option
(x, y, key)[source]¶ Run the imexam option.
Parameters: x: int
The x location of the cursor or data point
y: int
The y location of the cursor or data point
key: string
The key which was pressed
-
gauss_center
(x, y, data=None, delta=10)[source]¶ Return the 2d gaussian fit center of the 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
delta: int
The range of data values (bounding box) to use around the x,y location for calculating the center
-
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)[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 Currently Gaussian1D, Moffat1D, MexicanHat1D, Polynomial1D
genplot: bool
produce the plot or return the fit
fig: figure for redirect
Used for interaction with the ginga GUI
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
-
plot_column
(x, y, data=None, fig=None)[source]¶ column plot of data at point 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
fig: figure name for redirect
Used for interaction with the ginga GUI
-
plot_line
(x, y, data=None, fig=None)[source]¶ line plot of data at point x.
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
fig: figure object for redirect
Used for interaction with the ginga GUI
-
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 at each radius 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.
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
The string name of the form of the fit to use
genplot: bool
Generate the plot if True, else return the fit data
-
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
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
-
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
(x, y, data=None, 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: 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
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.
Parameters: filename: str, optional
Name of the output file to record log information
on: bool, optional
True by default, turn the logging on or off
level: logging class, optional
set the level for logging messages, turn off screen messages by setting to logging.CRITICAL
-
show_xy_coords
(x, y, data=None)[source]¶ print the x,y,value to the screen.
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
-