我不断收到此错误,并想知道是什么引发了该错误。这是我的函数定义:
def spectMixGen(M, samp_size, source_pdf = "uniform", pdf_pars = 1,
pure_pixels = 'no', max_purity = np.ones((1, p)),
no_outliers = 0, violation_extremes = [1, 1.2],
am_modulation = [1, 1], sig_variability = [1, 1],
snr = 40, noise_shape = 'uniform',
noise_pars = [0, 1, 1])
这是我的函数调用:
spectMixGen(M, N, source_pdf = 'Diri_id', pdf_pars = SHAPE_PARAMETER,
max_purity = MAX_PURIRY*np.ones((1,p)), no_outliers = OUTLIERS,
violation_extremes = [1,1.2], snr = SNR, noise_shape = 'uniform')
错误指向我的代码的这一部分:
if (source_pdf == "Diri_mix"):
no_modes, cols = pdf_pars.shape
if cols is not (p+1):
raise ValueError("Wrong pdf parameters")
elif (np.sum(pdf_pars[:,1] != 1)) or (np.sum(pdf_pars[:,1] < 0) > 0):
raise ValueError("Wrong pdf parameters -> mixing weights do not define a probability")
显示以下消息:
AttributeError: 'str' object has no attribute 'equals'
任何人都可以解释此错误吗?我虽然该函数调用将变量source_pdf设置为等于字符串。不是吗?
谢谢