#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""nntoolkit, the neural network toolkit, is a set of executable scripts
   and Python modules that are useful for neural network evaluation.

   Current scripts include: run.py.
"""


import argparse

import logging
import sys
logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s',
                    level=logging.DEBUG,
                    stream=sys.stdout)

# hwrt modules
# Every HWR tool that should be available through
#   hwrt TOOL
# has to be added to ``get_parser()`` and to ``main``.
import nntoolkit
from nntoolkit import evaluate


def get_parser():
    """Return the parser object for this script."""
    parser = argparse.ArgumentParser(description=__doc__,
                                     prog='nntoolkit')
    parser.add_argument('--version',
                        action='version',
                        version=('nntoolkit %s' % str(nntoolkit.__version__)))
    subparsers = parser.add_subparsers(dest='cmd')
    subparsers.add_parser('evaluate',
                          add_help=False,
                          parents=[evaluate.get_parser()],
                          help="Evaluate the model for a single recording.")
    return parser


def main(args):
    if args.cmd == 'evaluate':
        evaluate.main(args.modelfile, args.inputvec)
    else:
        logging.warning("Subcommand '%s' not implemented.", args.cmds)

if __name__ == '__main__':
    args = get_parser().parse_args()
    main(args)
