# 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


TEMPLATES = dict()
TEMPLATES['hp'] = \
"""{{sim.code}} ({{sim.code.blocklength}},{{sim.code.infolength}}) Code: ML Simulation Results
Channel: {{sim.channelClass.__name__}}
Modulation: BPSK

Eb/N0 (dB)   FER     error frames   total frames
{% for point in sim %}  {{"{:4.2f},{:12.3e},{:7d},{:16d}".format(point.snr, point.frameErrorRate,
point.errors,
  point.samples)}}
{% endfor %}

Stefan Scholl and Michael Helmling
Microelectronic Systems Design Research Group and Optimization Research Group
University of Kaiserslautern, Germany, {{"{:%Y}".format(sim.date_end)}}

This file was downloaded from: http://www.uni-kl.de/channel-codes/"""

TEMPLATES['cli'] = \
"""{{sim.identifier}}: {{sim.code.name}} // {{sim.decoder.name}}:
  snr   samples    errors     FER      av.cpu
{% for point in sim %}  {{"{:<4.2f}  {:<10d} {:<10d} {:<8.2e} {:<.6f}".format(point.snr,
point.samples, point.errors, point.frameErrorRate, point.cputime/point.samples)}}\
{% if verbose %}
  {{point|formatStats}}
{% endif %}
{% endfor %}"""


# 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



TEMPLATES = dict()
TEMPLATES['hp'] = \
"""{{sim.code}} ({{sim.code.blocklength}},{{sim.code.infolength}}) Code: ML Simulation Results
Channel: {{sim.channelClass.__name__}}
Modulation: BPSK

Eb/N0 (dB)   FER     error frames   total frames
{% for point in sim %}  {{"{:4.2f},{:12.3e},{:7d},{:16d}".format(point.snr, point.frameErrorRate,
point.errors,
  point.samples)}}
{% endfor %}

Stefan Scholl and Michael Helmling
Microelectronic Systems Design Research Group and Optimization Research Group
University of Kaiserslautern, Germany, {{"{:%Y}".format(sim.date_end)}}

This file was downloaded from: http://www.uni-kl.de/channel-codes/"""

TEMPLATES['cli'] = \
"""{{sim.identifier}}: {{sim.code.name}} // {{sim.decoder.name}}:
  snr   samples    errors     FER      av.cpu
{% for point in sim %}  {{"{:<4.2f}  {:<10d} {:<10d} {:<8.2e} {:<.6f}".format(point.snr,
point.samples, point.errors, point.frameErrorRate, point.cputime/point.samples)}}\
{% if verbose %}
  {{point|formatStats}}
{% endif %}
{% endfor %}"""


TEMPLATES['verb'] = \