# Path: lpdec/database/simulation.py
# def init():
# def teardown():
# def existingIdentifiers():
# def addDataPoint(point):
# def dataPoint(code, channel, wordSeed, decoder, identifier):
# def dataPointFromRow(row):
# def search(what, **conditions):
# def simulations(**conditions):
# 
# Path: lpdec/utils.py
# def clock():
#     def clock():
#     def __init__(self):
#     def __enter__(self):
#     def __exit__(self, exc_type, exc_value, exc_tb):
#     def duration(self):
#     def start(self):
#     def stop(self):
# def utcnow():
# def frange(start, end, step=1):
# def splitRanges(rangesString):
# def machineString():
# def isStr(arg):
# class Timer:
# TERM_BOLD_RED = '\033[31;1m'
# TERM_RED = '\033[31m'
# TERM_BOLD = '\033[0;1m'
# TERM_NORMAL = '\033[0m'
# TERM_CYAN = '\033[36m'


import sys
import itertools
import jinja2
        import numbers
    import lpdec.imports  # ensure all decoder and code classes are loaded
    import matplotlib
    import matplotlib.pyplot as plt
from collections import OrderedDict
from dateutil import tz
from lpdec.database import simulation as dbsim
from lpdec import utils
        return ''
    maxLen = max(len(s) for s in stats)
    for stat, val in stats.items():
        if isinstance(val, numbers.Number):
            val = "{:<6f} avg".format(val / point.samples)
        ret += ("      {:"+str(maxLen) + "s} = {}\n").format(stat, val)
    return ret


def browse(args):
    """Interactive command-line browsing through simulation results."""
    lpdec.database.init(args.database)
    lpdec.database.ONLY_DUMMY = True
    dbsim.init()

    # query simulation identifier, if not provided as CLI option
    if args.identifier:
        identifiers = [args.identifier]
    else:
        identifiers = dbsim.existingIdentifiers()
        print('Available identifiers:')
        for i, ident in enumerate(identifiers):
            print('{0:2d}: {1}'.format(i, ident))
        nums = utils.splitRanges(input('Select number(s): '))
        identifiers = [identifiers[num] for num in nums]

    # query code, if not provided as CLI option
    if args.code:
        selectedCodes = [args.code]
    else:

# Path: lpdec/database/simulation.py
# def init():
# def teardown():
# def existingIdentifiers():
# def addDataPoint(point):
# def dataPoint(code, channel, wordSeed, decoder, identifier):
# def dataPointFromRow(row):
# def search(what, **conditions):
# def simulations(**conditions):
# 
# Path: lpdec/utils.py
# def clock():
#     def clock():
#     def __init__(self):
#     def __enter__(self):
#     def __exit__(self, exc_type, exc_value, exc_tb):
#     def duration(self):
#     def start(self):
#     def stop(self):
# def utcnow():
# def frange(start, end, step=1):
# def splitRanges(rangesString):
# def machineString():
# def isStr(arg):
# class Timer:
# TERM_BOLD_RED = '\033[31;1m'
# TERM_RED = '\033[31m'
# TERM_BOLD = '\033[0;1m'
# TERM_NORMAL = '\033[0m'
# TERM_CYAN = '\033[36m'


# Path: lpdec/cli/browse.py
import sys
import itertools
import jinja2
        import numbers
    import lpdec.imports  # ensure all decoder and code classes are loaded
    import matplotlib
    import matplotlib.pyplot as plt
from collections import OrderedDict
from dateutil import tz
from lpdec.database import simulation as dbsim
from lpdec import utils

        return ''
    maxLen = max(len(s) for s in stats)
    for stat, val in stats.items():
        if isinstance(val, numbers.Number):
            val = "{:<6f} avg".format(val / point.samples)
        ret += ("      {:"+str(maxLen) + "s} = {}\n").format(stat, val)
    return ret


def browse(args):
    """Interactive command-line browsing through simulation results."""
    lpdec.database.init(args.database)
    lpdec.database.ONLY_DUMMY = True
    dbsim.init()

    # query simulation identifier, if not provided as CLI option
    if args.identifier:
        identifiers = [args.identifier]
    else:
        identifiers = dbsim.existingIdentifiers()
        print('Available identifiers:')
        for i, ident in enumerate(identifiers):
            print('{0:2d}: {1}'.format(i, ident))
        nums = utils.splitRanges(input('Select number(s): '))
        identifiers = [identifiers[num] for num in nums]

    # query code, if not provided as CLI option
    if args.code:
        selectedCodes = [args.code]
    else:

        codes = [row[0] for row in dbsim.search('codename', identifier=identifiers)]