AutoCutsBase

class ginga.AutoCuts.AutoCutsBase(logger)[source]

Bases: object

Base class for auto cuts algorithms.

Methods Summary

calc_cut_levels(image)

Calculate the cut levels of an image according to the parameters.

calc_cut_levels_data(data_np)

Calculate the cut levels of a ndarray according to the parameters.

cut_levels(data_np, loval, hival[, vmin, vmax])

Apply the cut levels to data.

get_algorithms()

Return the list of autocuts algorithms.

get_autocut_levels(image)

Calculate the cut levels of an image according to the parameters.

get_crop(image[, crop_radius])

Get a cropped region of data from an image.

get_crop_data(data[, crop_radius])

Get a cropped region of data from a ndarray.

get_full(image[, px_limit])

Get the full (or cropped) array of data from an image.

get_params_metadata()

get_sample(image[, num_points])

Return a sample from the full data array of the passed image.

get_sample_data(data[, num_points])

Return a sample from a data array.

update_params(**param_dict)

Methods Documentation

calc_cut_levels(image)[source]

Calculate the cut levels of an image according to the parameters.

Parameters:
imagesubclass of BaseImage

Image object from which the cut levels should be calculated

Returns:
cut_levelstuple of float (loval, hival)

The cut levels that were calculated

calc_cut_levels_data(data_np)[source]

Calculate the cut levels of a ndarray according to the parameters.

Parameters:
data_npndarray

A numpy array of data from which the cut levels should be calculated

Returns:
cut_levelstuple of float (loval, hival)

The cut levels that were calculated

cut_levels(data_np, loval, hival, vmin=0.0, vmax=255.0)[source]

Apply the cut levels to data.

Parameters:
data_npndarray

A numpy array of data to which the cut levels should be applied

lovalfloat

The low cut level

hivalfloat

The high cut level

vminfloat (optional, default 0.0)

The floor of the range which is the output of the cut levels

vmaxfloat (optional, default 255.0)

The ceiling of the range which is the output of the cut levels

Returns:
resultndarray

The result of applying the cut levels to the input array

get_algorithms()[source]

Return the list of autocuts algorithms.

Parameters:
None
Returns:
names: tuple of str

The names of the autocut algorithms

get_autocut_levels(image)

Calculate the cut levels of an image according to the parameters.

Parameters:
imagesubclass of BaseImage

Image object from which the cut levels should be calculated

Returns:
cut_levelstuple of float (loval, hival)

The cut levels that were calculated

get_crop(image, crop_radius=None)[source]

Get a cropped region of data from an image.

Parameters:
imagesubclass of BaseImage

Image object from which the cut levels should be calculated

crop_radiusint (optional, default None)

The radius of a crop region to extract from the image. If None, then the radius will default to the crop_radius attribute.

Returns:
resultndarray

The cropped data

get_crop_data(data, crop_radius=None)[source]

Get a cropped region of data from a ndarray.

Parameters:
datandarray

Image data from which the data should be cropped

crop_radiusint (optional, default None)

The radius of a crop region to extract from the image data. If None, then the radius will default to the crop_radius attribute.

Returns:
resultndarray

The cropped data

get_full(image, px_limit=None)[source]

Get the full (or cropped) array of data from an image.

Parameters:
imagesubclass of BaseImage

Image object from which the cut levels should be calculated

px_limitint (optional, default None)

The limit for extracting the full image data. If the number of pixels in the data is larger than this value, a crop from the data will be used instead.

Returns:
resultndarray

The (possibly cropped) data

classmethod get_params_metadata()[source]
get_sample(image, num_points=None)[source]

Return a sample from the full data array of the passed image.

Parameters:
imagesubclass of BaseImage

Image object from which the cut levels should be calculated

num_pointsint (optional, default None)

Specifies the number of points to sample. If None, the number pixels will be calculated to a “reasonable representative sample”.

Returns:
resultndarray

The sampled data

get_sample_data(data, num_points=None)[source]

Return a sample from a data array.

Parameters:
datandarray

Image data from which the data should be sampled

num_pointsint (optional, default None)

Specifies the number of points to sample. If None, the number pixels will be calculated to a “reasonable representative sample”.

Returns:
resultndarray

The sampled data

update_params(**param_dict)[source]