I have been bouncing some ideas around about this problem, but thought I would consult with the online community to see if someone has a better option.
So I have step-like function graphs like this:
And with this I want to compute the y-displacement between steps.
As one can see the steps are not perfectly horizontal, but rather take a small range of y-values before stepping up.
So the question is:
(1) What is the 'proper' way (if there is one) to take the average y-value of each 'level'? I am not sure where I should be using as my left most point and my right most point on each level- so I can take the values between these points and average them, and then attain the 'average' of each level, hope this makes sense. As one can see they do not all span the same displacement in x. The ultimate goal is to get the y-displacement between levels, once I have the 'average' value of each 'level' it is trivial to take the difference.
I was maybe thinking of taking the derivative of the curve and seeing where it is equal to zero for my left and right most points on each level but i'm not sure it will work as each level also contains points where (dy/dx = 0) -- so I could use some insight.
Thank you :) Oh - and this must be done in Python -- and it is not just these graphs, but a lot of them with a similar style, so the code must be generic enough to handle other step-like graphs.
Date file for graph 1: http://textuploader.com/5nwsh
Data file for graph 2: http://textuploader.com/5nwsv
Data file for graph 3: http://textuploader.com/5nwsj
Scatter Plot Python code:
import numpy as np
import matplotlib.pyplot as plt
import pylab as pl
data=np.loadtxt('data-file')
x= data[:,0]
y=data[:,1]
pl.plot(data[:,0],data[:,1],'r')
pl.xlabel('x')
pl.ylabel('y')
plt.show()





stepin they-axis. So step needs to be defined, I think you mean it in the sense where the graphs are tilted in a way to resemble stairs, like in the 2nd graph.