This repository has been archived by the owner on Mar 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
processing.py
Andrew Player edited this page Aug 17, 2022
·
1 revision
Created By: Andrew Player
File Name: processing.py
Date Created: 01-25-2021
Description: Functions for the pre and post-processing of interferogram arrays
tile(
arr: ndarray,
tile_shape: Tuple[int, int],
crop_size: int = 0,
x_offset: int = 0,
y_offset: int = 0,
even_pad: bool = False,
pad_value: float = 0.0
) → Tuple[ndarray, int, int]
Tile a 2-dimensional array into an array of tiles of shape tile_shape.
-
arr
:np.ndarray
The 2-dimensional array that should be tiled. -
tile_shape
:tuple(int, int)
The desired shape of the tiles: (row length, column length). This should match the input shape of the model. -
crop_size
:int, Optional
An extra amount of padding to maintain full array coverage when the model will crop the tiles later. This amount should be equal to the shape of the output tiles from the model. -
x_offset
:int, Optional
Offset the tiling process by this amount in the columns direction. -
y_offset
:int, Optional
Offset the tiling process by this amount in the row direction. -
even_pad
:bool, Optional
If True, the array will be padded symmetrically; else, it will be padded on the end of each dimension. -
pad_value
:float, Optional
The value to fill the padded areas of the array with.
-
tiles
:np.ndarray
The array of tiles. -
num_rows
:int
The number of rows of tiles. -
num_cols
:int
The number of columns of tiles.
pad(
arr: ndarray,
tile_shape: Tuple[int, int],
value: float = 0.0,
extra_padding: int = 0,
even_pad: bool = False
) → ndarray
Pad an array with a given value so that it can be tiled.
-
arr
:np.ndarray
The array that should be padded. -
tile_shape
:tuple(int, int)
A tuple representing the shape of the tiles (rows, columns) to pad for. -
value
:float, Optional
The value that should fill the padded area. -
extra_pad
:int, Optional
An extra amount of padding to add to each dimension. -
even_padding
:bool, Optional
If True, the array will be padded symmetrically; else, it will be padded on the end of each dimension.
-
arr_padded
:np.ndarray
The padded array.
simulate_unet_cropping(arr: ndarray, crop_shape: tuple) → ndarray
Symmetrically crop the inputed array.
-
arr
:np.ndarray
The 2-dimensional interferogram array to be cropped. -
crop_shape
:tuple
The length of the rows and columns after being cropped, respectively. If the crop_shape in a direction does not divide 2, the extra value will be placed on the 0 side. This should match the models output shape.
-
cropped_arr
:np.ndarray
The cropped interferogram array.
tiles_to_image(
arr: ndarray,
rows: int,
cols: int,
original_shape: Tuple[int, int]
) → ndarray
Stich an array of 2-dimensional tiles into a single 2-dimensional array.
-
arr
:np.ndarray(shape=(rows*cols, tile_size, tile_size))
The array of tiles to be stiched together. -
rows
:int
The number of tiles that should go in the row direction. -
cols
:int
The number of tiles that should go in the column direction. -
original_shape
:Tuple[int, int]
The shape of the interferogram before any processing. -
cropped
:bool
Set to True if the model has cropping, else leave it as False. -
tiling_size
:int
If the model was cropped, set this to the original tile size, else leave this false.
-
rebuilt_arr
:np.ndarray(shape=(rows*tile_size, cols*tile_size))
The stiched 2-dimensional array.
This file was automatically generated via andrewplayer3's fork of lazydocs.