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:
pds_image

PDS3Image – Image object that holds data and the image label

image_name

str – The basename of the filepath

seen

bool – False if the image has not been seen by the viewer. True otherwise Default if False

cuts

tuple – The cut levels of the image. Default is two None types

accepted_units

list – List of accepted units: nm, um, and AA

data

numpy.ndarray – Image data

get_wavelength()[source]

astropy.units.quantity.Quantity Copy of the wavelength

unit

astropy.units.Unit – The wavelength unit

Setting the unit will convert the wavelength value as well. The new unit must also be one of the accepted_units

wavelength

int – The images wavelength

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 of str – 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, and eraser (black)

selection_types

list of str – Selection types for making ROIs. The possible types are Filled Rectangle, Filled Polygon, and Filled Rectangle, (single points).

accepted_units

list – List of accepted units: nm, um, and AA

images

list of ImageStamp – 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 in colors 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 or tuple) –

    Either a (m x 2) array or a tuple of two arrays

    If 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 in colors
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 two numpy.ndarray – Coordinates of where there is a pixel selected in a ROI

alpha

float – The alpha value between 0 and 1

Setting the alpha value will change the opacity of all the ROIs and then set the data in the views

alpha255

float The alpha value normalized between 0 and 255

center

tuple of two float – 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 the colors list determined by current_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 by current_image_index

current_image_index

int – Index of the current image in images

Setting the index will set the image in the views

delete_all_rois()[source]

Delete all of the ROIs

delete_rois_with_color(color)[source]

Delete the ROIs with the given color

Parameters:color (str) – The name a color in colors
edges

tuple of four float – The left, bottom, right and top edges of the pan

filenames

list of str – Basenames of the filepaths

flip_x

bool – If True, flip the x axis

Setting the flip_x will display the transformation in the views

flip_y

bool – If True, flip the y axis

Setting 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 in colors
Returns:coordinates – The first array are the x coordinates and the second are the corresponding y coordinates
Return type:tuple of two numpy.ndarray
map_zoom_to_full_view()[source]

Get the change in x and y values to the center of the image

Returns:
  • delta_x (float) – The horizontal distance to the center of the full image
  • delta_y (float) – The vertical distance to the center of the full image
pan_data

numpy.ndarray – The data within the pan

pan_height

float – Height of the pan area

pan_roi_data

numpy.ndarray – The ROI data in the pan

pan_slice

numpy.s_ – Slice of pan to extract data from an array

pan_width

float – Width of the pan area

register(view)[source]

Register a View with the model

remove_subset(subset)[source]

Remove a subset to the list of subsets

Parameters:subset (SubPDSSpectImageSet) – Subset to remove to the list of subsets
reset_center()[source]

Reset the pan to the center of the image

selection_index

int – Index of the ROI selection type

selection_type

str – The current selection type in selection_types determined by selection_index

set_unit()[source]

Set each image to unit

simultaneous_roi

bool – If true, new ROIs appear in every view

Setting 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 of SubPDSSpectImageSet – The list of subsets

swap_xy

bool – If True, swap the x and y axis

Setting the swap_xy will display the transformation in the views

transforms

tuple of bool – the flip_x, flip_y, and swap_xy transformations

unit

str – The image set’s current wavelength unit

unregister(view)[source]

Unregister a View with the model

x_radius

float – Half the image width

y_radius

float – Half the image height

zoom

int – Zoom factor for the pan

The zoom factor determines the width and height of the pan area. For example, if zoom=2, then the width would be half the image width and the height would be half the image height. Setting the zoom will adjust the pan size in the views.

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 or tuple) –

    Either a (m x 2) array or a tuple of two arrays

    If 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 in colors
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 two numpy.ndarray – Coordinates of where there is a pixel selected in a ROI

alpha

float – The alpha value between 0 and 1

Setting the alpha value will change the opacity of all the ROIs and then set the data in the views

alpha255

float The alpha value normalized between 0 and 255

center

tuple of two float – 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 the colors list determined by current_color_index

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 by current_image_index

current_image_index

int – Index of the current image in images

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 in colors
edges

tuple of four float – The left, bottom, right and top edges of the pan

filenames

list of str – Basenames of the filepaths

flip_x

bool – If True, flip the x axis

Setting the flip_x will display the transformation in the views

flip_y

bool – If True, flip the y axis

Setting 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 in colors
Returns:coordinates – The first array are the x coordinates and the second are the corresponding y coordinates
Return type:tuple of two numpy.ndarray
map_zoom_to_full_view()

Get the change in x and y values to the center of the image

Returns:
  • delta_x (float) – The horizontal distance to the center of the full image
  • delta_y (float) – The vertical distance to the center of the full image
pan_data

numpy.ndarray – The data within the pan

pan_height

float – Height of the pan area

pan_roi_data

numpy.ndarray – The ROI data in the pan

pan_slice

numpy.s_ – Slice of pan to extract data from an array

pan_width

float – Width of the pan area

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_index

int – Index of the ROI selection type

selection_type

str – The current selection type in selection_types determined by selection_index

set_unit()

Set each image to unit

simultaneous_roi

bool – If true, new ROIs appear in every view

Setting 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 of SubPDSSpectImageSet – The list of subsets

swap_xy

bool – If True, swap the x and y axis

Setting the swap_xy will display the transformation in the views

transforms

tuple of bool – the flip_x, flip_y, and swap_xy transformations

unit

str – The image set’s current wavelength unit

unregister(view)

Unregister a View with the model

x_radius

float – Half the image width

y_radius

float – Half the image height

zoom

int – Zoom factor for the pan

The zoom factor determines the width and height of the pan area. For example, if zoom=2, then the width would be half the image width and the height would be half the image height. Setting the zoom will adjust the pan size in the views.