报错情况
AttributeError: ‘float’ object has no attribute ‘sqrt’
hy = np.sqrt(envelope_data ** 2 + hx ** 2)
TypeError: loop of ufunc does not support argument 0 of type float which has no callable sqrt method
AttributeError: ‘float’ object has no attribute ‘sqrt’
解决办法
hy = np.sqrt(envelope_data ** 2 + hx ** 2)
改成
hy = np.sqrt((envelope_data ** 2 + hx ** 2).astype('float'))