circstat / pycircstat

Toolbox for circular statistics with Python
MIT License
155 stars 42 forks source link

Distribution fitting is not working #57

Open mayanksuman opened 6 years ago

mayanksuman commented 6 years ago

I used the example code for fitting triangular distribution.

from pycircstat.distributions import triangular
import matplotlib.pyplot as plt
import numpy as np

rho = .4
t = np.linspace(0,2*np.pi,1000)
x = triangular.rvs(rho, size=5000)
plt.plot(t, triangular.pdf(t, rho))
plt.plot(t, triangular.cdf(t, rho))
plt.hist(x, bins=50, normed=True)
plt.show()

However, this code fails with error that optimization fail to converge after 100 iteration. Same is the case with cardioid distribution.

fabiansinz commented 6 years ago

Ok, I verified that. Seems to be a change on the scipy side. Basically, the rvs is using an optimization procedure from scipy via scipy.stats. That worked in the past, but does not anymore. We need to investigate how to best fix that.