acryo.backend package
Module contents
- class acryo.backend.AnyArray[source]
Bases:
Generic
[_T
]Type representing a ndarray of numpy or cupy (or any other array that has similar API).
- property dtype: dtype[_T]
- max(axis: None = None) _T
- max(axis: int | tuple[int, ...]) AnyArray[_T]
Helper for @overload to raise when called.
- mean(axis: None = None) _T
- mean(axis: int | tuple[int, ...]) AnyArray[_T]
Helper for @overload to raise when called.
- property ndim: int
- property shape: tuple[int, ...]
- class acryo.backend.Backend(name: str | None = None)[source]
Bases:
object
- affine_transform(img, matrix, output_shape: tuple[int, ...] | None = None, output=None, order: int = 3, mode: str = 'constant', cval: float = 0.0, prefilter: bool = True) AnyArray[float32] [source]
Affine transform.
- arange(*args, dtype: type[_T], **kwargs) AnyArray[_T] [source]
- arange(*args, dtype: None = None, **kwargs) AnyArray
Return evenly spaced values within a given interval.
- argmax(x: AnyArray[_T], axis: None = None) int64 [source]
- argmax(x: AnyArray[_T], axis: int | tuple[int, ...]) AnyArray[int64]
- argmin(x: AnyArray[_T], axis: None = None) int64 [source]
- argmin(x: AnyArray[_T], axis: int | tuple[int, ...]) AnyArray[int64]
- array(x, dtype: type[_T] | dtype[_T]) AnyArray[_T] [source]
- array(x: AnyArray[_T] | ndarray[tuple[int, ...], dtype[_T]], dtype: None = None) AnyArray[_T]
Convert to numpy array.
- asarray(x, dtype: type[_T] | dtype[_T]) AnyArray[_T] [source]
- asarray(x: AnyArray[_T] | ndarray[tuple[int, ...], dtype[_T]], dtype: None = None) AnyArray[_T]
Convert to numpy array.
- asnumpy(x: AnyArray[_T] | ndarray[tuple[int, ...], dtype[_T]]) ndarray[tuple[int, ...], dtype[_T]] [source]
Convert to numpy array.
- fftfreq(n: int, d: float = 1.0) AnyArray[np.float_] [source]
Return the Discrete Fourier Transform sample frequencies.
- fftn(x: AnyArray[float32] | AnyArray[complex64], s: tuple[int, int, int] | None = None, axes: int | tuple[int, ...] | None = None) AnyArray[complex64] [source]
N-dimensional FFT.
- fftshift(x: AnyArray[_T], axes=None) AnyArray[_T] [source]
Shift zero-frequency component to center.
- full(shape: int | tuple[int, ...], fill_value: Any, dtype: type[_T] | dtype[_T] | None = None) AnyArray[_T] [source]
Return a new array of given shape and type, filled with fill_value.
- ifftn(x: AnyArray[float32] | AnyArray[complex64], s: tuple[int, int, int] | None = None, axes: int | tuple[int, ...] | None = None) AnyArray[complex64] [source]
N-dimensional inverse FFT.
- ifftshift(x: AnyArray[_T], axes=None) AnyArray[_T] [source]
Inverse shift zero-frequency component to center.
- indices(shape: tuple[int], dtype: type[_T] = np.int32) tuple[AnyArray[_T]] [source]
- indices(shape: tuple[int, int], dtype: type[_T] = np.int32) tuple[AnyArray[_T], AnyArray[_T]]
- indices(shape: tuple[int, int, int], dtype: type[_T] = np.int32) tuple[AnyArray[_T], AnyArray[_T], AnyArray[_T]]
- indices(shape: tuple[int, ...], dtype: type[_T] = np.int32) tuple[AnyArray[_T], ...]
Return an array representing the indices of a grid.
- irfftn(x: AnyArray[complex64], s: tuple[int, int, int] | None = None, axes: int | tuple[int, ...] | None = None) AnyArray[float32] [source]
N-dimensional inverse FFT of real part.
- linspace(start, stop, num: int, endpoint: bool, dtype: None = None) AnyArray [source]
- linspace(start, stop, num: int, endpoint: bool, dtype: type[_T]) AnyArray[_T]
Return evenly spaced numbers over a specified interval.
- lowpass_filter(img, cutoff, order: int = 2) AnyArray[float32] [source]
Lowpass filter in real space.
- lowpass_filter_ft(img, cutoff, order: int = 2) AnyArray[complex64] [source]
Lowpass filter in Fourier space.
- map_coordinates(x: AnyArray[_T], coords: AnyArray[_T], order: int = 3, mode: str = 'constant', cval: float = -1.0, prefilter: bool = True) AnyArray[_T] [source]
- max(x: AnyArray[_T], axis: None = None) _T [source]
- max(x: AnyArray[_T], axis: int | tuple[int, ...]) AnyArray[_T]
Return the maximum of an array or maximum along an axis.
- mean(x: AnyArray[_T], axis: None = None) _T [source]
- mean(x: AnyArray[_T], axis: int | tuple[int, ...]) AnyArray[_T]
Return the mean of array elements over a given axis.
- meshgrid(*xi: AnyArray[_T], copy: bool = True, sparse: bool = False, indexing: Literal['xy', 'ij'] = 'xy') tuple[AnyArray[_T], ...] [source]
Return coordinate matrices from coordinate vectors.
- min(x: AnyArray[_T], axis: None = None) _T [source]
- min(x: AnyArray[_T], axis: int | tuple[int, ...]) AnyArray[_T]
Return the minimum of an array or minimum along an axis.
- missing_wedge_mask(rotator: Rotation, tilt_range: tuple[float, float], shape: tuple[int, int, int])[source]
- property name: str
- pad(x: AnyArray[_T], pad_width: int | Sequence[int] | Sequence[tuple[int, int]], mode: str = 'constant', **kwargs) AnyArray[_T] [source]
Pad an array.
- percentile(x: AnyArray[_T], q: float, axis: None = None) _T [source]
- percentile(x: AnyArray[_T], q: float, axis: int | tuple[int, ...]) AnyArray[_T]
Compute the q-th percentile of the data along the specified axis.
- rfftn(x: AnyArray[float32], s: tuple[int, int, int] | None = None, axes: int | tuple[int, ...] | None = None) AnyArray[complex64] [source]
N-dimensional FFT of real part.
- rotated_crop(subimg, mtx: ndarray[tuple[int, ...], dtype[float32]], shape: tuple[int, int, int], order: int, cval: float | Callable[[AnyArray[float32]], Any]) AnyArray[float32] [source]
- spline_filter(input, order: int = 3, output: type[~acryo.backend._api._T] = <class 'numpy.float64'>, mode: str = 'mirror') AnyArray[_T] [source]
- stack(arrays: Sequence[AnyArray[_T]], axis: int = 0) AnyArray[_T] [source]
Stack arrays in sequence along a new axis.
- sum(x: AnyArray[_T], axis: None = None) _T [source]
- sum(x: AnyArray[_T], axis: int | tuple[int, ...]) AnyArray[_T]
Return the sum of array elements over a given axis.
- sum_labels(arr: AnyArray[_T], labels: AnyArray[uint16], index: AnyArray[uint16]) AnyArray[uint16] [source]
- tensordot(a: AnyArray[_T], b: AnyArray[_T], axes: int | tuple[int, ...] = 2) AnyArray[_T] [source]
Return tensor dot product of two arrays.
- acryo.backend.build_mesh(shape: tuple[int, ...], max_shifts: tuple[float, ...], upsample: int, backend: Backend) AnyArray[float32] [source]
Build a meshgrid for up-sampling.
- Parameters:
shape (tuple[int, int, int]) – Shape of the original volume from which up-sampling will be applied.
max_shifts (tuple[float, float, float]) – Maximum shifts in each direction in pixel.
upsample (int) – Up-sampling factor.