我已经将问题隔离到了一个情况下。这是代码:
import numpy as np
from scipy import interpolate
P = np.array([[-0.32617197, -0.2920095 , -0.46557174, -0.81794844, -1.29219631,-1.81947447, -2.32841281, -2.75178671, -3.03194729, -3.12576901,-3.00960991, -2.6846482 , -2.18283861, -1.57343334, -0.96880183,-0.52132021],[ 0.26979365, 0.21207852, -0.04285966, -0.44843864, -0.93769524,-1.43878605, -1.88334371, -2.21217161, -2.37976096, -2.35832431,-2.14170154, -1.74925879, -1.22957792, -0.66299164, -0.15978676,0.15787639],[ 0.88005791, 0.75688371, 0.45630493, 0.03749351, -0.42869796,-0.87313496, -1.2350965 , -1.46659168, -1.53565157, -1.42914945,-1.15533001, -0.74592665, -0.25731003, 0.230784 , 0.62261907,0.83078598],[ 1.43941451, 1.27684403, 0.96136466, 0.55966746, 0.14141966,-0.23103704, -0.50731149, -0.65168608, -0.64504881, -0.48640796,-0.19400188, 0.19429156, 0.62197232, 1.017876 , 1.30628307,1.4313914 ],[ 1.88963563, 1.71157922, 1.40653829, 1.04395233, 0.68826473,0.39234334, 0.19511948, 0.12049842, 0.17675042, 0.35620331,0.63536282, 0.97584839, 1.32687424, 1.6305647 , 1.83245472,1.90239222],[ 2.18411701, 2.01162102, 1.73714652, 1.42853859, 1.14195763,0.91932419, 0.78821399, 0.76227809, 0.84176998, 1.01419604,1.25532094, 1.53093814, 1.80003031, 2.02024623, 2.15707825,2.19902306],[ 2.29104308, 2.1421795 , 1.91361664, 1.66775429, 1.4503379 ,1.29192654, 1.20984338, 1.20983398, 1.28741951, 1.4291507 ,1.61406933, 1.8157611 , 2.00546122, 2.15673162, 2.25214955,2.29158209],[ 2.19592259, 2.08585339, 1.91410389, 1.73433293, 1.58065059,1.47280881, 1.41982043, 1.4224534 , 1.47500701, 1.56675335,1.68339946, 1.80889599, 1.9278646 , 2.02875986, 2.10734416,2.16766927],[ 1.90364107, 1.84456778, 1.73613883, 1.62063181, 1.52025046,1.44542853, 1.39954856, 1.38175761, 1.38870078, 1.41571194,1.45783921, 1.51095031, 1.57299489, 1.64516681, 1.73180054,1.83422428],[ 1.44006075, 1.44084294, 1.39747465, 1.33903092, 1.27658655,1.2136941 , 1.1514551 , 1.09105368, 1.03495315, 0.98741407,0.95470048, 0.94511938, 0.96877897, 1.03648204, 1.15598539,1.31935859],[ 0.85310219, 0.91835379, 0.93613205, 0.9215548 , 0.8765544 ,0.80122736, 0.69834088, 0.57492521, 0.44245456, 0.31632919,0.21496974, 0.15854801, 0.16705806, 0.25687478, 0.43359029,0.67392233],[ 0.21307688, 0.34155231, 0.40945286, 0.41859933, 0.36519017,0.25030719, 0.08279525, -0.1207412 , -0.33717397, -0.53865813,-0.69481594, -0.77541611, -0.75400979, -0.61357493, -0.35663432,-0.02737189],[-0.38828494, -0.20618069, -0.10828106, -0.10352304, -0.1963743 ,-0.37937371, -0.63300958, -0.92785655, -1.22745851, -1.49150626,-1.67930326, -1.75379581, -1.686765 , -1.46634547, -1.10937656,-0.68572898],[-0.84138209, -0.62697398, -0.53053551, -0.56670839, -0.73371373,-1.01170006, -1.36634378, -1.75332884, -2.12281348, -2.42382663,-2.60882774, -2.63885557, -2.48994855, -2.16200449, -1.69237297,-1.18012379],[-1.02796263, -0.81797582, -0.76730311, -0.88757639, -1.16219484,-1.55335615, -2.0095011 , -2.47170348, -2.87925404, -3.17486091,-3.30992002, -3.2503765 , -2.98386161, -2.52913175, -1.94957254,-1.37448646],[-0.8453655 , -0.69344726, -0.74272994, -0.98708156, -1.38715991,-1.88505859, -2.41377971, -2.90431974, -3.29154662, -3.51958352,-3.54724604, -3.35404368, -2.94730867, -2.3711353 , -1.71790821,-1.14235009]])
xnew = np.array([[ 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. ,0. , 0. , 0. , 0. , 0. ],[ 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2,0.2, 0.2, 0.2, 0.2, 0.2],[ 0.4, 0.4, 0.4, 0.4, 0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0.8, 1. , 1.2, 1.4, 1.6, 1.8, 2. ,2.2, 2.4, 2.6, 2.8, 3. ],[ 0. , 0.2, 0.4, 0.6, 0.8, 1. , 1.2, 1.4, 1.6, 1.8, 2. ,2.2, 2.4, 2.6, 2.8, 3. ],[ 0. , 0.2, 0.4, 0.6, 0.8, 1. , 1.2, 1.4, 1.6, 1.8, 2. ,2.2, 2.4, 2.6, 2.8, 3. ],[ 0. , 0.2, 0.4, 0.6, 0.8, 1. , 1.2, 1.4, 1.6, 1.8, 2. ,2.2, 2.4, 2.6, 2.8, 3. ]])
tckP=interpolate.bisplrep(xnew,ynew,P,s=0)
如果我运行了此代码,请获取细分故障...为什么?!
感谢提前的任何帮助
[编辑]
使用GDB获取此信息:
...
Program received signal SIGSEGV, Segmentation fault.
0x00007fffed3f53c4 in fprank_ () from /usr/lib64/python2.7/site-packages/scipy/interpolate/_fitpack.so
使用python中的详细选项获取:
...
dlopen("/usr/lib64/python2.7/site-packages/scipy/spatial/_distance_wrap.so", 2);
import scipy.spatial._distance_wrap # dynamically loaded from /usr/lib64/python2.7/site- packages/scipy/spatial/_distance_wrap.so
import scipy.interpolate.interpnd # dynamically loaded from /usr/lib64/python2.7/site-packages/scipy/interpolate/interpnd.so
我也将作为错误报告,谢谢您的评论
[编辑#2]
GDB的回溯说:
(gdb) bt
#0 0x00007fffec7053c4 in fprank_ ()
from /usr/lib64/python2.7/site-packages/scipy/interpolate/_fitpack.so
#1 0x00007fffec6fcee3 in fpsurf_ ()
from /usr/lib64/python2.7/site-packages/scipy/interpolate/_fitpack.so
#2 0x00007fffec6df46b in surfit_ ()
from /usr/lib64/python2.7/site-packages/scipy/interpolate/_fitpack.so
#3 0x00007fffec6c995b in ?? ()
from /usr/lib64/python2.7/site-packages/scipy/interpolate/_fitpack.so
#4 0x0000003d564dd0e1 in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0
#5 0x0000003d564ddb1f in PyEval_EvalCodeEx () from /lib64/libpython2.7.so.1.0
#6 0x0000003d564dc113 in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0
#7 0x0000003d564ddb1f in PyEval_EvalCodeEx () from /lib64/libpython2.7.so.1.0
#8 0x0000003d564ddbf2 in PyEval_EvalCode () from /lib64/libpython2.7.so.1.0
#9 0x0000003d564f6b9a in ?? () from /lib64/libpython2.7.so.1.0
#10 0x0000003d564f7992 in PyRun_FileExFlags () from /lib64/libpython2.7.so.1.0
#11 0x0000003d564f83ab in PyRun_SimpleFileExFlags ()
from /lib64/libpython2.7.so.1.0
#12 0x0000003d56509882 in Py_Main () from /lib64/libpython2.7.so.1.0
#13 0x000000365e221735 in __libc_start_main () from /lib64/libc.so.6
#14 0x00000000004006f1 in _start ()
stackoverflow中还有另一个条目,有类似的问题:scipy _fitpack fprank_()中的分割故障我认为这里的问题是数据太多
使用 s!=0
s = len(x) +- sqrt(2*len(x))