Below is a plot I made where the y-axis (v) are values contained in a list. As you can see, the list values alternate between segments of high values and segments of low values such that the list looks like:
li = [0.5,0.49,0.5,..,0.5,0.001,0.001,...,0.001,0.49,0.5,...,0.5,]
My goal is to take each of the six segments of the high values and each of the six segments of the low values, and then calculate each segment's average. To do this, I am trying to separate the list above and put each segment into its own list and each list in a respective high value/ low value list. Something along the lines of:
high_segments = [[high_values1],[high_values2],[high_values3]]
low_segments = [[low_values1],[low_values2],[low_values3]]
I have been trying to construct a for loop to do this but have been struggling with how to deal with changes between groups of low and high values. Any suggestions are greatly appreciated.