我目前正致力于定义数学函数,即
from numpy import tanh
def stravinska(Z, eps=0.5):
return ((-0.86928)+(0.052481*Z))*(tanh(((2.66503)-(4.44255*Z))))-1.251617
SII = np.linspace(-3.0, 0.20)
在
内打电话axScatter_middle.plot(SII, stravinska(Z=0.5), '-k')
但是,编译时会返回以下错误:
ValueError: x and y must have same first dimension
由于我以前曾多次成功使用过这种方法,所以我一直在摸不着自己的错误。这个错误意味着什么,我该如何纠正这个问题?
我基本上试图从本文中绘制等式10:Semi-empirical analysis of Sloan Digital Sky Survey galaxies – III. How to distinguish AGN hosts
答案 0 :(得分:1)
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from numpy import tanh
def stravinska(log_SII_Ha, eps=0):
strav = ((-30.787)+(1.1358*(log_SII_Ha))+(0.27297*((log_SII_Ha)**2)))*(tanh(5.7409* (log_SII_Ha)))-31.093
return strav
SII = np.linspace(-3.0, 0.20)
axScatter_middle.plot(SII, stravinska(SII), '-k')