def battle_lemarie_experiment():
    wavelet = pywt.Wavelet('bspline3', filter_bank=wavelet_BattleLamarie(m=3))
    #input('o = {}   b = {}'.format(wavelet.orthogonal, wavelet.biorthogonal))
    wavelet.orthogonal = True
    wavelet.biorthogonal = False
    directory = './descomposition {} {}'.format(wavelet.name, os.path.basename(dataset))
    os.mkdir(directory)

    utils.make_to_given_dataset(dataset, plot_descomposition, [wavelet, directory, dataset], v1 = False)
def make_xlsx_cD_haar_entropy_vectorizer():
    dataset = '../datasets/super dataset augmentation'
    bn_dataset = os.path.basename(dataset)
    excels_path = 'excels'
    if not os.path.exists(excels_path):
        os.mkdir(excels_path)
    
    utils.make_to_given_dataset(dataset, make_panda_set.make_excels, args = [entropy.cD_entropy_vectorizer('haar', 1, True) , excels_path])
    make_panda_set.merge_excel('dataset = {} vectorizer = {}'.format(bn_dataset, entropy.special_vectorice.__name__), excels_path)
    print('Finish   {}!'.format(make_xlsx_entropy_vectorizer.__name__))
def make_xlsx_entropy_vectorizer():
    dataset = '../datasets/super dataset augmentation'
    bn_dataset = os.path.basename(dataset)
    excels_path = 'excels {}'.format(bn_dataset)
    if not os.path.exists(excels_path):
        os.mkdir(excels_path)

    utils.make_to_given_dataset(dataset, make_panda_set.make_excels, args = [entropy.make_entropy_vector, excels_path])
    make_panda_set.merge_excel('dataset = {} vectorizer = {}'.format(bn_dataset, entropy.make_entropy_vector.__name__), excels_path)
    print('Finish   make_xlsx_entropy_vectorizer!')
def make_xlsx_all_levels_haar_organized():
    dataset = '../datasets/super dataset augmentation'
    start = time.time()
    bn_dataset = os.path.basename(dataset)
    excels_path = 'excels'
    if not os.path.exists(excels_path):
        os.mkdir(excels_path)            
    
    #make_panda_set.make_excels(vectoricer, excels_path, processer = True, remove_silencess, interpolate)
    vectorizer = entropy.all_levels_vectorizer('haar',3,5)
    args = [vectorizer, excels_path, False, False, False]
    utils.make_to_given_dataset(dataset, make_panda_set.make_excels, args = args)
    make_panda_set.merge_excel('vectorizer = {}'.format(vectorizer.__name__), excels_path)
    print('time making xlsx = {}mins'.format((time.time() - start)/60))
    print('Finish!')
from utils import make_to_given_dataset
from demo import transform
import os


def apply_transform(dataset, entonema, wav, iteations):
    file_path = '{}/{}/{}'.format(dataset, entonema, wav)
    output = './definite augmentation/{}'.format(entonema)
    if (not os.path.exists(output)):
        os.mkdir(output)
    wav = wav.replace('.wav', '')
    '''
    output = '{}/{}'.format(output, wav)
    if(not os.path.exists(output)):
        os.mkdir(output)
    '''
    transform(file_path, output, iteations)


dataset = '../audios/definite'
make_to_given_dataset(dataset,
                      apply_transform,
                      args=[5],
                      max_audio_by_tonema=5)
    if not os.path.exists(excels_path):
        os.mkdir(excels_path)            
    
    #make_panda_set.make_excels(vectoricer, excels_path, processer = True, remove_silencess, interpolate)
    vectorizer = entropy.all_levels_vectorizer('haar',3,5)
    args = [vectorizer, excels_path, False, False, False]
    utils.make_to_given_dataset(dataset, make_panda_set.make_excels, args = args)
    make_panda_set.merge_excel('vectorizer = {}'.format(vectorizer.__name__), excels_path)
    print('time making xlsx = {}mins'.format((time.time() - start)/60))
    print('Finish!')


#make_xlsx_all_levels_haar_organized()
#svm_model.svm_work('../datasets excel/8-/data8.xlsx')

'''
start = time.time()
utils.make_to_given_dataset('../audios/definite', plot_before_after_transformation, max_audio_by_tonema = 5)
print('delay = {}mins'.format((time.time() - start)/60))
'''



'''
start = time.time()
path = "./experimentos/8-"

for sample in os.listdir(path):
    if os.path.isdir('{}/{}'.format(path,sample)):
        for file in os.listdir('{}/{}'.format(path, sample)):
            plot_before_after_transformation(path, sample, file)