TypeError:“浮动”对象不是可调用问题

我正在使用PyROOT(ROOT的扩展模块)来尝试从另一个直方图创建直方图,以进行粒子物理数据分析课程。当我尝试在一行中除以许多值时,始终会收到“'float'对象不可调用”错误。

from ROOT import TFile,TDirectory,TTree,TH1F,TCanvas
import math
import numpy as np

myfile = TFile("/home/hilary/root/compile/Research/angle_smearing.root")
hist = file.Get("Zenith_Angles")
hgm = TH1F('Fvsx','Smearing_Test_1',100,90)

for i in range(1,1):
    for y in range (1,1):
        u = hist.GetBinCenter(i)
        N = hist.GetBinContent(i)
        o = 1
        x = hist.GetBinCenter(y)
        F = (N/(o*math.sqrt(2*math.pi))*math.e((-(x-u)**2)/(2*(o**2)))) 
        hgm.Fill(F)

c1 = TCanvas()
hgm.Draw()
c1.SaveAs("/home/hilary/Desktop/Out_going_muons_etc/smearing_test_1.png")

错误出现在读取的行中

F = (N/(o*math.sqrt(2*math.pi))*math.e((-(x-u)**2)/(2*(o**2))))

错误为“ TypeError:'float'对象不可调用”

yanghf0728 回答:TypeError:“浮动”对象不是可调用问题

math.e是常数float;您可能是说math.exp,一个返回e并提升为所提供参数的功能的函数吗?

本文链接:https://www.f2er.com/3047288.html

大家都在问