gelsa.visu#

Functions

colorize_image(image[, hue, saturation])

Colorize an image map.

filter_image(image, masked_pix[, iter, ...])

Process the image with an iterative median filter.

make_color_image(r, g, b[, brightness])

Creates a color composite with rgb channels and optional brigtness value

make_image_composite(image_rgb, image_overlay)

Overlay two rgb images.

median_filter_image(image[, filter_size, tilt])

Apply median filter to the image

normalize_image(x[, var, mask, levels, ...])

Normalize an image with power.

plot_detectors_focal_plane(frame, **plotparams)

plot_detectors_sky(frame, **plotparams)

rank_transform(image)

show([image, mask, var, crop, axes, levels, ...])

Display an image with matplotlib

trace1d(image[, mask, var, axis])

Make simple 1D trace of the 2D image

gelsa.visu.filter_image(image, masked_pix, iter=1, median_window=3)[source]#

Process the image with an iterative median filter.

Bad pixels are repaired iteratively by replacing them with the values from the median filtered image.

The kernel size is set by the median_window class variable.

Parameters:
Returns:

processed image

Return type:

numpy.ndarray

gelsa.visu.show(image=None, mask=None, var=None, crop=None, axes=None, levels=(10, 80), vmin_offset=200, infill=False, label_wavelength_step=500, colorbar=False, slice=None, extent=None, **params)[source]#

Display an image with matplotlib

gelsa.visu.trace1d(image, mask=None, var=None, axis=0, **params)[source]#

Make simple 1D trace of the 2D image

gelsa.visu.normalize_image(x, var=None, mask=None, levels=(10, 99.95), vmin=None, vmax=None, power=0.5, return_levels=False)[source]#

Normalize an image with power. Applies percentile clipping.

Parameters:
  • x

  • levels

  • power

Return type:

numpy.ndarray

gelsa.visu.make_color_image(r, g, b, brightness=None, **kwargs)[source]#

Creates a color composite with rgb channels and optional brigtness value

The color image is made with astropy.visualization.make_lupton_rgb.

If a brightness image is passed, it is used to set the value in the hsv color space. It should be normalized to the range [0, 1].

Parameters:
  • r (numpy.array)

  • g (numpy.array)

  • b (numpy.array)

  • brightness (numpy.array)

  • stretch (float) – argument for astropy make_lupton_rgb

  • Q (float) – argument for astropy make_lupton_rgb

Return type:

numpy.array

gelsa.visu.colorize_image(image, hue=0, saturation=1)[source]#

Colorize an image map. The image array should be normalized in the range [0, 1]

Parameters:
  • image (numpy.ndarray) – image map (2D array)

  • hue (float) – Hue value, in the range [0, 1]

  • saturation (float) – Saturation value, in the range [0, 1]

Return type:

numpy.ndarray

gelsa.visu.make_image_composite(image_rgb, image_overlay, alpha_power=1, alpha=0.7)[source]#

Overlay two rgb images. The brightness of image_overlay is used for the mask.

Parameters:
  • image_rgb (numpy.ndarray) – base rgb image

  • image_overlay (numpy.ndarray) – rgb image to overlay

  • alpha_power (float) – exponent for the alpha map

  • alpha (float) – opacity value in the range 0 transparent to 1 opaque.

Return type:

numpy.ndarray

gelsa.visu.median_filter_image(image, filter_size=40, tilt=0)[source]#

Apply median filter to the image