import numpy as np import matplotlib.pyplot as plt from matplotlib.widgets import Slider, Button import random soundscape = np.empty((1000,1)) for i in range(1000): soundscape[(i,0)] = -.03*i-60 brgs = np.ones((1,360)) brg_freq = np.matmul(soundscape, brgs) targ_brg = [60,220] brg_width = [5, 5] tonals = [[20,40,100,500, 800], [30,60,200,250,500]] #build our threat object here tonal_widths = [[2,2,2,2,2], [6,5,4,3,2]] #how diffuse is each tonal decr = [[.8,.8,.8,.90,.90], [.7,.6,.5,.4,.3]] #sound decrement from ambient i = 0 while i < 50000: brg_freq[random.randint(0,999),random.randint(0,359)] = random.randint(-60,-50) i+=1 for azim,spread,x,y,z in zip(targ_brg,brg_width, tonals, tonal_widths, decr): brg = azim - spread//2 while brg <= azim + spread//2: for tone,wide,loud in zip(x,y,z): freq = tone - wide//2 #strength, but we will need to just while freq < tone + wide//2: #assign values brg_freq[(freq,brg)] = -35 # freq += 1 brg += 1 plt.imshow(brg_freq, origin="lower", aspect=.25) plt.colorbar() plt.show()