0

私は現在、次のものを持っていますが、i を反復処理しません。なぜ機能しないのかわかりません。Bwavelengthとthroughputはリストです。i は 0 から始まるように見えますが、1 には増えません。

ABconstant=[]

c=3e18
for i in range(0, ((len(Bwavelength))-1)):
    ABconstant1=(((3e18/((Bwavelength[i])**2))*throughput[i]))
    ABconstant.append(ABconstant1)
    i+=1
    a=Bwavelength[0]
    b=Bwavelength[-1]
    h=((b-a)/len(Bwavelength))
    ABflux = numpy.trapz(Bwavelength, ABconstant, h)
return ABflux

私が得るエラーは次のとおりです。

Traceback (most recent call last):
  File "Rewrite17.11.2014.py", line 196, in <module>
    ABflux1 = ABconversion(Bwavelength, throughput)
  File "Rewrite17.11.2014.py", line 186, in ABconversion
    ABflux = numpy.trapz(Bwavelength, ABconstant, h)
  File "C:\Python27\lib\site-packages\numpy\lib\function_base.py, line 3234, in trapz
    ret = add.reduce(d * (y[slice1]+y[slice2]/2.0, axis)
ValueError: Operands could not be broadcast together with shapes (0,) (444,)

B 波長とスループットは同じ長さです。

調べても意味がわかりません。

前もって感謝します。

4

1 に答える 1