scarlet.display

class scarlet.display.AsinhPercentileNorm(img, percentiles=[1, 99])[source]

Bases: AsinhMapping

Methods

intensity(image_r, image_g, image_b)

Return the total intensity from the red, blue, and green intensities.

make_rgb_image(image_r, image_g, image_b)

Convert 3 arrays, image_r, image_g, and image_b into an 8-bit RGB image.

map_intensity_to_uint8(I)

Return an array which, when multiplied by an image, returns that image mapped to the range of a uint8, [0, 255] (but not converted to uint8).

class scarlet.display.LinearPercentileNorm(img, percentiles=[1, 99])[source]

Bases: LinearMapping

Methods

intensity(image_r, image_g, image_b)

Return the total intensity from the red, blue, and green intensities.

make_rgb_image(image_r, image_g, image_b)

Convert 3 arrays, image_r, image_g, and image_b into an 8-bit RGB image.

map_intensity_to_uint8(I)

Return an array which, when multiplied by an image, returns that image mapped to the range of a uint8, [0, 255] (but not converted to uint8).

scarlet.display.channels_to_rgb(channels)[source]

Get the linear mapping of multiple channels to RGB channels The mapping created here assumes the the channels are ordered in wavelength direction, starting with the shortest wavelength. The mapping seeks to produce a relatively even weights for across all channels. It does not consider e.g. signal-to-noise variations across channels or human perception. Parameters ———- channels: int in range(0,7)

Number of channels

Returns

array (3, channels) to map onto RGB

scarlet.display.get_extent(bbox)[source]
scarlet.display.img_to_3channel(img, channel_map=None, fill_value=0)[source]

Convert multi-band image cube into 3 RGB channels Parameters ———- img: array_like

This should be an array with dimensions (channels, height, width).

channel_map: array_like

Linear mapping with dimensions (3, channels)

fill_value: float, default=`0`

Value to use for any masked pixels.

Returns

RGB: numpy array with dtype float

scarlet.display.img_to_rgb(img, channel_map=None, fill_value=0, norm=None, mask=None)[source]

Convert images to normalized RGB. If normalized values are outside of the range [0..255], they will be truncated such as to preserve the corresponding color. Parameters ———- img: array_like

This should be an array with dimensions (channels, height, width).

channel_map: array_like

Linear mapping with dimensions (3, channels)

fill_value: float, default=`0`

Value to use for any masked pixels.

norm: scarlet.display.Norm, default None

Norm to use for mapping in the allowed range [0..255]. If norm=None, scarlet.display.LinearPercentileNorm will be used.

mask: array_like

A [0,1] binary mask to apply over the top of the image, where pixels with mask==1 are masked out.

Returns

rgb: numpy array with dimensions (3, height, width) and dtype uint8

scarlet.display.show_likelihood(blend, figsize=None, **kwargs)[source]
scarlet.display.show_observation(observation, norm=None, channel_map=None, sky_coords=None, show_psf=False, add_labels=True, figsize=None)[source]

Plot observation in standardized form.

scarlet.display.show_scene(sources, observation=None, norm=None, channel_map=None, show_model=True, show_observed=False, show_rendered=False, show_residual=False, add_labels=True, add_boxes=False, figsize=None, linear=True)[source]

Plot all sources to recreate the scence. The functions provides a fast way of evaluating the quality of the entire model, i.e. the combination of all scences that seek to fit the observation. Parameters ———- sources: list of source models observation: ~scarlet.Observation norm: norm to compress image intensity to the range [0,255] channel_map: array_like

Linear mapping with dimensions (3, channels)

show_model: bool

Whether the model is shown in the model frame

show_observed: bool

Whether the observation is shown

show_rendered: bool

Whether the model, rendered to match the observation, is shown

show_residual: bool

Whether the residuals between rendered model and observation is shown

add_label: bool

Whether each source is labeled with its numerical index in the source list

add_boxes: bool

Whether each source box is shown

figsize: matplotlib figsize argument linear: bool

Whether or not to display the scene in a single line (True) or on multiple lines (False).

Returns

matplotlib figure

scarlet.display.show_sources(sources, observation=None, norm=None, channel_map=None, show_model=True, show_observed=False, show_rendered=False, show_spectrum=True, figsize=None, model_mask=None, add_markers=True, add_boxes=False)[source]

Plot each source individually. The functions provides an more detailed inspection of every source in the list. Parameters ———- sources: list of source models observation: ~scarlet.Observation norm: norm to compress image intensity to the range [0,255] channel_map: array_like

Linear mapping with dimensions (3, channels)

show_model: bool

Whether the model is shown in the model frame

show_observed: bool

Whether the observation is shown

show_rendered: bool

Whether the model, rendered to match the observation, is shown

show_spectrum: bool

Whether source specturm is shown. For multi-component sources, spectra are shown separately.

figsize: matplotlib figsize argument model_mask: array

Mask used to hide pixels in the model only.

add_markers: bool

Whether or not to mark the centers of the sources with their source number.

add_boxes: bool

Whether source boxes are shown

Returns

matplotlib figure