Dear all,

I am using external functions to calculate my likelihood, with the help of Black-box example from PyMC3 documentation: https://docs.pymc.io/notebooks/blackbox_external_likelihood.html

Following is my likelihood function:

```
def log_likelihood(theta, data, sigma, x, y, z):
fm = FM.FUN1(theta, x, y, z) # External function to calculate data
# log likelihood
n = len(fm.flatten())
obs_data=data.flatten()
cal_data=fm.flatten()
sigma=np.std(obs_data)
covd=(1/sigma**2) * np.identity(n)
data_residuals=cal_data-obs_data
return np.dot(np.dot(data_residuals.T,covd), data_residuals)
```

When I run HMC sampler through PyMC3, I got following warning:

`warnings.warn("Derivative calculation did not converge: setting flat derivative.")`

And the code executes prematurely with following error:

```
raise ValueError('Too few elements for interval calculation')
ValueError: Too few elements for interval calculation
```

Kindly suggest how can be overcome from these issues.

Thank You