Open philipdavis82 opened 5 years ago
Thanks for sharing your improvement!
May I make some remarks:
if
s, I think you can use the ceil
function in the declaration of d
like that:
d = np.ceil([shape[0] / res[0], shape[1] / res[1]]).astype(int)
g00 = gradients[0:-1,0:-1].repeat(d[0], 0).repeat(d[1], 1)[:shape[0],:shape[1])]
If you want you can make a PR.
Best, Pierre
I got this error when generating noise
I realized it was due to this line
Grid must be a integer multiple of the gradiant size when repeating the gradient or else the sizes will not line up.
for the above example the shape of the grid was
(100, 100, 2)
and the shape of g00 was(80, 80, 2)
. so they were not able to be broadcast by the np.sum function.This was my fix
The idea was just to repeat one more time then slice the matrix for the sum. This way any number should be able to be entered and there are still no loops.
I don't know if this is even an issue for most people, I just wanted to put it here.