Skip to content

Instantly share code, notes, and snippets.

@atharvas
Last active September 9, 2020 18:26
Show Gist options
  • Save atharvas/02c72c0dfe2b224098175d699cf2b14f to your computer and use it in GitHub Desktop.
Save atharvas/02c72c0dfe2b224098175d699cf2b14f to your computer and use it in GitHub Desktop.
import numpy as np
import scipy
l = 0.09218/2 # dist b.w. 2 sides of hexagon
f_s_orig = 16000 # sampling frequency
c = scipy.constants.speed_of_sound # speed of sound
user = "2"
setting = "2"
file_path = f"./data/user{user}_setting{setting}/*.csv"
mic_locs_1 = np.array([
[0.5, 0.5],
[0 , 3],
[1.5, 0.5],
[1.5, 3.5],
[2, 1.5],
[0, 1.5],
[3, 3],
[3.5, 0]])
mic_locs_2 = np.array([
[0.5, 2],
[1.25 , 4.25],
[0, 3.5],
[2.75, 1.25],
[0, 0],
[1.5, 0.5],
[2, 3],
[1.5, 2]])
mic_locs_3 = np.array([
[3.5, 1.5],
[5.5 , 0],
[0.5, 3],
[1, 0],
[2, 2],
[0, 0],
[4.5, 3.5],
[4.5, 0]])
mic_locs_4 = np.array([
[0.5, 2.0],
[1.25, 4.25],
[0.0, 3.5],
[2.75, 1.25],
[0.0, 0.0],
[1.5, 0.5],
[2.0, 3.0],
[1.5, 2.0],
])
mic_locs_5 = np.array([
[0.5, 0.5],
[0, 3],
[1.5, 0.5],
[1.5, 3.5],
[2.0, 1.5],
[0.0, 1.5],
[3.0, 3.0],
[3.5, 0.0],
])
mic_locs_6 = np.array([
[0.0, 1.5],
[2.5, 4.5],
[0.0, 0.0],
[5.0, 0.0],
[2.5, 1.5],
[0.0, 3.0],
[2.5, 0.0],
[5.25, 2.5],
])
mic_locs_all = np.array([mic_locs_1, mic_locs_2, mic_locs_3, mic_locs_4, mic_locs_5, mic_locs_6])
mic_locs = mic_locs_all[int(setting) - 1]
actual_x, actual_y = (3,1) if setting == "1" else (4,1)
mic_angles = (60 * (1 - np.arange(6))) * np.pi / 180
resample_factor = 4
board_width = 6
board_height = 4
use_smoothing = False
smoothing_window_len = 41
smoothing_order = 2
aoa_step_angle = 1
aoa_correlate_using_product = True
probs_flatten_using_product = False
step_x = 0.01
step_y = 0.01
f_s = f_s_orig * resample_factor
thresh = 0.9
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View raw

(Sorry about that, but we can’t show files that are this big right now.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment