changed all_coming_together

This commit is contained in:
Diana 2024-10-23 15:24:16 +02:00
parent 940a461978
commit 887df50f38

View File

@ -32,7 +32,7 @@ def all_coming_together(freq_array, power_array, points_list, categories, num_ha
Returns Returns
------- -------
valid_points : list valid_points : list
A list of valid points with their harmonics. A continuous list of harmonics for all valid points.
color_mapping : dict color_mapping : dict
A dictionary mapping categories to corresponding colors. A dictionary mapping categories to corresponding colors.
category_harmonics : dict category_harmonics : dict
@ -40,7 +40,7 @@ def all_coming_together(freq_array, power_array, points_list, categories, num_ha
messages : list messages : list
A list of messages for each point, stating whether it was valid or not. 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 = {} color_mapping = {}
category_harmonics = {} category_harmonics = {}
messages = [] messages = []
@ -58,7 +58,7 @@ def all_coming_together(freq_array, power_array, points_list, categories, num_ha
if valid: if valid:
# Step 3: Prepare harmonics if the point is valid # Step 3: Prepare harmonics if the point is valid
harmonics, color_map, category_harm = prepare_harmonic(point, category, num_harmonics, color) 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) color_mapping.update(color_map)
category_harmonics.update(category_harm) category_harmonics.update(category_harm)
messages.append(f"The point {point} is valid.") 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 return valid_points, color_mapping, category_harmonics, messages
def AM(EODf, stimulus): def AM(EODf, stimulus):
""" """
Calculates the Amplitude Modulation and Nyquist frequency 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 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 Check if the integral exceeds the threshold compared to the local mean and
provide feedback on whether the given point is valid or not. provide feedback on whether the given point is valid or not.