I have measurement data that has pretty arbitrary sampling points. For instance the sampling points of 3 curves might be
[0.1, 0.15, 0.17, 0.18, 0.185, 20, 1000, 15000]
[0.09, 0.151, 0.169, 0.18, 21, 14000]
[0.11, 0.2, 13999, 14001]
(the corresponding y-values are omitted). In order calculate the mean I interpolate all curves linearly using scipy interp1d and find the common support. Finally I am looking for the sensible setpoints at which i evaluate the mean.
np.linspace(min(common_support), max(common_support), num)
will be very inefficient as num would have to be extremely large for sufficient resolution around 0. In this particular case I would need a couple of setpoints around 0.1-0.2 and some at 20, 14000, 15000.
I tried to calculate a probability density function of all the sampling points using
# common support is the set of all x-values in the common support of all funtions
kernel = stats.gaussian_kde(common_support)
class rv(stats.rv_continuous):
def _rvs(self, *x, **y):
return kernel.resample(int(self._size))
which doesn't work very well, because my distribution is often not gaussian at all.
TL:DR: I need x-values to evaluate the mean at which is distributed similarly like the set of all x-values in the common support of the data.