import noise

import numpy as np

import matplotlib.pyplot as plt

grid_x = 30
grid_y = 30
max_x = 8
max_y = 8


x = np.linspace(0,max_x, grid_x)
y = np.linspace(0,max_y, grid_y)

head_dir_preference = np.zeros((grid_x, grid_y))

for x_idx, xx in enumerate(x):
    for y_idx, yy in enumerate(y):
        head_dir_preference[x_idx, y_idx] = noise.pnoise2(xx, yy, octaves=2,  )


fig1 = plt.figure()
plt.set_cmap('twilight')
plt.imshow(head_dir_preference, vmin=-1, vmax=1)
plt.colorbar()

fig2 = plt.figure()
plt.hist(head_dir_preference)

plt.show()