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