File indexing completed on 2024-05-12 15:27:10
0001 #!/usr/bin/env python 0002 ########################################################################### 0003 # File : nsl_smooth_check.h 0004 # Project : LabPlot 0005 # Description : NSL smooth functions 0006 # -------------------------------------------------------------------- 0007 # Copyright : (C) 2016 by Stefan Gerlach (stefan.gerlach@uni.kn) 0008 # 0009 ########################################################################### 0010 0011 ########################################################################### 0012 # # 0013 # This program is free software; you can redistribute it and/or modify # 0014 # it under the terms of the GNU General Public License as published by # 0015 # the Free Software Foundation; either version 2 of the License, or # 0016 # (at your option) any later version. # 0017 # # 0018 # This program is distributed in the hope that it will be useful, # 0019 # but WITHOUT ANY WARRANTY; without even the implied warranty of # 0020 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 0021 # GNU General Public License for more details. # 0022 # # 0023 # You should have received a copy of the GNU General Public License # 0024 # along with this program; if not, write to the Free Software # 0025 # Foundation, Inc., 51 Franklin Street, Fifth Floor, # 0026 # Boston, MA 02110-1301 USA # 0027 # # 0028 ########################################################################### 0029 0030 from scipy.signal import savgol_filter 0031 import numpy as np 0032 x = np.array([2, 2, 5, 2, 1, 0, 1, 4, 9]) 0033 0034 m=5 0035 order=2 0036 np.set_printoptions(precision=4) 0037 print x 0038 print "mode:interp" 0039 print savgol_filter(x, m, order, mode='interp') 0040 print "mode:mirror" 0041 print savgol_filter(x, m, order, mode='mirror') 0042 print "mode:nearest" 0043 print savgol_filter(x, m, order, mode='nearest') 0044 print "mode:constant" 0045 print savgol_filter(x, m, order, mode='constant') 0046 print "mode:wrap" 0047 print savgol_filter(x, m, order, mode='wrap')