Update ccl_findpeaks.py

This commit is contained in:
JakHolzer 2020-09-14 09:42:14 +02:00 committed by GitHub
parent 90c0256595
commit d30b348425
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,36 +33,31 @@ def ccl_findpeaks(
if type(data) is not dict and data["file_type"] != "ccl": if type(data) is not dict and data["file_type"] != "ccl":
print("Data is not a dictionary or was not made from ccl file") print("Data is not a dictionary or was not made from ccl file")
if 0 <= int_threshold <= 1: if not 0 <= int_threshold <= 1:
pass int_threshold = 0.8
else:
int_threshold = 0.75
print( print(
"Invalid value for int_threshold, select value between 0 and 1, new value set to:", "Invalid value for int_threshold, select value between 0 and 1, new value set to:",
int_threshold, int_threshold,
) )
if isinstance(window_size, int) is True and (window_size % 2) != 0 and window_size >= 1:
pass if isinstance(window_size, int) is False or (window_size % 2) == 0 or window_size <= 1:
else:
window_size = 7 window_size = 7
print( print(
"Invalid value for window_size, select positive odd integer, new value set to:", "Invalid value for window_size, select positive odd integer, new value set to!:",
window_size, window_size)
)
if isinstance(poly_order, int) is True and window_size > poly_order >= 1: if isinstance(poly_order, int) is False or window_size < poly_order:
pass
else:
poly_order = 3 poly_order = 3
print( print(
"Invalid value for poly_order, select positive integer smaller than window_size, new value set to:", "Invalid value for poly_order, select positive integer smaller than window_size, new value set to:",
poly_order, poly_order,
) )
if isinstance(prominence, (int, float)) is True and prominence > 0:
pass if isinstance(prominence, (int, float)) is False and prominence < 0:
else:
prominence = 50 prominence = 50
print("Invalid value for prominence, select positive number, new value set to:", prominence) print("Invalid value for prominence, select positive number, new value set to:", prominence)
omega = data["Measurements"][str(keys)]["omega"] omega = data["Measurements"][str(keys)]["omega"]
counts = np.array(data["Measurements"][str(keys)]["counts"]) counts = np.array(data["Measurements"][str(keys)]["counts"])
if smooth is True: if smooth is True: