diff --git a/code/useful_functions.py b/code/useful_functions.py index 7153e09..c259f2c 100644 --- a/code/useful_functions.py +++ b/code/useful_functions.py @@ -32,7 +32,7 @@ def all_coming_together(freq_array, power_array, points_list, categories, num_ha Returns ------- valid_points : list - A list of valid points with their harmonics. + A continuous list of harmonics for all valid points. color_mapping : dict A dictionary mapping categories to corresponding colors. category_harmonics : dict @@ -40,7 +40,7 @@ def all_coming_together(freq_array, power_array, points_list, categories, num_ha messages : list A list of messages for each point, stating whether it was valid or not. """ - valid_points = [] + valid_points = [] # A continuous list of harmonics for valid points color_mapping = {} category_harmonics = {} messages = [] @@ -58,7 +58,7 @@ def all_coming_together(freq_array, power_array, points_list, categories, num_ha if valid: # Step 3: Prepare harmonics if the point is valid harmonics, color_map, category_harm = prepare_harmonic(point, category, num_harmonics, color) - valid_points.append((point, harmonics)) + valid_points.extend(harmonics) # Use extend() to append harmonics in a continuous manner color_mapping.update(color_map) category_harmonics.update(category_harm) messages.append(f"The point {point} is valid.") @@ -67,6 +67,8 @@ def all_coming_together(freq_array, power_array, points_list, categories, num_ha return valid_points, color_mapping, category_harmonics, messages + + def AM(EODf, stimulus): """ Calculates the Amplitude Modulation and Nyquist frequency @@ -426,7 +428,7 @@ def spike_times(stim): return spikes, stim_dur, dt # se changed spike_times to spikes so its not the same as name of function -def valid_integrals(integral, local_mean, point, threshold = 0.5): +def valid_integrals(integral, local_mean, point, threshold = 0.1): """ Check if the integral exceeds the threshold compared to the local mean and provide feedback on whether the given point is valid or not.