值错误:设置具有序列和类型的数组元素类型错误:只能将size-1数组转换为Python标量

问题描述

我不断收到错误“ ValueError:设置具有序列的数组元素”。当我尝试执行最后一个函数但不确定如何解决时,将最后一行的“ TypeError:只有大小为1的数组可以转换为Python标量”。前两个函数返回大数组,我需要将这些数组中的特定列输入到最后一个函数中。请帮忙。

def noinhibitorNOGAP1(x,tspan):
    jplc = b13v[0] * x[1] * x[3] #production of IP3 from PLCp
    Jip3deg = b[14] * x[0] #degradation of IP3 by phosphatase
    jplcact = 0.0045 * x[2] #activation of PLCp by ligand binding
    jplcdeact = 0.0396 * x[1] #dephosphorylation of PLCp
    Jcrac = b[6] * ((b[8]**3)/((b[8]**3)+(x[5]**3))) * (CaEx/(b[23]+CaEx))
    Jpmca = b[2] * ((x[3]**2)/((x[3]**2)+(b[3]**2)))
    Jserca = b[0] * (x[3]**2)/((x[3]**2) + (b[1]**2)) #serca
    Jerleak = x[5] * b[4] 
    Jip3 = x[5] * b[9] * ((x[0]/(x[0]+b[11]))**3) * ((x[3]/(x[3]+b[12]))**3) * (x[4]**3)
    Jpmleak = b[7] * CaEx;
    Jmitout = b[17] * x[6] * ((x[3]**2)/((x[3]**2)+(b[22]**2)));
    Jmitin = b[15] * ((x[3]**4)/((x[3]**4)+(b[16]**4)));
    Q = 1 * (x[0]+b[11]) / (x[0]+b[19]) #Q= effective affinity of Ca2+ to the site of inhibition
    
    dx[0] = jplc - Jip3deg
    dx[1] = jplcact - jplcdeact #PLCgammap
    dx[2] = -jplcact #Ligand
    dx[3] = b[26] * (Jcrac-Jpmca-Jserca+Jerleak+Jip3+Jpmleak+Jmitout-Jmitin) #Cacyt
    dx[4] = b[18] * (Q-x[4]*(x[3]+Q)) #h
    dx[5] = b[10] * Jserca - b[10] * Jip3 - b[10] * Jerleak #CaE
    dx[6] = b[20] * Jmitin - b[20] * Jmitout #Camit
    return dx

def noinhibitorNOGAP2(x,tspan):
    jplc = b13v[1] * x[1] * x[3] #production of IP3 from PLCp
    Jip3deg = b[14] * x[0] #degradation of IP3 by phosphatase
    jplcact = 0.0045 * x[2] #activation of PLCp by ligand binding
    jplcdeact = 0.0396 * x[1] #dephosphorylation of PLCp
    Jcrac = b[6] * ((b[8]**3)/((b[8]**3)+(x[5]**3))) * (CaEx/(b[23]+CaEx))
    Jpmca = b[2] * ((x[3]**2)/((x[3]**2)+(b[3]**2)))
    Jserca = b[0] * (x[3]**2)/((x[3]**2) + (b[1]**2)) #serca
    Jerleak = x[5] * b[4] 
    Jip3 = x[5] * b[9] * ((x[0]/(x[0]+b[11]))**3) * ((x[3]/(x[3]+b[12]))**3) * (x[4]**3)
    Jpmleak = b[7] * CaEx;
    Jmitout = b[17] * x[6] * ((x[3]**2)/((x[3]**2)+(b[22]**2)));
    Jmitin = b[15] * ((x[3]**4)/((x[3]**4)+(b[16]**4)));
    Q = 1 * (x[0]+b[11]) / (x[0]+b[19]) #Q= effective affinity of Ca2+ to the site of inhibition
    
    dx[0] = jplc - Jip3deg
    dx[1] = jplcact - jplcdeact #PLCgammap
    dx[2] = -jplcact #Ligand
    dx[3] = b[26] * (Jcrac-Jpmca-Jserca+Jerleak+Jip3+Jpmleak+Jmitout-Jmitin) #Cacyt
    dx[4] = b[18] * (Q-x[4]*(x[3]+Q)) #h
    dx[5] = b[10] * Jserca - b[10] * Jip3 - b[10] * Jerleak #CaE
    dx[6] = b[20] * Jmitin - b[20] * Jmitout #Camit
    return dx

tspan = np.arange(0,tdata[5],0.1)

x1nogap = odeint(noinhibitorNOGAP1,x0,tspan)
x2nogap = odeint(noinhibitorNOGAP2,tspan)

xx1nogap = np.hsplit(x1nogap,7)
xx2nogap = np.hsplit(x2nogap,7)

def noinhibitorGAP1(x,tspan,x1,x2):
    adjset = Gij * (x1 - x2)
    jplc = b13v[0] * x[1] * x[3] #production of IP3 from PLCp
    Jip3deg = b[14] * x[0] #degradation of IP3 by phosphatase
    jplcact = 0.0045 * x[2] #activation of PLCp by ligand binding
    jplcdeact = 0.0396 * x[1] #dephosphorylation of PLCp
    Jcrac = b[6] * ((b[8]**3)/((b[8]**3)+(x[5]**3))) * (CaEx/(b[23]+CaEx))
    Jpmca = b[2] * ((x[3]**2)/((x[3]**2)+(b[3]**2)))
    Jserca = b[0] * (x[3]**2)/((x[3]**2) + (b[1]**2)) #serca
    Jerleak = x[5] * b[4] 
    Jip3 = x[5] * b[9] * ((x[0]/(x[0]+b[11]))**3) * ((x[3]/(x[3]+b[12]))**3) * (x[4]**3) - adjset
    Jpmleak = b[7] * CaEx;
    Jmitout = b[17] * x[6] * ((x[3]**2)/((x[3]**2)+(b[22]**2)));
    Jmitin = b[15] * ((x[3]**4)/((x[3]**4)+(b[16]**4)));
    Q = 1 * (x[0]+b[11]) / (x[0]+b[19]) #Q= effective affinity of Ca2+ to the site of inhibition
    
    dx[0] = jplc - Jip3deg
    dx[1] = jplcact - jplcdeact #PLCgammap
    dx[2] = -jplcact #Ligand
    dx[3] = b[26] * (Jcrac-Jpmca-Jserca+Jerleak+Jip3+Jpmleak+Jmitout-Jmitin) #Cacyt
    dx[4] = b[18] * (Q-x[4]*(x[3]+Q)) #h
    dx[5] = b[10] * Jserca - b[10] * Jip3 - b[10] * Jerleak #CaE
    dx[6] = b[20] * Jmitin - b[20] * Jmitout #Camit
    return dx

x1gap = odeint(noinhibitorGAP1,args=(xx1nogap[0],xx2nogap[0]))

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...