Skip to content

Instantly share code, notes, and snippets.

View mapa17's full-sized avatar

Pasieka Manuel mapa17

View GitHub Profile
# Helper script to extract speaker embeddings (x-vectors)
# Call with
# python xvector_extractor.py [INPUT FOLDER containing x-vectors as scp] [OUTPUT File]
import torchaudio
import glob
import pickle
import click
@click.command()
@mapa17
mapa17 / pyexcelerate_to_excel.py
Created September 4, 2018 19:46
A helper function to write pandas.DataFrame to excel using pyexcelerate
import pandas as pd
import numpy as np
import timeit
import pyexcelerate
def pyexecelerate_to_excel(workbook_or_filename, df, sheet_name='Sheet1', origin=(1,1), columns=True, index=False):
"""
Write DataFrame to excel file using pyexelerate library
"""
# Addressed issues in SO post
# https://stackoverflow.com/questions/51268386/sum-matrix-elements-group-by-indices-in-python
import numpy as np
A = np.array([[0.52,0.25,-0.45,0.13],[-0.14,-0.41,0.31,-0.41]])
B = np.array([[1,3,1,2],[3,0,2,2]])
bigA = np.tile(A, (200, 200))
bigB = np.tile(B, (200, 200))