#!/usr/bin/env python
import argparse
import sys

from core.training import TrainingNetwork
from core.models import Signal, Detector

import logging
log = logging.getLogger()


if __name__ == "__main__":
    log.setLevel(logging.DEBUG)
    logging.basicConfig(format="%(thread)d:%(asctime)s:%(levelname)s:%(module)s :: %(message)s")

    parser = argparse.ArgumentParser()
    parser.add_argument('-s', '--signals', type=str,
                        help='Signals in the format of rssi,rssi,...')
    parser.add_argument('-d', '--detectors', type=str,
                        help='Detectors in the format of uuid,uuid,...')

    arg = parser.parse_args(sys.argv[1:])

    signal_list = arg.signals.split(",")
    detector_uuid_list = arg.detectors.split(",")

    signals = [ ]
    for idx, rssi in enumerate( signal_list ):
        detector = Detector()
        detector.uuid = detector_uuid_list[idx]

        signal = Signal()
        signal.rssi = float(rssi)
        signal.detector = detector

        signals.append(signal)

    network = TrainingNetwork()
    network.train()

    print network.predict(signals)

@@ -226,13 +226,12 @@
 ing.
-DEBUG
+INFO
 )%0A  
@@ -621,49 +621,250 @@
 .')%0A
-%0A    arg = parser.parse_args(sys.argv%5B1:%5D
+    parser.add_argument('-v', action=%22store_true%22, dest=%22verbose%22, default=False,%0A                        help='Show verbose logging messages')%0A%0A    arg = parser.parse_args(sys.argv%5B1:%5D)%0A%0A    if arg.verbose:%0A        log.setLevel(logging.DEBUG
 )%0A%0A 

allow setting verbose logging for training test from command line