functioning examples
This commit is contained in:
parent
e746d7491b
commit
1f93e8bc1e
5 changed files with 102 additions and 30 deletions
|
|
@ -1,38 +1,39 @@
|
|||
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)] = -.003*i-60
|
||||
soundscape[(i,0)] = -.03*i-60
|
||||
brgs = np.ones((1,360))
|
||||
brg_freq = np.matmul(soundscape, brgs)
|
||||
|
||||
targ_brg = [60]
|
||||
brg_width = [5]
|
||||
tonals = [20,40,100,500, 800] #build our threat object here
|
||||
tonal_widths = [2,2,2,2,2] #how diffuse is each tonal
|
||||
decr = [.8,.8,.8,.90,.90] #sound decrement from ambient
|
||||
|
||||
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 in zip(targ_brg,brg_width):
|
||||
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(tonals, tonal_widths, decr):#right now the source is based on bkgd
|
||||
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)] = -50 #
|
||||
brg_freq[(freq,brg)] = -35 #
|
||||
freq += 1
|
||||
brg += 1
|
||||
|
||||
axtime = plt.axes()
|
||||
time = Slider(axtime, "Time", 0, 60)
|
||||
def update(brg):
|
||||
t = time.val
|
||||
time.on_changed(update)
|
||||
|
||||
plt.imshow(brg_freq)
|
||||
plt.imshow(brg_freq, origin="lower", aspect=.25)
|
||||
plt.colorbar()
|
||||
plt.show()
|
||||
|
||||
|
|
@ -40,3 +41,5 @@ plt.show()
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue