pdsspect_image_set¶
The main model for all the views in pdsspect
-
class
pdsspect.pdsspect_image_set.
ImageStamp
(filepath, metadata=None, logger=None, wavelength=nan, unit='nm')[source]¶ Bases:
ginga.BaseImage.BaseImage
BaseImage for the image view canvas
Parameters: - filepath (
str
) – The path to the image to be opened - metadata (None) – Metadata for BaseImage
- logger (None) – logger for BaseImage
- wavelength (
float
[nan
]) – Image’s filter wavelength. Ifnan
, will try to useinstrument_models.get_wavelength.get_wavelength()
to get the wavelength - unit (
str
[nm
]) – Wavelength unit. Must be one ofaccepted_units
-
accepted_units
¶ list
– List of accepted units:nm
,um
, andAA
-
data
¶ numpy.ndarray
– Image data
-
get_wavelength
()[source]¶ astropy.units.quantity.Quantity
Copy of the wavelength
-
unit
¶ astropy.units.Unit
– Thewavelength
unitSetting the unit will convert the wavelength value as well. The new unit must also be one of the
accepted_units
- filepath (
-
class
pdsspect.pdsspect_image_set.
PDSSpectImageSet
(filepaths)[source]¶ Bases:
object
Model for each view is pdsspect
The images loaded should all have the same shape. Otherwise the images will have the smallest common shape and not look as expected (i.e., If when loading two images where one image has a shape of
(63, 36)
and the other image has a shape of(24, 42)
, the displayed shape will be(24, 36)
. This will cause the first image to have the right side cut off and the second image to have the top cut off). This is done so all ROIs created can apply to the entire list of images. To avoid this behavior, either only open images that have the same shape or open images one at a time.Parameters: filepaths ( list
) – List of filepaths to images-
colors
¶ list
ofstr
– List of possible color names to make ROIs.The possible choices for colors:
red
,brown
,lightblue
,lightcyan
,darkgreen
,yellow
,pink
,teal
,goldenrod
,sienna
,darkblue
,crimson
,maroon
,purple
, anderaser (black)
-
selection_types
¶ list
ofstr
– Selection types for making ROIs. The possible types areFilled Rectangle
,Filled Polygon
, andFilled Rectangle
, (single points).
-
accepted_units
¶ list
– List of accepted units:nm
,um
, andAA
-
images
¶ list
ofImageStamp
– Images to view and make selections. Must all have the same dimensions
-
filepaths
¶ list
– List of filepaths to images
-
current_color_index
¶ int
– Index of the current color incolors
list for ROI creation (Default is 0)
-
add_coords_to_roi_data_with_color
(coordinates, color)[source]¶ Add coordinates to ROI data in the with the given color
Parameters: - coordinates (
numpy.ndarray
ortuple
) –Either a
(m x 2)
array or a tuple of two arraysIf an array, the first column are the x coordinates and the second are the y coordinates. If a tuple of arrays, the first array are x coordinates and the second are the corresponding y coordinates.
- color (
str
) – The name a color incolors
- coordinates (
-
add_subset
(subset)[source]¶ Add a subset to the list of subsets
Parameters: subset ( SubPDSSpectImageSet
) – Subset to add to the list of subsets
-
all_rois_coordinates
¶ tuple
of twonumpy.ndarray
– Coordinates of where there is a pixel selected in a ROI
-
alpha
¶ float
– The alpha value between 0 and 1Setting the alpha value will change the opacity of all the ROIs and then set the data in the views
-
center
¶ tuple
of twofloat
– x and y coordinate of the center of the pan.Setting the center will move the pan to the new center. The center points cannot result in the pan being out of the image. If they are they will be changed so the pan only goes to the edge.
-
color
¶ str
– The current color in thecolors
list determined bycurrent_color_index
-
create_subset
()[source]¶ Create a subset and add it to the list of subsets
Returns: subset – The newly created subset Return type: SubPDSSpectImageSet
-
current_image
¶ ImageStamp
– The current image determined bycurrent_image_index
-
current_image_index
¶ int
– Index of the current image inimages
Setting the index will set the image in the views
-
delete_rois_with_color
(color)[source]¶ Delete the ROIs with the given color
Parameters: color ( str
) – The name a color incolors
-
flip_x
¶ bool
– If True, flip the x axisSetting the
flip_x
will display the transformation in the views
-
flip_y
¶ bool
– If True, flip the y axisSetting the
flip_y
will display the transformation in the views
-
get_coordinates_of_color
(color)[source]¶ The coordinates of the ROI with the given color
Parameters: color ( str
) – The name a color incolors
Returns: coordinates – The first array are the x coordinates and the second are the corresponding y coordinates Return type: tuple
of twonumpy.ndarray
-
map_zoom_to_full_view
()[source]¶ Get the change in x and y values to the center of the image
Returns:
-
pan_data
¶ numpy.ndarray
– The data within the pan
-
pan_roi_data
¶ numpy.ndarray
– The ROI data in the pan
-
remove_subset
(subset)[source]¶ Remove a subset to the list of subsets
Parameters: subset ( SubPDSSpectImageSet
) – Subset to remove to the list of subsets
-
selection_type
¶ str
– The current selection type inselection_types
determined byselection_index
-
simultaneous_roi
¶ bool
– If true, new ROIs appear in every viewSetting
simultaneous_roi
will set all windows to have the same ROIs as the first window. Any new ROI created will appear in each window
-
subsets
¶ list
ofSubPDSSpectImageSet
– The list of subsets
-
-
class
pdsspect.pdsspect_image_set.
SubPDSSpectImageSet
(parent_set)[source]¶ Bases:
pdsspect.pdsspect_image_set.PDSSpectImageSet
A Subset of an
PDSSpectImageSet
Parameters: parent_set ( PDSSpectImageSet
) – The subset’s parent-
parent_set
¶ PDSSpectImageSet
– The subset’s parent
-
add_coords_to_roi_data_with_color
(coordinates, color)¶ Add coordinates to ROI data in the with the given color
Parameters: - coordinates (
numpy.ndarray
ortuple
) –Either a
(m x 2)
array or a tuple of two arraysIf an array, the first column are the x coordinates and the second are the y coordinates. If a tuple of arrays, the first array are x coordinates and the second are the corresponding y coordinates.
- color (
str
) – The name a color incolors
- coordinates (
-
add_subset
(subset)¶ Add a subset to the list of subsets
Parameters: subset ( SubPDSSpectImageSet
) – Subset to add to the list of subsets
-
all_rois_coordinates
¶ tuple
of twonumpy.ndarray
– Coordinates of where there is a pixel selected in a ROI
-
alpha
¶ float
– The alpha value between 0 and 1Setting the alpha value will change the opacity of all the ROIs and then set the data in the views
-
center
¶ tuple
of twofloat
– x and y coordinate of the center of the pan.Setting the center will move the pan to the new center. The center points cannot result in the pan being out of the image. If they are they will be changed so the pan only goes to the edge.
-
create_subset
()¶ Create a subset and add it to the list of subsets
Returns: subset – The newly created subset Return type: SubPDSSpectImageSet
-
current_image
¶ ImageStamp
– The current image determined bycurrent_image_index
-
current_image_index
¶ int
– Index of the current image inimages
Setting the index will set the image in the views
-
delete_all_rois
()¶ Delete all of the ROIs
-
delete_rois_with_color
(color)¶ Delete the ROIs with the given color
Parameters: color ( str
) – The name a color incolors
-
flip_x
¶ bool
– If True, flip the x axisSetting the
flip_x
will display the transformation in the views
-
flip_y
¶ bool
– If True, flip the y axisSetting the
flip_y
will display the transformation in the views
-
get_coordinates_of_color
(color)¶ The coordinates of the ROI with the given color
Parameters: color ( str
) – The name a color incolors
Returns: coordinates – The first array are the x coordinates and the second are the corresponding y coordinates Return type: tuple
of twonumpy.ndarray
-
map_zoom_to_full_view
()¶ Get the change in x and y values to the center of the image
Returns:
-
pan_data
¶ numpy.ndarray
– The data within the pan
-
pan_roi_data
¶ numpy.ndarray
– The ROI data in the pan
-
register
(view)¶ Register a View with the model
-
remove_subset
(subset)¶ Remove a subset to the list of subsets
Parameters: subset ( SubPDSSpectImageSet
) – Subset to remove to the list of subsets
-
reset_center
()¶ Reset the pan to the center of the image
-
selection_type
¶ str
– The current selection type inselection_types
determined byselection_index
-
simultaneous_roi
¶ bool
– If true, new ROIs appear in every viewSetting
simultaneous_roi
will set all windows to have the same ROIs as the first window. Any new ROI created will appear in each window
-
subsets
¶ list
ofSubPDSSpectImageSet
– The list of subsets
-
swap_xy
¶ bool
– If True, swap the x and y axisSetting the
swap_xy
will display the transformation in the views
-
unregister
(view)¶ Unregister a View with the model
-