Very nice package! I'm learning stochastic calculus and this is a really cool tool!
I found a small bug:
The paths plotted by SPExplicit.draw() are colored to match the histogram bin that their final point falls into.
If we plot N=3 or fewer paths, then we set n_bins = int(np.sqrt(N)) <= 1, and then this logic which helps set the path colors:
bin_centers = 0.5 * (bins[:-1] + bins[1:])
col = bin_centers - min(bin_centers) # scale values to interval [0,1]
col /= max(col)
results in a divide by zero
/Users/alexrubin/code/aleatory/aleatory/utils/utils.py:76: RuntimeWarning: invalid value encountered in divide
col /= max(col)
because col == [0.].
It seems like the 3 lines of logic above could be replaced by col = np.linspace(0, 1, n_bins, endpoint=True).
Very nice package! I'm learning stochastic calculus and this is a really cool tool!
I found a small bug: The paths plotted by
SPExplicit.draw()
are colored to match the histogram bin that their final point falls into. If we plotN=3
or fewer paths, then we setn_bins = int(np.sqrt(N)) <= 1
, and then this logic which helps set the path colors:results in a divide by zero
because
col == [0.]
.It seems like the 3 lines of logic above could be replaced by
col = np.linspace(0, 1, n_bins, endpoint=True)
.