Plot utils#

Visualization utils.

class lsst.cst.visualization.Band(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)#

Exposure bands available.

class lsst.cst.visualization.BoxInteract(image_display, options=BoxInteractOptions(color='red'))#

Interactive plot with a selectable box tool to show extra information.

Parameters:
  • options (BoxInteractOptions, Optional) – Box plot options.

  • image_display (ImageDisplay) –

options#

alias of BoxInteractOptions

show()#

Show interactive display.

class lsst.cst.visualization.ButlerCalExpDataFactory(configuration, collection)#

Factory of calexp from a Butler.

Parameters:
  • configuration (Configuration) – Configuration available for a butler.

  • collection (Collection) – Collection to be searched (in order) when reading datasets.

get_cal_exp_data(calexp_id)#

Check for the exposure in the Butler collection and returns a handler to get exposure information.

Parameters:

calexp_id (CalExpId) – CalExp information to search for.

Raises:

ValueError – When the Exposure could not be found inside the butler collection.

Returns:

exposure_data – Instance of a CalExpData which can be used to obtain exposure data.

Return type:

CalExpData

class lsst.cst.visualization.CalExpData#

Interface to get information from a Calexp.

abstract property cal_exp_id#

Exposure Identifier

Returns:

exposure_id – Information of the exposure.

Return type:

ExposureId

abstract get_image()#

Plot image .

Returns:

calexp – Exposure data from calexp.

Return type:

numpy.ndarray

abstract get_image_bounds()#

Exposure Image bounds.

Returns:

image_bounds – Bounds of the cal_exp Exposure.

Return type:

Tuple[int]

abstract get_sources()#

Calexp sources.

Returns:

sources – Sources from the calexp.

Return type:

pandas.DataFrame

class lsst.cst.visualization.CalExpDataFactory#

Interface for the CalExp Factories

get_cal_exp_data(calexp_id)#

Check for the exposure and returns a handler to get exposure information.

Parameters:

calexp_id (CalExpId) – CalExp information to search for.

Raises:

ValueError: – When the CalExp data could not be found.

Returns:

exposure_data – Instance of a CalExpData which can be used to obtain exposure data.

Return type:

CalExpData

class lsst.cst.visualization.CalExpId(visit, detector, band)#

Calexp information.

Parameters:
  • visit (int) –

  • detector (int) –

  • band (Band) –

as_dict()#

Return CalExpId as a dictionary

Returns:

cal_exp_id – CalExpId information as a dictionary

Return type:

dict

class lsst.cst.visualization.CalExpImageDisplay(cal_exp_data, title=None, xlabel='X', ylabel='Y', show_detections=True, image_options=ImageOptions(cmap='Greys_r', height=600, width=700, xaxis='bottom', yaxis='left', padding=0.01, font_size={'title': '8pt'}, colorbar=True, toolbar='right', show_grid=True, tools=[]))#

Plot using Calexp data, includes the image and also the sources.

Parameters:
  • cal_exp_data (CalExpData) – cal exp data to be plot

  • title (str, Optional) – Plot title. Default value: CalExpId information.

  • xlabel (str, Optional) – Plot xlabel. Default value: ‘X’.

  • ylabel (str, Optional) – Plot ylabel. Default value: ‘Y’.

  • show_detections (bool, Optional) – True if detections should be added to the plot. Default value: True.

  • image_options (ImageOptions, Optional) – Image options.

delete()#

Delete underlying image.

property image#

Underlying image.

Returns:

image – Underlying image used to create the plot.

Return type:

np.ndarray

options#

alias of ImageOptions

rasterize()#

Rasterize the image.

render()#

Render the image.

show()#

Show the image.

property sources#

Exposure sources.

Returns:

sources – Sources from the exposure

Return type:

Tuple[pandas.Series]

property transformed_image#

Underlying transformed image.

Returns:

image – Underlying transformed image shown in the plot.

Return type:

np.ndarray

class lsst.cst.visualization.Collection(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)#

Collections available: - i22: 2.2i/runs/DP0.2 .

class lsst.cst.visualization.Configuration(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)#

Butler configurations available - DP02: dp02.

class lsst.cst.visualization.HTMLSaver(output_dir='/home/runner')#

HTML plot saver

Parameters:

output_dir (str, default: '/home/runner') –

save(plot, filename)#

Save image as html in filename.

Parameters:
  • filename (str) – Name and path of the file where the image will be saved.

  • plot (ImageDisplay | _InteractiveDisplay) –

class lsst.cst.visualization.HoverSources(image_display, options=PointsOptions(fill_color=None, size=9, color='darkorange', marker='o'))#

Interactive display including the sources.

Parameters:
  • options (PointsOptions, Optional) – Display points options.

  • image_display (ImageDisplay) –

options#

alias of PointsOptions

show()#

Show interactive display.

