ZeroDivisionError:

Hello,
when I sample, the sampling process will stop and go wrong,and I don’t know where the error is,I hope I can get some help and advice,Here’s my code:

    time_obseved = [-4.0, -1.0, 0.0, 1.5, 2.0]
    time = np.array(time_obseved)

    H0 = np.zeros((n, n))
    for i in range(0, n):
    for j in range(0, n):
        H0[i, j] = np.abs(time[j] - time[i])


   with pm.Model() as model:
    
    sigma_w = pm.Uniform('sigma_w', 0.0, 2.0)
    rho = pm.Uniform('rho', 0.0, 0.9)
    omega = pm.MvNormal('omega',mu=mu0,cov=sigma_w**2 * tt.pow(rho, H0),shape=(1,n))    
    mu=pm.Normal('mu',mu=0.0,sd=1.0)
    xi=pm.InverseGamma('xi',2.0,1.0)
    b = pm.Normal('b', mu=0.0, sd=tt.sqrt(xi), shape=(N, 1)) 

    mu2 = (mu + b) * e + omega
    
    sigma=pm.Normal('sigma',1.0,0.5)
    y = pm.Normal(
        'y', mu=mu2, sd=sigma,
        observed=dataSet1) 
    with model:
    trace=pm.sample(5000,njobs=1)
    pm.traceplot(trace)

The following error occurred in the runtime:

ZeroDivisionError: 0.0 cannot be raised to a negative power
Apply node that caused the error: Elemwise{Composite{(i0 * i1 * i2 * (i3 ** i4))}}[(0, 0)](Elemwise{Composite{Switch(i0, (((i1 + i2) * i3) - i4), i5)}}[(0, 3)].0, Elemwise{Sqr}[(0, 0)].0, TensorConstant{[[0.  3.  .. 0.5 0. ]]}, InplaceDimShuffle{x,x}.0, TensorConstant{[[-1.   2...0.5 -1. ]]})
Toposort index: 150
Inputs types: [TensorType(float64, matrix), TensorType(float64, (True, True)), TensorType(float64, matrix), TensorType(float64, (True, True)), TensorType(float64, matrix)]
Inputs shapes: [(5, 5), (1, 1), (5, 5), (1, 1), (5, 5)]
Inputs strides: [(40, 8), (8, 8), (40, 8), (8, 8), (40, 8)]
Inputs values: ['not shown', array([[3.99999782]]), 'not shown', array([[0.]]), 'not shown']
Outputs clients: [[Sum{acc_dtype=float64}(Elemwise{Composite{(i0 * i1 * i2 * (i3 ** i4))}}[(0, 0)].0)]]

There are some information missing: what is mu0, e, N, and dataSet1?

n=5
N=200
e=np.ones(n)
mu0 = np.linspace(0.0, 0.0, num=n)

# simulate observation data
C2=np.zeros((n,n))
for i in range(0,n):
    for j in range(0,n):
        C2[i,j]=10.*0.4**np.abs(i-j)

dataSet1 = np.random.multivariate_normal(mu0, C2, size=N)

sigma = pm.Normal('sigma', 1.0, 0.5) <-- sigma for Normal distribution can not be negative. You should change the prior to a Gamma distribution.

Thank you,Your advice has helped me solve the above problems.
In connection with the actual information, I modified the prior distribution of the parameters, but when I ran the code, I encountered another problem.

AttributeError: ‘float’ object has no attribute ‘name’

the location of the problem in the code is:

omega=pm.MvNormal('omega', mu=mu0,cov=cov0,shape=(1,n))    

mu=pm.Normal('mu',mu=0.0,sd=0.1)
xi=pm.InverseGamma('xi',0.5,1.0)
b=pm.Normal('b', mu=0.0, sd=tt.sqrt(xi),shape=(N,1))

mu2=(mu+b)*e+omega
sigma=pm.HalfNormal('sigma',0.0,0.1)

HalfNormal dont need mu parameter, it should be sigma=pm.HalfNormal('sigma', 0.1)