import h5py
import keras
import numpy as np
import os
import pandas as pd
import pescador
import tensorflow as tf
import time
import oyaml as yaml
import localmodule
from models import create_flat_singletask_coarse_model
from keras.optimizers import Adam

# Define constants.
train_data_dir = localmodule.get_train_data_dir()
train_dataset_name = localmodule.get_train_dataset_name()
valid_data_dir = localmodule.get_valid_data_dir()
valid_dataset_name = localmodule.get_valid_dataset_name()
models_dir = localmodule.get_models_dir()
n_input_hops = 104
n_filters = [24, 48, 48]
kernel_size = [5, 5]
pool_size = [2, 4]
n_hidden_units = 64

# Read command-line arguments.
parser = argparse.ArgumentParser()
parser.add_argument('aug_kind_str')
parser.add_argument('trial_str')
parser.add_argument('--lr', type=float, default=1e-4)
parser.add_argument('--base-wd', type=float, default=1e-4)
import datetime
import h5py
import librosa
import os
import sys
import time

import localmodule

# Define constants.
dataset_name = localmodule.get_train_dataset_name()
sample_rate = localmodule.get_sample_rate()
args = sys.argv[1:]
data_dir = args[0]
aug_str = args[1]
instance_id = int(args[2])
instance_str = str(instance_id)
if aug_str == "original":
    instanced_aug_str = aug_str
else:
    instanced_aug_str = "-".join([aug_str, instance_str])
pcen_settings = localmodule.get_pcen_settings()

# Print header.
start_time = int(time.time())
print(str(datetime.datetime.now()) + " Start.")
print("Computing per-channel energy normalization (PCEN for clips in " +
      data_dir)
print("Augmentation: " + instanced_aug_str + ".")
print("")
print("h5py version: {:s}".format(h5py.__version__))