Ian Murray for example, in forest knutsen reference about the pyramids...
novice pyramid builders... pardon the font
Simple pyramid-ish array... shape (19, 19), ndim 2 ready for interpolation/contouring and shading
Simple pyramid array... shape (19, 19), ndim 2
[[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
[0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0]
[0 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 0]
[0 1 2 3 3 3 3 3 3 3 3 3 3 3 3 3 2 1 0]
[0 1 2 3 4 4 4 4 4 4 4 4 4 4 4 3 2 1 0]
[0 1 2 3 4 5 5 5 5 5 5 5 5 5 4 3 2 1 0]
[0 1 2 3 4 5 6 6 6 6 6 6 6 5 4 3 2 1 0]
[0 1 2 3 4 5 6 7 7 7 7 7 6 5 4 3 2 1 0]
[0 1 2 3 4 5 6 7 8 8 8 7 6 5 4 3 2 1 0]
[0 1 2 3 4 5 6 7 8 9 8 7 6 5 4 3 2 1 0]
[0 1 2 3 4 5 6 7 8 8 8 7 6 5 4 3 2 1 0]
[0 1 2 3 4 5 6 7 7 7 7 7 6 5 4 3 2 1 0]
[0 1 2 3 4 5 6 6 6 6 6 6 6 5 4 3 2 1 0]
[0 1 2 3 4 5 5 5 5 5 5 5 5 5 4 3 2 1 0]
[0 1 2 3 4 4 4 4 4 4 4 4 4 4 4 3 2 1 0]
[0 1 2 3 3 3 3 3 3 3 3 3 3 3 3 3 2 1 0]
[0 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 0]
[0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0]
[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]]
import numpy as np
def pyramid(core=9, steps=10, incr=(1,1)):
"""create a pyramid with a core value, a certain number of steps
decreasing by incr until done
"""
a = np.array([core])
a = np.atleast_2d(a)
for i in range(1,steps):
a = np.lib.pad(a,incr,"constant",constant_values=(core-i,core-i))
print("\nSimple pyramid array... shape {}, ndim {} \n{}".format(a.shape,a.ndim,a))
return a
if __name__=="__main__":
a = pyramid()