taufactor.utils
Functions
|
Create a voxelized representation of a sphere in 3D array based on given midpoint and radius in terms of pixel resolution. |
|
Compute impedance given resistor and capacitor arrays. |
|
R, C: arrays of shape (bs, Nx) freq: array of shape (F,) or (bs, F) Returns: Z of shape (bs, F) |
|
Create a 2D diagonal pattern extruded in z. |
|
Create mirrored 2D diagonal channels (zigzag) extruded in z. |
|
Create a 3D diagonal pattern. |
|
Create a voxelized FCC unit cell structure in a cube with given pixel resolution and overlap of the spheres. |
|
Create stacked blocks with alternating half-block shifts in y and z. |
|
|
|
Plots the flux direction of the image and provides code for transposing the image to change the flux direction :param im: segmented input image with n phases :return: None |
|
|
|
Return theoretical metrics of FCC unit cell structure. |
- taufactor.utils.add_voxel_sphere(array, center_x, center_y, center_z, radius)[source]
Create a voxelized representation of a sphere in 3D array based on given midpoint and radius in terms of pixel resolution.
- taufactor.utils.compute_impedance(R, C, freq)[source]
Compute impedance given resistor and capacitor arrays. This is under the assumption of an excitation with amplitude 1 at the left boundary and zero flux at the right boundary (closed Warburg)
- taufactor.utils.compute_impedance_batched(R, C, freq)[source]
R, C: arrays of shape (bs, Nx) freq: array of shape (F,) or (bs, F) Returns: Z of shape (bs, F)
- taufactor.utils.create_2d_diagonals(Nx, features=1)[source]
Create a 2D diagonal pattern extruded in z.
- taufactor.utils.create_2d_zigzag(Nx, features=1)[source]
Create mirrored 2D diagonal channels (zigzag) extruded in z.
- taufactor.utils.create_fcc_cube(pixels, overlap=0.0)[source]
Create a voxelized FCC unit cell structure in a cube with given pixel resolution and overlap of the spheres.
- Parameters:
pixels (int) – Cube/Array side length given in pixels.
overlap (float) – Overlap of neighbouring spheres given in percent. 1 corresponds to radius = distance between midpoints.
- Returns:
3D array where values of 1 represent the FCC structure.
- Return type:
numpy.ndarray
- taufactor.utils.create_stacked_blocks(Nx, features=1)[source]
Create stacked blocks with alternating half-block shifts in y and z.
The x-direction is divided into rows of block thickness
feature_size. Every second x-row is shifted by half a block in y and z, producing a staggered (brick-like) arrangement in the yz-plane.
- taufactor.utils.flux_direction(im, outpath=None)[source]
Plots the flux direction of the image and provides code for transposing the image to change the flux direction :param im: segmented input image with n phases :return: None
- taufactor.utils.theoretical_fcc_metrics(a, overlap)[source]
Return theoretical metrics of FCC unit cell structure. Notation consistent with https://en.wikipedia.org/wiki/Spherical_cap