class lsst.cst.visualization.ImageArrayDisplay(image, bounds, title=None, xlabel='X', ylabel='Y', options=ImageOptions(cmap='Greys_r', height=600, width=700, xaxis='bottom', yaxis='left', padding=0.01, font_size={'title': '8pt'}, colorbar=True, toolbar='right', show_grid=True, tools=[]))#

Plot for an ExposureF

Parameters:
  • image (numpy.ndarray) – image array to be show in the plot.

  • title (str) – title of the plot.

  • xlabel (str) – label for the x coordinates.

  • ylabel (str) – label for the y coordinates.

  • options (Options) – Options for the underlying plot object.

  • bounds (tuple[float]) –

property image#

Underlying image.

Returns:

image – Underlying image used to create the plot.

Return type:

np.ndarray

options#

alias of ImageOptions

rasterize()#

Rasterize the image.

render()#

Render the image.

show()#

Show the image.

property sources#

Exposure sources.

Returns:

sources – Sources from the exposure

Return type:

Tuple[pandas.Series]

property transformed_image#

Underlying transformed image.

Returns:

image – Underlying transformed image shown in the plot.

Return type:

np.ndarray

class lsst.cst.visualization.ImageDisplay#

Plot interface image.

delete()#

Delete underlying image.

static from_cal_exp_data(cal_exp_data, title=None, xlabel='X', ylabel='Y', show_detections=True, image_options=ImageOptions(cmap='Greys_r', height=600, width=700, xaxis='bottom', yaxis='left', padding=0.01, font_size={'title': '8pt'}, colorbar=True, toolbar='right', show_grid=True, tools=[]))#

Create a Plot class for CalExpData.

Parameters:
  • cal_exp_data (CalExpData) – exposure instance returned from butler.

  • title (str) – title of the plot.

  • xlabel (str) – label for the x coordinates.

  • ylabel (str) – label for the y coordinates.

  • image_options (ImageOptions) – Options for the underlying plot object.

  • sources_options (PointsOptions) – Options for the underlying sources plot object.

  • show_detections (bool, default: True) –

Returns:

results – Plot instance for the exposureF including sources.

Return type:

Plot

static from_image_array(image, bounds, title='No title', xlabel='X', ylabel='Y', image_options=ImageOptions(cmap='Greys_r', height=600, width=700, xaxis='bottom', yaxis='left', padding=0.01, font_size={'title': '8pt'}, colorbar=True, toolbar='right', show_grid=True, tools=[]))#

Create a Plot class for the exposureF image.

Parameters:
  • image (numpy.array) – image to be plotted.

  • bounds (tuple[float]) – image bounds.

  • title (str) – title of the plot.

  • xlabel (str) – label for the x coordinates.

  • ylabel (str) – label for the y coordinates.

  • image_options (ImageOptions) – Options for the underlying plot object.

Returns:

results – Plot instance for the exposureF

Return type:

Plot

abstract property image#

Underlying image.

Returns:

image – Underlying image used to create the plot.

Return type:

np.ndarray

abstract rasterize()#

Rasterize the image.

abstract render()#

Render the image.

abstract show()#

Show the image.

abstract property sources#

Exposure sources.

Returns:

sources – Sources from the exposure

Return type:

Tuple[pandas.Series]

property transformed_image#

Underlying transformed image.

Returns:

image – Underlying transformed image shown in the plot.

Return type:

np.ndarray

class lsst.cst.visualization.ImageOptions(cmap='Greys_r', height=600, width=700, xaxis='bottom', yaxis='left', padding=0.01, font_size=<factory>, colorbar=True, toolbar='right', show_grid=True, tools=<factory>)#

Image plot options.

Parameters:
  • cmap (str) – sets the colormap of the image, for example: Greys_r, viridis, plasma, inferno, magma, cividis or rainbow.

  • height (int) – Height of the plot in pixels.

  • width (int) – Width of the plot in pixels.

  • xaxis (str) – Position of the xaxis ‘bottom’, ‘top’.

  • yaxis (str) – Position of the yaxis.

  • padding (float) – space around the plot.

  • font_size (dict) – Font size for axis labels, titles, and legend.

  • colorbar (bool) – adds a colorbar to the plot.

  • toolbar (str) – toolbar position ‘left’, ‘right’, ‘above’, bellow’.

  • show_grid (bool) – displays grid lines on the plot.

  • tools (list) – List of Bokeh tools to include to the default ones. []

to_dict()#

Returns a dictionary with the keys as option name and the values as the option value.

class lsst.cst.visualization.OnClickInteract(image_display, options=OnClickInteractOptions(color='white', marker='x', size=20))#

Interactive display with a tap tool to show extra information.

Parameters:
options#

alias of OnClickInteractOptions

show()#

Show interactive display.

class lsst.cst.visualization.Options#

Interface with the indispensable methods of how an Option class should act like.

abstract to_dict()#

Returns a dictionary with the keys as option name and the values as the option value.