在Python中简化半日志图中的步骤

时间:2019-03-11 10:42:21

标签: python smoothing

我知道平滑曲线上有许多不同的线程,最著名的是this one。我尝试了此线程中的建议,但未成功(Savitzky-Golay,移动框,LOWESS,样条插值,来自scipy.ndimage的高斯滤波器...)。这是我的问题。我有一些数据点,如下图所示。它们实际上是离散的点,但是如果我将它们连接起来,则更容易看到我的观点。 My raw data 我想简化步骤。有趣的是,您的眼睛和大脑会立即知道该怎么做。不幸的是,这不适用于我的计算机。 Scipy的Savitzky-Golay滤波器重现了这些步骤,我能找到的最佳解决方法是使用样条插值,然后再加上Savitzky-Golay滤波器。对于样条插值,我采用了x值的对数以使其在数值上没有问题。尽管结果仍然不能令人满意...边缘明显分开,最终曲线不平滑。我设置了不同的曲线以获得更好的可见性 Smoothing variants 如果有帮助,这里是原始数据数组:

x_vals = np.concatenate([np.linspace(0.1,1,50),np.linspace(2,10,50),np.linspace(20,100,50),np.linspace(200,1000,50)])

y_vals = [0.006421338816263247, 0.007151748296354214, 0.008571992940174732, 0.009259161719283952, 0.010607555231605179, 0.011259832484425388, 0.012536003692705475, 0.013161405732532586, 0.013773568312890517, 0.014375237832940722, 0.014375237832940722, 0.014375237832940722, 0.0199233593014159, 0.0199233593014159, 0.0199233593014159, 0.0199233593014159, 0.0199233593014159, 0.0199233593014159, 0.0199233593014159, 0.024765110442385063, 0.024765110442385063, 0.024765110442385063, 0.024765110442385063, 0.024765110442385063, 0.024765110442385063, 0.024765110442385063, 0.02904380553969153, 0.02904380553969153, 0.02904380553969153, 0.02904380553969153, 0.02904380553969153, 0.02904380553969153, 0.02904380553969153, 0.03287680824513271, 0.03287680824513271, 0.03287680824513271, 0.03287680824513271, 0.03287680824513271, 0.03287680824513271, 0.03287680824513271, 0.03634336074707659, 0.03634336074707659, 0.03634336074707659, 0.03634336074707659, 0.03634336074707659, 0.03634336074707659, 0.03634336074707659, 0.03950571220353977, 0.03950571220353977, 0.03950571220353977, 0.05769610578336182, 0.059383503457564144, 0.060980452215838345, 0.06394222598281782, 0.06394222598281782, 0.06394222598281782, 0.06394222598281782, 0.06394222598281782, 0.07532600679244883, 0.07532600679244883, 0.07532600679244883, 0.07532600679244883, 0.07532600679244883, 0.07532600679244883, 0.07532600679244883, 0.08319558355890148, 0.08319558355890148, 0.08319558355890148, 0.08319558355890148, 0.08319558355890148, 0.08319558355890148, 0.08319558355890148, 0.08319558355890148, 0.08905604531615907, 0.08905604531615907, 0.08905604531615907, 0.08905604531615907, 0.08905604531615907, 0.08905604531615907, 0.08905604531615907, 0.08905604531615907, 0.09365217168036531, 0.09365217168036531, 0.09365217168036531, 0.09365217168036531, 0.09365217168036531, 0.09365217168036531, 0.09365217168036531, 0.09365217168036531, 0.0973698293606429, 0.0973698293606429, 0.0973698293606429, 0.0973698293606429, 0.0973698293606429, 0.0973698293606429, 0.0973698293606429, 0.0973698293606429, 0.10045362831755136, 0.10045362831755136, 0.10045362831755136, 0.11435324622999209, 0.11539786284688483, 0.11635556661393566, 0.11805307955530271, 0.11805307955530271, 0.11805307955530271, 0.11805307955530271, 0.11805307955530271, 0.12384822121140239, 0.12384822121140239, 0.12384822121140239, 0.12384822121140239, 0.12384822121140239, 0.12384822121140239, 0.12384822121140239, 0.12729304142615827, 0.12729304142615827, 0.12729304142615827, 0.12729304142615827, 0.12729304142615827, 0.12729304142615827, 0.12729304142615827, 0.12729304142615827, 0.1296183340551226, 0.1296183340551226, 0.1296183340551226, 0.1296183340551226, 0.1296183340551226, 0.1296183340551226, 0.1296183340551226, 0.1296183340551226, 0.13131240440085828, 0.13131240440085828, 0.13131240440085828, 0.13131240440085828, 0.13131240440085828, 0.13131240440085828, 0.13131240440085828, 0.13131240440085828, 0.13261033523435292, 0.13261033523435292, 0.13261033523435292, 0.13261033523435292, 0.13261033523435292, 0.13261033523435292, 0.13261033523435292, 0.13261033523435292, 0.1336503269913326, 0.1336503269913326, 0.1336503269913326, 0.1378661933018667, 0.13815462791565108, 0.13841892023698307, 0.13887897273591807, 0.13887897273591807, 0.13887897273591807, 0.13887897273591807, 0.13887897273591807, 0.14039436015484297, 0.14039436015484297, 0.14039436015484297, 0.14039436015484297, 0.14039436015484297, 0.14039436015484297, 0.14039436015484297, 0.14124569091656425, 0.14124569091656425, 0.14124569091656425, 0.14124569091656425, 0.14124569091656425, 0.14124569091656425, 0.14124569091656425, 0.14124569091656425, 0.1418109806009027, 0.1418109806009027, 0.1418109806009027, 0.1418109806009027, 0.1418109806009027, 0.1418109806009027, 0.1418109806009027, 0.1418109806009027, 0.14221259985494092, 0.14221259985494092, 0.14221259985494092, 0.14221259985494092, 0.14221259985494092, 0.14221259985494092, 0.14221259985494092, 0.14221259985494092, 0.14251580504331426, 0.14251580504331426, 0.14251580504331426, 0.14251580504331426, 0.14251580504331426, 0.14251580504331426, 0.14251580504331426, 0.14251580504331426, 0.14275757489914617, 0.14275757489914617, 0.14275757489914617]

0 个答案:

没有答案