util.py¶
-
lib.util.
create_json
(filepath, param, param_keys, paths, paths_keys)¶ Creates a metadata JSON file containing information about the file in filepath by storing the relevant keys from both the param and path dictionaries.
- Parameters
filepath (string) – Path to the file for which the JSON file will be created.
param (dict) – Dictionary of dictionaries containing the user input parameters and intermediate outputs.
param_keys (list of strings) – Keys of the parameters to be extracted from the param dictionary and saved into the JSON file.
paths (dict) – Dictionary of dictionaries containing the paths for all files.
paths_keys (list of strings) – Keys of the paths to be extracted from the paths dictionary and saved into the JSON file.
- Returns
The JSON file will be saved in the desired path filepath.
- Return type
None
-
lib.util.
display_progress
(message, progress_stat)¶ This function displays a progress bar for long computations. To be used as part of a loop or with multiprocessing.
- Parameters
message (string) – Message to be displayed with the progress bar.
progress_stat (tuple(int, int)) – Tuple containing the total length of the calculation and the current status or progress.
- Returns
The status bar is printed.
- Return type
None
-
lib.util.
get_x_y_values
(paths)¶ This function finds the rel_size and rel_std of the four corners of the x,y scatter plot between rel_size and rel_std.
- Parameters
paths (dict) – Dictionary of paths including the path to the CSV file non_empty_rasters.
- Returns
Coordinates of the upper left, upper right, lower left and lower right points of the x,y scatter plot between rel_size and rel_std.
- Return type
tuple(tuples(int, int))
-
lib.util.
timecheck
(*args)¶ This function prints information about the progress of the script by displaying the function currently running, and optionally an input message, with a corresponding timestamp. If more than one argument is passed to the function, it will raise an exception.
- Parameters
args (string) – Message to be displayed with the function name and the timestamp (optional).
- Returns
The time stamp is printed.
- Return type
None
- Raise
Too many arguments have been passed to the function, the maximum is only one string.