[ ] For each episode, find the global max and the global min
[ ] Create a "threshold to count the local max/min compared to the temporal distance to the global max/min" function (example: if we are close to the max/min, you'd better have a clear local max/min (ex : 80% of the global max/min value), but if you are far (temporally) to the global min/max, 50% of the global max/min function is enough).
[ ] Count all the local maxs and mins that are above the threshold relatively to their position to the global max/min
[ ] Calculate the number of spasmodic events per patient by counting the number of events which respect the condition:
(number of mins + number of max) > 2
[ ] plot the result as a bar chart (x axis : subject i = one bar, y-axis : height of the bar = nb of spasmodic events
Compare qualitatively MEMA profiles:
[ ] For each episode, find the global max and the global min
[ ] Split the episodes in 2 categories : |max|>|min| or |min|>|max|
[ ] for each category, recalibrate events on latency by centering on the |max| if |max|>|min| (or vice versa)
[ ] create a function that does: for each category, display averaged signal + enveloppe associated for each subject
[ ] Compare each subject to the averaged response of the control group (actually ask yourself what you want to compare)
Count MEMA spasmodic events:
Compare qualitatively MEMA profiles: