API Reference#

Array#

array(object[, dtype, mask, requires_grad])

Create a multidimensional array.

Array creation#

asarray(a[, dtype, mask, requires_grad])

Convert the input to an array.

ones(shape[, dtype, requires_grad])

Return a new array with values set to ones.

ones_like(a[, dtype, requires_grad])

Return a new array of ones with the same shape and type as a given array.

zeros(shape[, dtype, requires_grad])

Return a new array with values set to zeros.

zeros_like(a[, dtype, requires_grad])

Return a new array of zeros with the same shape and type as a given array.

rand([low, high, size, dtype, requires_grad])

Return a new array with values drawn from a uniform distribution.

randn([loc, std, size, dtype, requires_grad])

Return a new array with values drawn from a normal distribution.

Functions#

Math operations#

add(x1, x2)

Add arrays element-wise.

subtract(x1, x2)

Subtract arrays element-wise.

multiply(x1, x2)

Multiply arrays element-wise.

power(x1, x2)

First array elements raised to powers from second array, element-wise.

exp(x)

Calculate the exponential of the input array.

expc(x)

Calculate the exponential of the input array * 1j.

sum(x)

Sum of array elements.

absolute_square(x)

Calculate the absolute value squared, element-wise.

dft2(x, alpha[, shape, shift, offset, ...])

Compute the 2-dimensional discrete Fourier Transform.

einsum(subscripts, *operands[, dtype])

Evaluates the Einstein summation convention on the operands.

tensordot(a, b[, axes])

Compute tensor dot product along specified axes.

rebin(x, bin_shape)

Rebin an array.

Array manipulation#

slice(x, slc)

Return a slice of the input array.

Cost functions#

sserror(model, data[, mask, gain_bias_invariant])

Compute the normalized sum squared error between two arrays.

Function API#

core.Function(*inputs)

Base class for representing functions that operate on array objects.

Optimization#

optimize(fun, params[, ftol, gtol, maxiter, ...])

Minimize a scalar function of one or more variables using the L-BFGS-B algorithm.

Utilities#

Shapes#

circle(shape, radius[, shift])

Compute a circle with anti-aliasing.

circlemask(shape, radius[, shift])

Compute a circular mask.

hexagon(shape, radius[, rotate])

Compute a hexagon mask.

slit(shape, width)

Compute a horizontal slit mask.

Image tools#

centroid(img)

Compute image centroid location.

medfix2(input, mask[, kernel])

Fix masked entries in a 2-dimensional array via median filtering.

shift(a, shift)

Shift an array via FFT.

register(arr, ref, oversample[, return_error])

Compute the subpixel image translation to register the input array to a reference array.

Zernike polynomials#

zernike(mask, index[, normalize, rho, theta])

Compute the circular Zernike polynomial for a given mask.

zernike_basis(mask, modes[, vectorize, ...])

Compute a Zernike basis set for a given mask.

zernike_compose(mask, coeffs[, normalize, ...])

Create an OPD based on the supplied Zernike coefficients.

zernike_fit(opd, mask, modes[, normalize, ...])

Fit a Zernike basis set to an OPD.

zernike_remove(opd, mask, modes[, rho, theta])

Fit and remove a Zernike basis set from an OPD.

zernike_coordinates(mask[, shift, rotate])

Compute the Zernike coordinate system for a given mask.