问题描述
我必须在数据集中找到最陡坡的起点和终点.数据集显示实验期间的温度变化.冷却开始大约 420 帧,结束大约 500 帧.有人可以帮我计算这些分数吗?
<预类= 郎吡prettyprint-越权"> <代码> Y = [308.09262874940794,308.1216944088393,308.2620809214068,308.2185299674233,308.0441705852154,308.06355616177564,307.9374947672655,308.15075314506964,308.0684020743851,307.9859953521339,308.0974735069697,308.1265380121872,308.09262874940794,308.0780933219296,307.9859953521339,308.0247819257457,308.0005417638036,308.1555955950364,308.09262874940794,308.0780933219296,308.17496347364175,308.2185299674233,308.20400953030344,308.2378878644666,308.2524042737181,308.22336972940053,308.3056163523782,308.3829743977657,308.34913627709466,308.08778379939605,308.3636394757246,308.3636394757246,308.3636394757246,308.4844326170746,308.4361296746482,308.5375438416535,308.460283529643,308.5761557193945,308.64852019740135,308.69673945106905,308.53271650065454308.691918372092685,308.6858520198686,686,689,686,689,689,686,689,689,6686,686,686,689,689,686,688,308.68.688,308.68,308.68,308.68,308.68,308.68,308.68,308.68,308.68,308.68,308.68,308.68227566668,但308.735301202496,308.8364681549037,308.77866868368494,308.7690327906589,308.8075718225567,308.8701719464355,308.75939614063134,308.8172046893795,308.69673945106905,308.88942710227735,308.9952765331329,308.88942710227735,309.1634857265685,308.9375517868669,308.9423632184057,309.00489468840124,308.9760379640753,308.9423632184057,309.0289367843301,309.0385523062737,308.9231163613786,309.18269499806115,308.9231163613786,309.0000857048534,309.20190127232803,309.07700687606655,309.0193205102312,309.19709998467357,308.9952765331329,309.09142424016557,309.05297417928875,309.0577810944096,309.20190127232803,309.105839914524,309.04816707624076,309.11544942564836,309.18749684756233,309.1586829402123,309.38900566395995,309.31227925555163,309.2690996495939,309.2978877349221,309.2211045507886,309.283494533135,309.2786964255123,309.2115032859454,309.1634857265685,309.3362613889812,309.3602388569431,309.2786964255123,309.29309018781777, 309.37462309944226,309.14427345642935,309.17789296123334,309.2115032859454,309.3650337909219,309.31707605560723,309.37462309944226,309.30748226876693,309.3314653356209,309.302685095231,309.3362613889812,309.3362613889812,309.2595021259639,309.19709998467357,309.2163040119527,309.2786964255123,309.0577810944096,309.11544942564836,309.2786964255123,309.00970348379855,309.0241287413112,309.05297417928875,309.04816707624076,309.0818128518856,309.0818128518856,309.0818128518856,309.1394699201895,309.3650337909219,309.2403048348614,309.25470308370177,309.20190127232803,309.2163040119527,309.22590490247524,309.37462309944226,309.2499038544454,309.1298622851081,309.23550504448957,309.31707605560723,309.2115032859454,309.2307050670348,309.11544942564836,309.302685095231,309.2499038544454,309.3314653356209,309.30748226876693,309.18749684756233,309.2115032859454,309.06739436095876,309.2211045507886,309.1010348774497,309.1634857265685、309.0818128518856、309.20190127232803,309.2403048348614,309.11064476391624,309.17789296123334,308.9808478887107,309.07700687606655,309.19709998467357,309.09142424016557,309.0193205102312,309.0289367843301,308.9664175499284,309.05297417928875,309.0385523062737,309.1298622851081,309.0337446393101,309.2499038544454,309.25470308370177,309.0193205102312,309.0289367843301,309.04816707624076,309.00489468840124,309.0193205102312,309.01451209106773,309.0722007124317,309.01451209106773,308.9904671732171,309.17789296123334,309.00489468840124,308.9375517868669,308.9760379640753,309.01451209106773,308.9471744615032,309.120253899743,309.0193205102312,309.0337446393101,309.0625878216255,309.0385523062737,308.9616070603721,309.120253899743,309.11544942564836,308.95198551618194,309.1298622851081,308.9423632184057,309.06739436095876,309.22590490247524,309.00970348379855,308.9760379640753,309.01451209106773,308.9664175499284,309.0193205102312,309.0722007124317, 308.9616070603721, 3090.1538799664186,309.2211045507886,308.9086792391121,308.9327401668644,308.83165257198146,309.0193205102312,309.01451209106773,309.0722007124317,309.0722007124317,309.0722007124317,308.7304816467341,308.8364681549037,308.8364681549037,308.8172046893795,308.85572859746634,308.9038664878567,308.7738508317859,308.9134918017692,308.79312110424047,308.7834863463787,308.95198551618194,308.80275510555146,308.72566190154123,308.8123883504919,308.8075718225567,308.8509137701496,308.8268368001017,308.86054323593794,308.7304816467341,308.7401205688495,308.77866868368494,308.77866868368494,308.79793819945354,308.7449397458172,308.7690327906589,308.74975873342174,308.74975873342174,308.7063810260086,308.6774540259391,308.8364681549037,308.71602184277236,308.71602184277236,308.8075718225567,308.7112015291512,308.83165257198146,308.71602184277236,308.71602184277236,308.60028196217667,308.735301202496,308.66298796553434, 308.7401205688495, 308.6919183792268,308.61475542715624,308.7834863463787,308.8075718225567,308.5471979526607,308.6919183792268,308.7401205688495,308.7112015291512,308.619579535504,308.7208419668949,308.619579535504,308.735301202496,308.7208419668949,308.6919183792268,308.75939614063134,308.71602184277236,308.7738508317859,308.7015603333221,308.6533429765644,308.6244034539002,308.6244034539002,308.6919183792268,308.8075718225567,308.64369722842287,308.8075718225567,308.7112015291512,308.7208419668949,308.7112015291512,308.7015603333221,308.8123883504919,308.7690327906589,308.6774540259391,308.6774540259391,308.5278889692949,308.61475542715624,308.65816556593444,308.6919183792268,308.72566190154123,308.6822756666845,308.7015603333221,308.79312110424047,308.8268368001017,308.7063810260086,308.77866868368494,308.88942710227735,308.88942710227735,308.62922718236746,308.585806786816,308.5713299004612,308.619579535504,308.59545709379574, 308.60510664051526, 308.6678101753866,308.5471979526607,308.6244034539002,308.5713299004612,308.513405232825,308.59545709379574,308.6678101753866,308.51823333540295,308.58098134817186,308.5713299004612,308.66298796553434,308.5713299004612,308.6678101753866,308.561677692036,308.60510664051526,308.585806786816,308.61475542715624,308.58098134817186,308.4747735540269,308.619579535504,308.5375438416535,308.513405232825,308.4844326170746,308.53271650065454,308.7545775316855,308.619579535504,308.5423709923146,308.53271650065454,308.58098134817186,308.561677692036,308.6099311288342,308.63405072092854,308.47960318085643,308.59063203534976,308.6388740696062,308.5471979526607,308.5761557193945,308.5761557193945,308.3829743977657,308.619579535504,308.513405232825,308.5375438416535,308.6099311288342,308.5713299004612,308.48926186270444,308.55202472271446,308.460283529643,308.585806786816,308.7545775316855,308.49891978229,308.4264667970933,308.585806786816, 308.49409091776863, 308.56650389134927,308.5713299004612,308.55685130249867,308.5085769397954,308.7063810260086,308.6099311288342,308.56650389134927,308.6533429765644,308.58098134817186,308.55685130249867,308.55202472271446,308.59545709379574,308.71602184277236,308.4506225599124,308.585806786816,308.72566190154123,308.64369722842287,308.619579535504,308.561677692036,308.44579178893633,308.3539708678361,308.5761557193945,308.4747735540269,308.5085769397954,308.55202472271446,308.5423709923146,308.6244034539002,308.6244034539002,308.6244034539002,308.59545709379574,308.561677692036,308.71602184277236,308.7208419668949,308.75939614063134,308.7208419668949,308.6919183792268,308.7015603333221,308.69673945106905,308.6244034539002,308.72566190154123,308.6870971177729,308.7208419668949,308.67263219551404,308.63405072092854,308.58098134817186,308.6099311288342,308.7063810260086,308.7401205688495,308.71602184277236,308.7063810260086,308.59063203534976, 308.66298796553434, 308.61475542715624,308.65816556593444,308.3829743977657,308.179804963093,308.01993427899953,307.7238623656049,307.7870200759143,307.79187700324024,307.9956931528356,307.7967337366716,307.7432990008586,307.65094729432553,307.5828537304289,307.4757723506065,307.4757723506065,307.5925837197807,307.45629285398684,307.4757723506065,307.44655193263713,307.43681022900745,307.3442249919368,307.3442249919368,307.21741467075975,306.9438325912993,307.29546750001407,307.1148939020285,307.1246615279916,307.1393114883849,307.1246615279916,307.2857136466891,307.0171742273997,307.1246615279916,307.06115785452863,307.1344283653618,307.0709298211955,306.95850448065585,306.95850448065585,307.01228616964715,306.7970155589062,306.86065819859596,306.9438325912993,306.80191233851883,306.95361404887177,306.9633947144708,306.91448346480337,306.7578341641973,306.77742645250083,306.7186400356454,306.80191233851883,306.7627325346616,306.7333393268934, 306.6402135269444,306.7872214033432,306.6647272939214,306.7627325346616,306.65982493948627,306.6255028723101,306.772528678789,306.7431378589092,306.65492238559546,306.6255028723101,306.586265674549,306.58136012587954,306.58136012587954,306.35548845128324,306.4341006255742,306.4341006255742,306.4586563943867,306.4341006255742,306.27190663753186,306.27682482487546,306.3112464989674,306.46356694665616,306.3063297207779,306.3161630759486,306.34074294360084,306.1587326897794,306.2030308556243,305.9665846821754,305.9419280279521,305.76425004708364,305.93699608794924,305.79388137173896,305.7049653605219,305.71484818345783,305.630818125787,305.7790666270583,305.6654258946194,305.7395516668316,305.8136315109291,306.1242672507756,306.3456583138544,306.42918887014565,306.35057348307356,306.5372011917228,306.49793520160534,306.6156947711249,306.5715484289708,306.42918887014565,306.6451166793491,306.7137398736051,306.6843347175962、306.6696294489255、306.6696294489255,306.6255028723101,306.7382386924333,306.76763070618404,306.7235399985239,306.77742645250083,306.7823240273442,306.88023379933344,306.77742645250083,306.9046988373983,306.8704463957765,306.86065819859596,306.95361404887177,306.96828475034096,306.8655523964013,306.9046988373983,306.855763802336,306.9193754812128,306.96828475034096,307.05627157501516,306.9633947144708,306.95361404887177,307.0025094610091,306.92915891956665,307.0025094610091,307.08070099820964,306.9633947144708,307.0416115514648,307.15884200995754,306.96828475034096,307.09047138576403,307.0025094610091,307.05627157501516,307.1978935996081,307.1734878327647,307.19301283991086,307.19301283991086,307.1344283653618,307.14419441433193,307.0660439365807,307.17836937985277,307.10512548728025,307.1881318834019,307.17836937985277,307.2564473733913,307.15884200995754,307.28083642550376,307.28083642550376,306.8900204094612,307.2662035835691,307.2662035835691, 307.2662035835691,307.32959980418053,307.24181158431395,307.30522056810406,307.23205340877587,307.3003441322015,307.3003441322015,307.22229444675827,307.1100097932646,307.23205340877587,307.2466903772131,307.2613255767183,307.3247243493438,307.8889748630513,307.30522056810406,307.3978355878861,307.40758042253736,307.2857136466891,307.2515689735642,307.19301283991086,307.3393501254531,307.2857136466891,307.38808997000365,307.4027081031038,307.38808997000365,307.3442249919368,307.33447506287564,307.4319390837782,307.40758042253736,307.28083642550376,307.2857136466891,307.3149728511503,307.3832168672912,307.36372249741055,307.3490996623505,307.31984869834173,307.4124525462108,307.47090276965224,307.48064173613346,307.3003441322015,307.41732447414785,307.5147219648439,307.45629285398684,307.45629285398684,307.3832168672912,307.5147219648439,307.6120413603623,307.5682572845433,307.50985394664536,307.57798844340505,307.3978355878861,307.4027081031038, 307.36372249741055,307.5390591277433,307.45629285398684,307.4270677429077,307.4952487203862,307.48064173613346,307.45142249108505,307.3978355878861,307.62176901196995,307.5390591277433,307.6606718315838,307.5001173244402,307.5147219648439,307.6801185719411,307.6314958847072,307.573122961451,307.52932484810736,307.50985394664536,307.573122961451,307.63635902905844,307.57798844340505,307.6266325456856,307.5828537304289,307.7044226227817,307.68497977088464,307.62176901196995,307.65094729432553,307.5390591277433,307.60231292969553,307.50498573318544,307.573122961451,307.62176901196995,307.7821629546704,307.6120413603623,307.5828537304289,307.50985394664536,307.6120413603623,307.48064173613346,307.48064173613346,307.48064173613346,307.33447506287564,307.4416811786191,307.5536590838609,307.5682572845433,307.65094729432553,307.77244813033496,307.50498573318544,307.5147219648439,307.69956220134196,307.60717724242306,307.646084733844, 307.68984077541694,307.7675904271966,307.5828537304289,307.61690528353665,307.65094729432553,307.7190027212925,307.6266325456856,307.646084733844,307.6120413603623,307.5390591277433,307.65094729432553,307.6266325456856,307.67525717856273,307.7190027212925,307.8938277235077,307.6606718315838,307.7675904271966,307.646084733844,307.7432990008586,307.77244813033496,307.6606718315838,307.73358107158396,307.80159027623193,307.6412219787628,307.69956220134196,307.7044226227817,307.7384401332976,307.65094729432553,307.7092828499044,307.84529041194054,307.7092828499044,307.6703955907262,307.7481576742905,307.6606718315838,307.5487926269017,307.66553380840764,307.53419208549684,307.8938277235077,307.75787443886094,307.7092828499044,307.7821629546704,307.77244813033496,307.68497977088464,307.75787443886094,307.65580966023083,307.68984077541694,307.73358107158396,307.71414288273354,307.7092828499044,307.65580966023083,307.82101449623093, 307.9471964290412, 307.7967337366716,307.84043561616613,307.75787443886094,307.9180891252065,307.8598536375354,307.8598536375354,307.84043561616613,307.7384401332976,307.8307254436129,307.73358107158396,307.82101449623093,307.87926856183515,307.7190027212925,307.8064466219446,307.8889748630513,307.72872181569426,307.93264364659916,307.8744151210287,307.8938277235077,307.8598536375354,307.83558062673137,307.85014501407795,307.8064466219446,307.82587006678716,307.83558062673137,307.75787443886094,307.8598536375354,307.7481576742905,307.7481576742905,307.7481576742905,307.5974484221559,307.5828537304289,307.7092828499044,307.8064466219446,307.65094729432553,307.7821629546704,307.87926856183515,307.7675904271966,307.93264364659916,307.7044226227817,307.7821629546704,307.7627325300463,307.7092828499044,307.7530161536168,307.7384401332976,307.7044226227817,307.7821629546704,307.7044226227817,307.89868039056074,307.9180891252065,307.87926856183515, 307.7481576742905, 3070.84529041194054,307.82101449623093,307.91323723153334,307.92294082559295,307.7432990008586,307.8307254436129,307.65094729432553,307.81130277383306,307.9471964290412,307.8938277235077,307.75787443886094,307.85014501407795,307.7530161536168,307.90838514455027,307.72872181569426,307.84529041194054]在我的第一次尝试中,我使用了最大累积:
i = np.argmax(np.maximum.accumulate(y) - y)j = np.argmax(y[:i])plt.plot(y)plt.plot([i, j], [y[i], y[j]], 'o', color='Red', markersize=10)
它找到了最大百分比下降,但不是最陡的
当我听到斜率时,我想到了导数,所以我想要一个函数.我通过使用样条插值得到一个.如果您不熟悉样条曲线,它们基本上是拼接在一起以形成平滑函数的多项式.
从 scipy.interpolate 导入 UnivariateSplinex = np.arange(len(y))f = UnivariateSpline(x, y, s=7)plt.plot(x,f(x))
在玩弄了 s
参数后,我得到了这个
现在我想在现在的斜坡上找到一个突然的跳跃来切断.所以我绘制了有序的负斜率,而忽略了前 50 个值.
dy = np.sort(f.derivative()(x[50:]))plt.plot(dy[dy<0])
在我看来,这看起来像是在 -0.01 左右突然跳跃.因此,让我们尝试将所有坡度标记为更陡峭(即小于该坡度),同时仍然忽略前 50 个值.
idx = np.argwhere((f.derivative()(x) <-0.01) & (x > 50))点 = x[idx]plt.plot(x,f(x))plt.scatter(points,f(points), c='r')
我们还可以打印区域开始和结束的 x 坐标
idx.min(), idx.max()
给我们
(403, 496)
I have to find start and endpoint of steepest slope in dataset. Dataset shows temperature changes during experiment. Cooling down start about 420 frame and ends around 500 frame. Could someone help me how I can calculate this points?
y = [308.09262874940794, 308.1216944088393, 308.2620809214068, 308.2185299674233, 308.0441705852154, 308.06355616177564, 307.9374947672655, 308.15075314506964, 308.0684020743851, 307.9859953521339, 308.0974735069697, 308.1265380121872, 308.09262874940794, 308.0780933219296, 307.9859953521339, 308.0247819257457, 308.0005417638036, 308.1555955950364, 308.09262874940794, 308.0780933219296, 308.17496347364175, 308.2185299674233, 308.20400953030344, 308.2378878644666, 308.2524042737181, 308.22336972940053, 308.3056163523782, 308.3829743977657, 308.34913627709466, 308.08778379939605, 308.3636394757246, 308.3636394757246, 308.3636394757246, 308.4844326170746, 308.4361296746482, 308.5375438416535, 308.460283529643, 308.5761557193945, 308.64852019740135, 308.69673945106905, 308.53271650065454, 308.6919183792268, 308.63405072092854, 308.55202472271446, 308.585806786816, 308.6533429765644, 308.6822756666845, 308.7690327906589, 308.64852019740135, 308.735301202496, 308.8364681549037, 308.77866868368494, 308.7690327906589, 308.8075718225567, 308.8701719464355, 308.75939614063134, 308.8172046893795, 308.69673945106905, 308.88942710227735, 308.9952765331329, 308.88942710227735, 309.1634857265685, 308.9375517868669, 308.9423632184057, 309.00489468840124, 308.9760379640753, 308.9423632184057, 309.0289367843301, 309.0385523062737, 308.9231163613786, 309.18269499806115, 308.9231163613786, 309.0000857048534, 309.20190127232803, 309.07700687606655, 309.0193205102312, 309.19709998467357, 308.9952765331329, 309.09142424016557, 309.05297417928875, 309.0577810944096, 309.20190127232803, 309.105839914524, 309.04816707624076, 309.11544942564836, 309.18749684756233, 309.1586829402123, 309.38900566395995, 309.31227925555163, 309.2690996495939, 309.2978877349221, 309.2211045507886, 309.283494533135, 309.2786964255123, 309.2115032859454, 309.1634857265685, 309.3362613889812, 309.3602388569431, 309.2786964255123, 309.29309018781777, 309.37462309944226, 309.14427345642935, 309.17789296123334, 309.2115032859454, 309.3650337909219, 309.31707605560723, 309.37462309944226, 309.30748226876693, 309.3314653356209, 309.302685095231, 309.3362613889812, 309.3362613889812, 309.2595021259639, 309.19709998467357, 309.2163040119527, 309.2786964255123, 309.0577810944096, 309.11544942564836, 309.2786964255123, 309.00970348379855, 309.0241287413112, 309.05297417928875, 309.04816707624076, 309.0818128518856, 309.0818128518856, 309.0818128518856, 309.1394699201895, 309.3650337909219, 309.2403048348614, 309.25470308370177, 309.20190127232803, 309.2163040119527, 309.22590490247524, 309.37462309944226, 309.2499038544454, 309.1298622851081, 309.23550504448957, 309.31707605560723, 309.2115032859454, 309.2307050670348, 309.11544942564836, 309.302685095231, 309.2499038544454, 309.3314653356209, 309.30748226876693, 309.18749684756233, 309.2115032859454, 309.06739436095876, 309.2211045507886, 309.1010348774497, 309.1634857265685, 309.0818128518856, 309.20190127232803, 309.2403048348614, 309.11064476391624, 309.17789296123334, 308.9808478887107, 309.07700687606655, 309.19709998467357, 309.09142424016557, 309.0193205102312, 309.0289367843301, 308.9664175499284, 309.05297417928875, 309.0385523062737, 309.1298622851081, 309.0337446393101, 309.2499038544454, 309.25470308370177, 309.0193205102312, 309.0289367843301, 309.04816707624076, 309.00489468840124, 309.0193205102312, 309.01451209106773, 309.0722007124317, 309.01451209106773, 308.9904671732171, 309.17789296123334, 309.00489468840124, 308.9375517868669, 308.9760379640753, 309.01451209106773, 308.9471744615032, 309.120253899743, 309.0193205102312, 309.0337446393101, 309.0625878216255, 309.0385523062737, 308.9616070603721, 309.120253899743, 309.11544942564836, 308.95198551618194, 309.1298622851081, 308.9423632184057, 309.06739436095876, 309.22590490247524, 309.00970348379855, 308.9760379640753, 309.01451209106773, 308.9664175499284, 309.0193205102312, 309.0722007124317, 308.9616070603721, 309.1538799664186, 309.2211045507886, 308.9086792391121, 308.9327401668644, 308.83165257198146, 309.0193205102312, 309.01451209106773, 309.0722007124317, 309.0722007124317, 309.0722007124317, 308.7304816467341, 308.8364681549037, 308.8364681549037, 308.8172046893795, 308.85572859746634, 308.9038664878567, 308.7738508317859, 308.9134918017692, 308.79312110424047, 308.7834863463787, 308.95198551618194, 308.80275510555146, 308.72566190154123, 308.8123883504919, 308.8075718225567, 308.8509137701496, 308.8268368001017, 308.86054323593794, 308.7304816467341, 308.7401205688495, 308.77866868368494, 308.77866868368494, 308.79793819945354, 308.7449397458172, 308.7690327906589, 308.74975873342174, 308.74975873342174, 308.7063810260086, 308.6774540259391, 308.8364681549037, 308.71602184277236, 308.71602184277236, 308.8075718225567, 308.7112015291512, 308.83165257198146, 308.71602184277236, 308.71602184277236, 308.60028196217667, 308.735301202496, 308.66298796553434, 308.7401205688495, 308.6919183792268, 308.61475542715624, 308.7834863463787, 308.8075718225567, 308.5471979526607, 308.6919183792268, 308.7401205688495, 308.7112015291512, 308.619579535504, 308.7208419668949, 308.619579535504, 308.735301202496, 308.7208419668949, 308.6919183792268, 308.75939614063134, 308.71602184277236, 308.7738508317859, 308.7015603333221, 308.6533429765644, 308.6244034539002, 308.6244034539002, 308.6919183792268, 308.8075718225567, 308.64369722842287, 308.8075718225567, 308.7112015291512, 308.7208419668949, 308.7112015291512, 308.7015603333221, 308.8123883504919, 308.7690327906589, 308.6774540259391, 308.6774540259391, 308.5278889692949, 308.61475542715624, 308.65816556593444, 308.6919183792268, 308.72566190154123, 308.6822756666845, 308.7015603333221, 308.79312110424047, 308.8268368001017, 308.7063810260086, 308.77866868368494, 308.88942710227735, 308.88942710227735, 308.62922718236746, 308.585806786816, 308.5713299004612, 308.619579535504, 308.59545709379574, 308.60510664051526, 308.6678101753866, 308.5471979526607, 308.6244034539002, 308.5713299004612, 308.513405232825, 308.59545709379574, 308.6678101753866, 308.51823333540295, 308.58098134817186, 308.5713299004612, 308.66298796553434, 308.5713299004612, 308.6678101753866, 308.561677692036, 308.60510664051526, 308.585806786816, 308.61475542715624, 308.58098134817186, 308.4747735540269, 308.619579535504, 308.5375438416535, 308.513405232825, 308.4844326170746, 308.53271650065454, 308.7545775316855, 308.619579535504, 308.5423709923146, 308.53271650065454, 308.58098134817186, 308.561677692036, 308.6099311288342, 308.63405072092854, 308.47960318085643, 308.59063203534976, 308.6388740696062, 308.5471979526607, 308.5761557193945, 308.5761557193945, 308.3829743977657, 308.619579535504, 308.513405232825, 308.5375438416535, 308.6099311288342, 308.5713299004612, 308.48926186270444, 308.55202472271446, 308.460283529643, 308.585806786816, 308.7545775316855, 308.49891978229, 308.4264667970933, 308.585806786816, 308.49409091776863, 308.56650389134927, 308.5713299004612, 308.55685130249867, 308.5085769397954, 308.7063810260086, 308.6099311288342, 308.56650389134927, 308.6533429765644, 308.58098134817186, 308.55685130249867, 308.55202472271446, 308.59545709379574, 308.71602184277236, 308.4506225599124, 308.585806786816, 308.72566190154123, 308.64369722842287, 308.619579535504, 308.561677692036, 308.44579178893633, 308.3539708678361, 308.5761557193945, 308.4747735540269, 308.5085769397954, 308.55202472271446, 308.5423709923146, 308.6244034539002, 308.6244034539002, 308.6244034539002, 308.59545709379574, 308.561677692036, 308.71602184277236, 308.7208419668949, 308.75939614063134, 308.7208419668949, 308.6919183792268, 308.7015603333221, 308.69673945106905, 308.6244034539002, 308.72566190154123, 308.6870971177729, 308.7208419668949, 308.67263219551404, 308.63405072092854, 308.58098134817186, 308.6099311288342, 308.7063810260086, 308.7401205688495, 308.71602184277236, 308.7063810260086, 308.59063203534976, 308.66298796553434, 308.61475542715624, 308.65816556593444, 308.3829743977657, 308.179804963093, 308.01993427899953, 307.7238623656049, 307.7870200759143, 307.79187700324024, 307.9956931528356, 307.7967337366716, 307.7432990008586, 307.65094729432553, 307.5828537304289, 307.4757723506065, 307.4757723506065, 307.5925837197807, 307.45629285398684, 307.4757723506065, 307.44655193263713, 307.43681022900745, 307.3442249919368, 307.3442249919368, 307.21741467075975, 306.9438325912993, 307.29546750001407, 307.1148939020285, 307.1246615279916, 307.1393114883849, 307.1246615279916, 307.2857136466891, 307.0171742273997, 307.1246615279916, 307.06115785452863, 307.1344283653618, 307.0709298211955, 306.95850448065585, 306.95850448065585, 307.01228616964715, 306.7970155589062, 306.86065819859596, 306.9438325912993, 306.80191233851883, 306.95361404887177, 306.9633947144708, 306.91448346480337, 306.7578341641973, 306.77742645250083, 306.7186400356454, 306.80191233851883, 306.7627325346616, 306.7333393268934, 306.6402135269444, 306.7872214033432, 306.6647272939214, 306.7627325346616, 306.65982493948627, 306.6255028723101, 306.772528678789, 306.7431378589092, 306.65492238559546, 306.6255028723101, 306.586265674549, 306.58136012587954, 306.58136012587954, 306.35548845128324, 306.4341006255742, 306.4341006255742, 306.4586563943867, 306.4341006255742, 306.27190663753186, 306.27682482487546, 306.3112464989674, 306.46356694665616, 306.3063297207779, 306.3161630759486, 306.34074294360084, 306.1587326897794, 306.2030308556243, 305.9665846821754, 305.9419280279521, 305.76425004708364, 305.93699608794924, 305.79388137173896, 305.7049653605219, 305.71484818345783, 305.630818125787, 305.7790666270583, 305.6654258946194, 305.7395516668316, 305.8136315109291, 306.1242672507756, 306.3456583138544, 306.42918887014565, 306.35057348307356, 306.5372011917228, 306.49793520160534, 306.6156947711249, 306.5715484289708, 306.42918887014565, 306.6451166793491, 306.7137398736051, 306.6843347175962, 306.6696294489255, 306.6696294489255, 306.6255028723101, 306.7382386924333, 306.76763070618404, 306.7235399985239, 306.77742645250083, 306.7823240273442, 306.88023379933344, 306.77742645250083, 306.9046988373983, 306.8704463957765, 306.86065819859596, 306.95361404887177, 306.96828475034096, 306.8655523964013, 306.9046988373983, 306.855763802336, 306.9193754812128, 306.96828475034096, 307.05627157501516, 306.9633947144708, 306.95361404887177, 307.0025094610091, 306.92915891956665, 307.0025094610091, 307.08070099820964, 306.9633947144708, 307.0416115514648, 307.15884200995754, 306.96828475034096, 307.09047138576403, 307.0025094610091, 307.05627157501516, 307.1978935996081, 307.1734878327647, 307.19301283991086, 307.19301283991086, 307.1344283653618, 307.14419441433193, 307.0660439365807, 307.17836937985277, 307.10512548728025, 307.1881318834019, 307.17836937985277, 307.2564473733913, 307.15884200995754, 307.28083642550376, 307.28083642550376, 306.8900204094612, 307.2662035835691, 307.2662035835691, 307.2662035835691, 307.32959980418053, 307.24181158431395, 307.30522056810406, 307.23205340877587, 307.3003441322015, 307.3003441322015, 307.22229444675827, 307.1100097932646, 307.23205340877587, 307.2466903772131, 307.2613255767183, 307.3247243493438, 307.8889748630513, 307.30522056810406, 307.3978355878861, 307.40758042253736, 307.2857136466891, 307.2515689735642, 307.19301283991086, 307.3393501254531, 307.2857136466891, 307.38808997000365, 307.4027081031038, 307.38808997000365, 307.3442249919368, 307.33447506287564, 307.4319390837782, 307.40758042253736, 307.28083642550376, 307.2857136466891, 307.3149728511503, 307.3832168672912, 307.36372249741055, 307.3490996623505, 307.31984869834173, 307.4124525462108, 307.47090276965224, 307.48064173613346, 307.3003441322015, 307.41732447414785, 307.5147219648439, 307.45629285398684, 307.45629285398684, 307.3832168672912, 307.5147219648439, 307.6120413603623, 307.5682572845433, 307.50985394664536, 307.57798844340505, 307.3978355878861, 307.4027081031038, 307.36372249741055, 307.5390591277433, 307.45629285398684, 307.4270677429077, 307.4952487203862, 307.48064173613346, 307.45142249108505, 307.3978355878861, 307.62176901196995, 307.5390591277433, 307.6606718315838, 307.5001173244402, 307.5147219648439, 307.6801185719411, 307.6314958847072, 307.573122961451, 307.52932484810736, 307.50985394664536, 307.573122961451, 307.63635902905844, 307.57798844340505, 307.6266325456856, 307.5828537304289, 307.7044226227817, 307.68497977088464, 307.62176901196995, 307.65094729432553, 307.5390591277433, 307.60231292969553, 307.50498573318544, 307.573122961451, 307.62176901196995, 307.7821629546704, 307.6120413603623, 307.5828537304289, 307.50985394664536, 307.6120413603623, 307.48064173613346, 307.48064173613346, 307.48064173613346, 307.33447506287564, 307.4416811786191, 307.5536590838609, 307.5682572845433, 307.65094729432553, 307.77244813033496, 307.50498573318544, 307.5147219648439, 307.69956220134196, 307.60717724242306, 307.646084733844, 307.68984077541694, 307.7675904271966, 307.5828537304289, 307.61690528353665, 307.65094729432553, 307.7190027212925, 307.6266325456856, 307.646084733844, 307.6120413603623, 307.5390591277433, 307.65094729432553, 307.6266325456856, 307.67525717856273, 307.7190027212925, 307.8938277235077, 307.6606718315838, 307.7675904271966, 307.646084733844, 307.7432990008586, 307.77244813033496, 307.6606718315838, 307.73358107158396, 307.80159027623193, 307.6412219787628, 307.69956220134196, 307.7044226227817, 307.7384401332976, 307.65094729432553, 307.7092828499044, 307.84529041194054, 307.7092828499044, 307.6703955907262, 307.7481576742905, 307.6606718315838, 307.5487926269017, 307.66553380840764, 307.53419208549684, 307.8938277235077, 307.75787443886094, 307.7092828499044, 307.7821629546704, 307.77244813033496, 307.68497977088464, 307.75787443886094, 307.65580966023083, 307.68984077541694, 307.73358107158396, 307.71414288273354, 307.7092828499044, 307.65580966023083, 307.82101449623093, 307.9471964290412, 307.7967337366716, 307.84043561616613, 307.75787443886094, 307.9180891252065, 307.8598536375354, 307.8598536375354, 307.84043561616613, 307.7384401332976, 307.8307254436129, 307.73358107158396, 307.82101449623093, 307.87926856183515, 307.7190027212925, 307.8064466219446, 307.8889748630513, 307.72872181569426, 307.93264364659916, 307.8744151210287, 307.8938277235077, 307.8598536375354, 307.83558062673137, 307.85014501407795, 307.8064466219446, 307.82587006678716, 307.83558062673137, 307.75787443886094, 307.8598536375354, 307.7481576742905, 307.7481576742905, 307.7481576742905, 307.5974484221559, 307.5828537304289, 307.7092828499044, 307.8064466219446, 307.65094729432553, 307.7821629546704, 307.87926856183515, 307.7675904271966, 307.93264364659916, 307.7044226227817, 307.7821629546704, 307.7627325300463, 307.7092828499044, 307.7530161536168, 307.7384401332976, 307.7044226227817, 307.7821629546704, 307.7044226227817, 307.89868039056074, 307.9180891252065, 307.87926856183515, 307.7481576742905, 307.84529041194054, 307.82101449623093, 307.91323723153334, 307.92294082559295, 307.7432990008586, 307.8307254436129, 307.65094729432553, 307.81130277383306, 307.9471964290412, 307.8938277235077, 307.75787443886094, 307.85014501407795, 307.7530161536168, 307.90838514455027, 307.72872181569426, 307.84529041194054]
In my first attempt I used maximum accumulate:
i = np.argmax(np.maximum.accumulate(y) - y)
j = np.argmax(y[:i])
plt.plot(y)
plt.plot([i, j], [y[i], y[j]], 'o', color='Red', markersize=10)
It found maximum percentage drop, but not the steepest one
When I hear slope I think of derivative so I want a function having one. I get one by using a spline interpolation. If you're not familiar with splines they are basically polynomials stitched together to make a smooth function.
from scipy.interpolate import UnivariateSpline
x = np.arange(len(y))
f = UnivariateSpline(x, y, s=7)
plt.plot(x,f(x))
After playing around with the s
parameter I got this
Now I want to find a sudden jump in the slopes present to cut off. So I plot the ordered negative slopes while ignoring the first 50 values.
dy = np.sort(f.derivative()(x[50:]))
plt.plot(dy[dy<0])
To me this looks like there is a sudden jump at around -0.01. So lets try to mark all slopes being steeper i.e. smaller than that while stil ignoring the first 50 values.
idx = np.argwhere((f.derivative()(x) < -0.01) & (x > 50))
points = x[idx]
plt.plot(x,f(x))
plt.scatter(points,f(points), c='r')
And while we are at it we can also print the x coordinates of the beginning and end of the region
idx.min(), idx.max()
giving us
(403, 496)
这篇关于找到最陡坡的起点和终点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!