Image Array Manipulation and Convolution (scipy.stsci)¶

Image Array manipulation Functions (scipy.stsci.image)¶

 average (arrays[, output, outtype, ...]) average() nominally computes the average pixel value for a stack of identically shaped images. combine median (arrays[, output, outtype, ...]) median() nominally computes the median pixels for a stack of identically shaped images. minimum (arrays[, output, outtype, ...]) minimum() nominally computes the minimum pixel value for a stack of identically shaped images. threshhold (arrays[, low, high, outputs]) threshhold() computes a boolean array ‘outputs’ with corresponding elements for each element of arrays. The boolean value is true where each of the arrays values is < the low or >= the high threshholds. translate (a, sdx, sdy[, output, mode, cval]) translate performs a translation of ‘a’ by (sdx, sdy) storing the result in ‘output’.

Image Array Convolution Functions (scipy.stsci.convolve)¶

 boxcar (data, boxshape[, output, mode, cval]) boxcar computes a 1D or 2D boxcar filter on every 1D or 2D subarray of data. convolution_modes () -> new empty dictionary. dict(mapping) -> new dictionary initialized from a mapping object’s (key, value) pairs. dict(seq) -> new dictionary initialized as if via: d , v in seq: d[k] = v dict(**kwargs) -> new dictionary initialized with the name, ...]) convolve (data, kernel[, mode]) convolve(data, kernel, mode=FULL) Returns the discrete, linear convolution of 1-D sequences a and v; mode can be 0 (VALID), 1 (SAME), or 2 (FULL) to specify size of the resulting sequence. convolve2d (data, kernel[, output, mode, cval, ...]) convolve2d does 2d convolution of ‘data’ with ‘kernel’, storing the result in ‘output’. correlate (data, kernel[, mode]) ```>>> correlate(np.arange(8), [1, 2], mode=VALID) array([ 2, 5, 8, 11, 14, 17, 20]) >>> correlate(np.arange(8), [1, 2], mode=SAME) array([ 0, 2, 5, 8, 11, 14, 17, 20]) >>> correlate(np.arange(8), [1, 2], mode=FULL) array([ 0, 2, 5, 8, 11, 14, 17, 20, 7]) >>> correlate(np.arange(8), [1, 2, 3], mode=VALID) array([ 8, 14, 20, 26, 32, 38]) >>> correlate(np.arange(8), [1, 2, 3], mode=SAME) array([ 3, 8, 14, 20, 26, 32, 38, 20]) >>> correlate(np.arange(8), [1, 2, 3], mode=FULL) array([ 0, 3, 8, 14, 20, 26, 32, 38, 20, 7]) >>> correlate(np.arange(8), [1, 2, 3, 4, 5, 6], mode=VALID) array([ 70, 91, 112]) >>> correlate(np.arange(8), [1, 2, 3, 4, 5, 6], mode=SAME) array([ 17, 32, 50, 70, 91, 112, 85, 60]) >>> correlate(np.arange(8), [1, 2, 3, 4, 5, 6], mode=FULL) array([ 0, 6, 17, 32, 50, 70, 91, 112, 85, 60, 38, 20, 7]) >>> correlate(np.arange(8), 1+1j) Traceback (most recent call last): ... TypeError: array cannot be safely cast to required type ``` correlate2d (data, kernel[, output, mode, cval, ...]) correlate2d does 2d correlation of ‘data’ with ‘kernel’, storing the result in ‘output’. cross_correlate (data, kernel[, mode]) ```>>> correlate(np.arange(8), [1, 2], mode=VALID) array([ 2, 5, 8, 11, 14, 17, 20]) >>> correlate(np.arange(8), [1, 2], mode=SAME) array([ 0, 2, 5, 8, 11, 14, 17, 20]) >>> correlate(np.arange(8), [1, 2], mode=FULL) array([ 0, 2, 5, 8, 11, 14, 17, 20, 7]) >>> correlate(np.arange(8), [1, 2, 3], mode=VALID) array([ 8, 14, 20, 26, 32, 38]) >>> correlate(np.arange(8), [1, 2, 3], mode=SAME) array([ 3, 8, 14, 20, 26, 32, 38, 20]) >>> correlate(np.arange(8), [1, 2, 3], mode=FULL) array([ 0, 3, 8, 14, 20, 26, 32, 38, 20, 7]) >>> correlate(np.arange(8), [1, 2, 3, 4, 5, 6], mode=VALID) array([ 70, 91, 112]) >>> correlate(np.arange(8), [1, 2, 3, 4, 5, 6], mode=SAME) array([ 17, 32, 50, 70, 91, 112, 85, 60]) >>> correlate(np.arange(8), [1, 2, 3, 4, 5, 6], mode=FULL) array([ 0, 6, 17, 32, 50, 70, 91, 112, 85, 60, 38, 20, 7]) >>> correlate(np.arange(8), 1+1j) Traceback (most recent call last): ... TypeError: array cannot be safely cast to required type ``` dft iraf_frame pix_modes () -> new empty dictionary. dict(mapping) -> new dictionary initialized from a mapping object’s (key, value) pairs. dict(seq) -> new dictionary initialized as if via: d , v in seq: d[k] = v dict(**kwargs) -> new dictionary initialized with the name, ...])