I need to compare some theoretical data with real data in python. The theoretical data come from solving the equation. To improve the comparative, I would like to remove data points that are far from theoretical. I mean, I want to remove the points below and above the red dashed lines in the figure (made with matplotlib). 
Both theoretical curves and data points are arrays of different lengths.
I can try to delete the points in a rough way, for example: the first top point can be detected with:
data2[(data2.redshift<0.4)&data2.dmodulus>1] rec.array([('1997o', 0.374, 1.0203223485103787, 0.44354759972859786)], dtype=[('SN_name', '|S10'), ('redshift', '<f8'), ('dmodulus', '<f8'), ('dmodulus_error', '<f8')])
But I would like to use a less rude image.
So can anyone help me find an easy way to remove the problem points?
Thanks!
source share