From a867c48346fb2368eb19f3f50773f8865e059f80 Mon Sep 17 00:00:00 2001 From: troyyyyy Date: Tue, 7 Nov 2023 10:30:45 +0800 Subject: [PATCH] [MNT] remove unnecessary utils functions (cont.) --- abl/utils/utils.py | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/abl/utils/utils.py b/abl/utils/utils.py index 8c1b4d4..5bcb4d7 100644 --- a/abl/utils/utils.py +++ b/abl/utils/utils.py @@ -174,38 +174,6 @@ def hashable_to_list(x): return x -def calculate_revision_num(parameter, total_length): - """ - Convert a float parameter to an integer, based on a total length. - - Parameters - ---------- - parameter : int or float - The parameter to convert. If float, it should be between 0 and 1. - If int, it should be non-negative. If -1, it will be replaced with total_length. - total_length : int - The total length to calculate the parameter from if it's a fraction. - - Returns - ------- - int - The calculated parameter. - """ - if not isinstance(parameter, (int, float)): - raise TypeError("Parameter must be of type int or float.") - - if parameter == -1: - return total_length - elif isinstance(parameter, float): - if not (0 <= parameter <= 1): - raise ValueError("If parameter is a float, it must be between 0 and 1.") - return round(total_length * parameter) - else: - if parameter < 0: - raise ValueError("If parameter is an int, it must be non-negative.") - return parameter - - if __name__ == "__main__": A = np.array( [