Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
## Monitor convergence
it = 10
def cb_print(*args):
global it
print(' AuxIVA Iter', it)
it += 10
## Run live BSS
print('* Starting BSS')
bss_type = args.algo
if bss_type == 'auxiva':
# Run AuxIVA
Y = pra.bss.auxiva(X, n_iter=args.n_iter, proj_back=True, callback=cb_print)
elif bss_type == 'ilrma':
# Run ILRMA
Y = pra.bss.ilrma(X, n_iter=args.n_iter, n_components=30, proj_back=True,
callback=cb_print)
elif bss_type == 'fastmnmf':
# Run FastMNMF
Y = pra.bss.fastmnmf(X, n_iter=args.n_iter, n_components=8, n_src=2,
callback=cb_print)
elif bss_type == 'sparseauxiva':
# Estimate set of active frequency bins
ratio = 0.35
average = np.abs(np.mean(np.mean(X, axis=2), axis=0))
k = np.int_(average.shape[0] * ratio)
S = np.sort(np.argpartition(average, -k)[-k:])
# Run SparseAuxIva
Y = pra.bss.sparseauxiva(X, S, n_iter=30, proj_back=True,
callback=cb_print)
## STFT Synthesis
callback=convergence_callback,
)
elif args.algo == "overiva":
# Run AuxIVA
Y = overiva(
X_mics,
n_src=n_sources_target,
n_iter=n_iter,
proj_back=True,
model=args.dist,
init_eig=(args.init == init_choices[1]),
callback=convergence_callback,
)
elif args.algo == "ilrma":
# Run AuxIVA
Y = pra.bss.ilrma(
X_mics,
n_iter=n_iter,
n_components=2,
proj_back=True,
callback=convergence_callback,
)
elif args.algo == "ogive":
# Run OGIVE
Y = ogive(
X_mics,
n_iter=ogive_iter,
step_size=ogive_mu,
update=ogive_update,
proj_back=True,
model=args.dist,
init_eig=(args.init == init_choices[1]),
SIR.append(sir)
## STFT ANALYSIS
X = pra.transform.analysis(mics_signals.T, L, hop, win=win_a)
t_begin = time.perf_counter()
## START BSS
bss_type = args.algo
if bss_type == 'auxiva':
# Run AuxIVA
Y = pra.bss.auxiva(X, n_iter=30, proj_back=True,
callback=convergence_callback)
elif bss_type == 'ilrma':
# Run ILRMA
Y = pra.bss.ilrma(X, n_iter=30, n_components=2, proj_back=True,
callback=convergence_callback)
elif bss_type == 'fastmnmf':
# Run FastMNMF
Y = pra.bss.fastmnmf(X, n_iter=100, n_components=8, n_src=2,
callback=convergence_callback)
elif bss_type == 'sparseauxiva':
# Estimate set of active frequency bins
ratio = 0.35
average = np.abs(np.mean(np.mean(X, axis=2), axis=0))
k = np.int_(average.shape[0] * ratio)
S = np.sort(np.argpartition(average, -k)[-k:])
# Run SparseAuxIva
Y = pra.bss.sparseauxiva(X, S, n_iter=30, proj_back=True,
callback=convergence_callback)
t_end = time.perf_counter()
# Run AuxIVA
# this calls full IVA when `n_src` is not provided
Y = oiva(X_mics, callback=cb, **kwargs)
elif name == "auxiva_pca":
# Run AuxIVA
Y = auxiva_pca(X_mics, n_src=n_targets, callback=cb, **kwargs)
elif name == "oiva":
# Run BlinkIVA
Y = oiva(X_mics, n_src=n_targets, callback=cb, **kwargs)
elif name == "ilrma":
# Run AuxIVA
Y = pra.bss.ilrma(X_mics, callback=cb, **kwargs)
elif name == "ogive":
# Run OGIVE
Y = ogive(X_mics, callback=cb, **kwargs)
else:
continue
t_finish = time.perf_counter()
# The last evaluation
convergence_callback(
Y,
n_targets,
results[-1]["sdr"],
results[-1]["sir"],