def unit_test_iem(): import example_speaker_arrays as esa s = esa.stage2017() # json dump, read s.to_iem_file("test_iem_stage.json") lsl = from_iem_file("test_iem_stage.json") return lsl
def unit_test(): """Run tests for this module.""" from matplotlib import pyplot as plt import example_speaker_arrays as esa s = esa.stage2017() plt.scatter(s.x, s.y, c=s.z, marker='o') plt.grid() plt.colorbar() plt.show() plt.figure(figsize=(12, 6)) plt.scatter(s.az*180/π, s.el*180/π, c='white', marker='o') for x, y, r, t in zip(s.az*180/π, s.el*180/π, s.r, s.ids): plt.text(x, y, t, bbox=dict(facecolor='lightblue', alpha=0.4), horizontalalignment='center', verticalalignment='center') plt.grid() # plt.colorbar() plt.show() lsl = unit_test_iem() return s, lsl
def stage_test(ambisonic_order=3, **kwargs): S = esa.stage2017() return optimize_dome(S, ambisonic_order, **kwargs)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun May 9 15:55:28 2021 @author: heller """ from numpy import pi as π import optimize_dome as od import example_speaker_arrays as esa import localization_models as lm import program_channels as pc import basic_decoders as bd # %% S_stage = esa.stage2017(add_imaginary=True) C31 = pc.ChannelsAmbiX(3, 1) C33 = pc.ChannelsAmbiX(3, 3) # %% # good directionality result res_31 = od.optimize_dome( S_stage, ambisonic_order=C31, eval_order=C31, sparseness_penalty=1.0, el_lim=-π / 4, ) # compare with res_33 = od.optimize_dome(
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun May 16 21:38:12 2021 @author: heller """ from numpy import pi as π import optimize_dome as od import example_speaker_arrays as esa import localization_models as lm import program_channels as pc import basic_decoders as bd # %% S = esa.stage2017(add_imaginary=True) C = pc.ChannelsAmbiX(5, 5) order_h, order_v, sh_l, sh_m, id_string = pc.ambisonic_channels(C) title = f"{S.name}: AllRAD {C.id_string()}" M = bd.allrad(sh_l, sh_m, S.az, S.el, speaker_is_real=S.is_real) lm.plot_performance(M, S.u[S.is_real].T, sh_l, sh_m, title=title) lm.plot_matrix(M, title=title) df_gain_spk, df_gain_tot = lm.diffuse_field_gain(M) # %%