-
Notifications
You must be signed in to change notification settings - Fork 1
io.py
Created By: Andrew Player
File Name: io.py
Date Created: 05-01-2022
Description: Functions to handle file read/write.
save_dataset(save_path: Path, mask: ndarray, wrapped: ndarray) → None
Saves event-mask and wrapped ndarrays to a single .npz file.
load_dataset(load_path: Path) → Tuple[ndarray, ndarray]
Loads event-mask and wrapped ndarrays from .npz file.
-
load_path
:Path
The path to the data example that should be loaded.
-
mask
:np.ndarray
The array of the event-mask loaded from the .npz. -
wrapped
:np.ndarray
The array of the wrapped interferogram loaded from the .npz.
create_directories() → None
Creates the directories for storing our data.
get_image_array(image_path: str) → ndarray
Load a interferogram .tif from storage into an array.
-
image_path
:str
The path to the interferogram .tif to be opened.
-
arr
:np.ndarray
The interferogram array.
get_dataset_arrays(product_path: str) → Tuple[ndarray, ndarray, ndarray]
Load wrapped, unwrapped, and correlation .tifs from storage into arrays.
-
product_path
:str
The path to the InSAR product folder containing the images.
-
wrapped
:np.ndarray
The array of the wrapped interferogram loaded from the .tif. -
unwrapped
:np.ndarray
The array of the unwrapped interferogram loaded from the .tif. -
correlation
:np.ndarray
The correlation map array loaded from the .tif,
get_product_arrays(product_path: str) → Tuple[ndarray, ndarray, ndarray]
Load wrapped, unwrapped, and correlation .tifs from storage into arrays.
-
product_path
:str
The path to the InSAR product folder containing the images.
-
wrapped
:np.ndarray
The array of the wrapped interferogram loaded from the .tif. -
unwrapped
:np.ndarray
The array of the unwrapped interferogram loaded from the .tif. -
correlation
:np.ndarray
The correlation map array loaded from the .tif,
dataset_from_pngs(
dataset_name: str,
dataset_path: str,
save_path: str,
tile_size: int,
crop_size: int
) → int
Creates a dataset from a folder containing real interferogram products.
-
dataset_name
:str
The name for the folder that will contain the dataset. -
product_path
:str
The path to the folder containing sar product folders -
save_path
:str
The path to the folder where the dataset should be saved. -
tile_size
:int
The width and height of the tiles that the image will be broken into, this needs to match the input shape of the model. -
crop_size
:int
If the models output shape is different than the input shape, this value needs to be equal to the output shape.
-
dataset_size
:int
The size of the dataset that was created.
dataset_from_products(
dataset_name: str,
product_path: str,
save_path: str,
tile_size: int,
crop_size: int
) → int
Creates a dataset from a folder containing real interferogram products.
-
dataset_name
:str
The name for the folder that will contain the dataset. -
product_path
:str
The path to the folder containing sar product folders -
save_path
:str
The path to the folder where the dataset should be saved. -
tile_size
:int
The width and height of the tiles that the image will be broken into, this needs to match the input shape of the model. -
crop_size
:int
If the models output shape is different than the input shape, this value needs to be equal to the output shape. -
cutoff
:int
Set point in wrapped array to 0 if the correlation is below this value at that point.
-
dataset_size
:int
The size of the dataset that was created.
make_synthetic_dataset(
name: str,
output_dir: str,
amount: int,
seed: int,
tile_size: int,
crop_size: int,
min_amp: float,
max_amp: float,
min_x_mean: float,
max_x_mean: float,
min_y_mean: float,
max_y_mean: float,
min_x_stddev: float,
max_x_stddev: float,
min_y_stddev: float,
max_y_stddev: float
) → Tuple[int, int, str]
Generate a dataset containing pairs of synthetic wrapped interferograms along with their event-masks
-
name
:str
The name of the dataset to be generate. The saved name will be formatted like _amount_seed. -
output_dir
:str
The directory to save the generated dataset to. -
amount
:int
The amount of simulated interferogram pairs to be generated. -
seed
:int
A seed for the random functions. For the same seed, with all other values the same as well, the interferogram generation will have the same results. If left at 0, a seed will be generated and the results will be different every time. -
tile_size
:int
The size of the simulated interferograms, which should match the desired tile sizes of of the real interferograms. This also needs to match the input shape of the model. -
crop_size
:int
If the model's output shape does not match its input shape, this should be set to match the output shape. The unwrapped interferogram will be cropped to this.
-
seed
:int
The generated or inputed seed. -
count
:int
The number of samples that were generated. -
dir_name
:str
The generated name of the dataset directory.
make_simulated_dataset(
name: str,
output_dir: str,
amount: int,
seed: int,
tile_size: int
) → Tuple[int, int, str]
Generate a dataset containing pairs of wrapped interferograms from simulated deformation along with their event-masks
-
name
:str
The name of the dataset to be generate. The saved name will be formatted like _amount_seed. -
output_dir
:str
The directory to save the generated dataset to. -
amount
:int
The amount of simulated interferogram pairs to be generated. -
seed
:int
A seed for the random functions. For the same seed, with all other values the same as well, the interferogram generation will have the same results. If left at 0, a seed will be generated and the results will be different every time. -
tile_size
:int
The size of the simulated interferograms, which should match the desired tile sizes of of the real interferograms. This also needs to match the input shape of the model.
-
seed
:int
The generated or inputed seed. -
count
:int
The number of samples that were generated. -
dir_name
:str
The generated name of the dataset directory.
split_dataset(dataset_path: str, split: float) → Tuple[int, int]
Split the dataset into train and test folders
-
dataset_path
:str
The path to the dataset to be split -
split
:float
The train/test split, 0 < Split < 1, size(validation) <= split
-
num_train
:int
The number of elements that went to the training set. -
num_validation
:int
The number of elements that went to the validation set.
This file was automatically generated via andrewplayer3's fork of lazydocs.