-1

I want to smooth y keeping the spike around x=15 with 1D spline, but splrep gives me the original curve back instead of a smoothing curve

I have 1D data

    y=[0.0,
 5.2052869332441025,
 5.0601305002509624,
 4.4754224527354864,
 4.098745189894596,
 3.8030115442529695,
 3.9431487368244937,
 3.9593776141877197,
 3.7963526852936256,
 3.075221683118621,
 2.8724109084825162,
 2.866220511962523,
 2.977279571691484,
 3.0507612514639453,
 5.463175506106743,
 3.381127656014723,
 3.501990965367241,
 3.0149573364564164,
 2.5853772795716914,
 2.7330767943784506,
 2.5419775807261167,
 2.512698678266689,
 2.299916345992973,
 2.3513468295131337,
 2.2943951815291954,
 2.1383302660197425,
 2.039049690480174,
 2.0590262673582065,
 1.763627237744688,
 1.6120461770118788,
 1.3718587920361385,
 1.3859795884222854,
 1.4755228375439184,
 1.4741174502258658,
 1.341174502258658,
 1.251095867492053,
 1.2914505604818471,
 1.171791868830517,
 1.183369583403045,
 1.2024092354023759,
 1.1481345156432994,
 1.0947632591601137,
 0.9685795549606826,
 0.9010540404885394,
 0.8684624393508449,
 0.9203948469131671,
 0.9727622553120294,
 0.9937426802743852,
 0.8627070436673917,
 0.8518989459595114,
 0.8220511962523005,
 0.763024928894094,
 0.8072946294127489,
 0.8351012213485026,
 0.8100384808432324,
 0.7550945290279404,
 0.763761084155931,
 0.7193240756232223,
 0.654642797389995,
 0.6931571022251966,
 0.7534883720930232,
 0.7887234398527689,
 0.8088338631420445,
 0.7992973063409737,
 0.6131838715074452,
 0.6243600468462439,
 0.6293458256650494,
 0.675723607160783,
 0.6525012548101055,
 0.6767943784507278,
 0.5731972561485695,
 0.5542579889576711,
 0.5267190898444035,
 0.5764430316212147,
 0.6174000334616028,
 0.5661368579554961,
 0.5512464447047014,
 0.5003513468295131,
 0.4946294127488707,
 0.47846745859126655,
 0.42569851095867495,
 0.445139702191735,
 0.3626568512631755,
 0.3501756734147566,
 0.36406223858122805,
 0.37463610506943285,
 0.4220177346494897,
 0.39943115275221686,
 0.37416764263008195,
 0.3197590764597624,
 0.3206960013384641,
 0.3014890413250795,
 0.30654174334950646,
 0.29887903630583906,
 0.31075790530366404,
 0.2676593608833863,
 0.23704199431152753,
 0.2364062238581228,
 0.22820813116948302,
 0.22255312029446211,
 0.2174000334616028,
 0.21244771624560815,
 0.2050192404216162,
 0.20324577547264513,
 0.20940271038982766,
 0.25347164129161787,
 0.1964530701020579,
 0.21512464447047014,
 0.23463275890915175,
 0.21559310690982098,
 0.193173833026602,
 0.1790195750376443,
 0.19337460264346662,
 0.22462773966873012,
 0.1699514806759244,
 0.16576878032457754,
 0.16941609503095198,
 0.14887067090513637,
 0.13652333946796052,
 0.14214488874017064,
 0.1335117952149908,
 0.13749372594947298,
 0.1375941107579053,
 0.14007026936590264,
 0.1288940940271039,
 0.13545256817801574,
 0.13237410071942446,
 0.1284925547933746,
 0.1456248954324912,
 0.12815793876526685,
 0.13719257152417602,
 0.16309185209971558,
 0.12514639451229714,
 0.12996486531704868,
 0.12725447548937593,
 0.11581060732809101,
 0.12497908649824327,
 0.12270369750711059,
 0.11835368914170989,
 0.1259829345825665,
 0.1470972059561653,
 0.15097875188221516,
 0.16255646645474317,
 0.12919524845240088,
 0.11326752551447214,
 0.11658022419273883,
 0.00023423121967542247]
 x=list(range(len(y)))
Ami Tavory
  • 74,578
  • 11
  • 141
  • 185
Hello lad
  • 17,344
  • 46
  • 127
  • 200

1 Answers1

-1

Not possible, the data looks like a downsampled histogram of a 2d detector showing some high energy peak, the peak you want to preserve is the sharpest peak of your data, hence not possible. In the real data you can try medfilt from scipy.signal or fft filtering but in this

hsinghal
  • 152
  • 1
  • 10