# Path: cubical/tools/logger.py
# def logToFile(filename, append=False):
# def getLogFilename():
#     def __init__(self, logger, level, color=None, bold=None):
#     def write(self, message, level_override=None, print_once=None):
#     def print(self, *args):
#     def __init__(self, logger, verbose=None, log_verbose=None):
#     def verbosity(self, set_verb=None):
#     def log_verbosity(self, set_verb=None):
#     def __call__(self, level, color=None):
#     def warn(self, msg, color=None, print_once=None):
#     def error(self, msg, color="red", print_once=None):
#     def info(self, msg, color=None, print_once=None):
#     def critical(self, msg, color=None, print_once=None):
#     def debug(self, msg, color=None, print_once=None):
#     def exception(self, msg, color=None, print_once=None):
#     def print(self, *args):
#     def write(self, message, level=logging.INFO, verbosity=0, print_once=None, color=None):
# def enableMemoryLogging(level=1):
# def set_subprocess_label(label):
# def get_subprocess_label():
# def _sigusr1_handler(signum, frame):
# def _sigusr2_handler(signum, frame):
#     def setMemoryLogging(level):
#     def filter(self, event):
#     def __init__(self, fmt, datefmt, strip=True):
#     def label(self, record):
#     def format(self, record):
# def init(app_name):
# def getLogger(name, verbose=None, log_verbose=None):
# def setBoring(boring=True):
# def setGlobalVerbosity(verbosity):
# def setGlobalLogVerbosity(verbosity):
# def setSilent(Lname):
# def setLoud(Lname):
# class _DefaultWriter(object):
# class LoggerWrapper(object):
# class LogFilter(logging.Filter):
# class ColorStrippingFormatter(logging.Formatter):
# GB = float(1024 ** 3)
#                 KEYS = _log_memory_types[memlevel]
# 
# Path: cubical/tools/ModColor.py
# HEADER = '\033[95m'
# OKBLUE = '\033[94m'
# OKGREEN = '\033[92m'
# WARNING = '\033[93m'
# FAIL = '\033[91m'
# ENDC = '\033[0m'
#     HEADER = ''
#     OKBLUE = ''
#     OKGREEN = ''
#     WARNING = ''
#     FAIL = ''
#     ENDC = ''
# def disableColors():
# def Str(strin0,col="red",Bold=True):
# def Sep(strin=None,D=1):
# def Title(strin,Big=False):
# def disable():


from builtins import range
from future.moves import pickle
from cubical.tools import logger
from cubical.tools import ModColor
from collections import OrderedDict
import math
import numpy as np
                output_rows.append([])
            for ifreq in range(nf):
                # start new line every NF_PER_COL-th freq chunk, if frequencies span lines
                if nf_per_col is not None and output_rows[-1] and ifreq%nf_per_col == 0:
                    output_rows.append([])
                statrec = self.chunk[itime, ifreq]
                statrec_dict = {field:statrec[field] for field in self.chunk.dtype.fields}
                # new line: prepend chunk label
                label = statrec.label.decode() if hasattr(statrec.label, 'decode') else statrec.label
                if not output_rows[-1]:
                    output_rows[-1].append((label, False))
                # put it in header as well
                if len(output_rows) == 2:
                    output_rows[0].append((label, False))
                # check for threshold
                warn = False
                if threshold is not None:
                    for field, value in threshold:
                        if statrec[field] > value:
                            warn = True
                text = format_string.format(**statrec_dict)
                output_rows[-1].append((text, warn))

        # now work out column widths and format
        ncol = max([len(row) for row in output_rows])
        colwidths = [max([len(row[icol][0]) for row in output_rows if icol<len(row)]) for icol in range(ncol)]
        colformat = ["{{:{}}}  ".format(w) for w in colwidths]

        output_rows = [[(colformat[icol].format(col), warn) for icol, (col, warn) in enumerate(row)] for row in output_rows]


# Path: cubical/tools/logger.py
# def logToFile(filename, append=False):
# def getLogFilename():
#     def __init__(self, logger, level, color=None, bold=None):
#     def write(self, message, level_override=None, print_once=None):
#     def print(self, *args):
#     def __init__(self, logger, verbose=None, log_verbose=None):
#     def verbosity(self, set_verb=None):
#     def log_verbosity(self, set_verb=None):
#     def __call__(self, level, color=None):
#     def warn(self, msg, color=None, print_once=None):
#     def error(self, msg, color="red", print_once=None):
#     def info(self, msg, color=None, print_once=None):
#     def critical(self, msg, color=None, print_once=None):
#     def debug(self, msg, color=None, print_once=None):
#     def exception(self, msg, color=None, print_once=None):
#     def print(self, *args):
#     def write(self, message, level=logging.INFO, verbosity=0, print_once=None, color=None):
# def enableMemoryLogging(level=1):
# def set_subprocess_label(label):
# def get_subprocess_label():
# def _sigusr1_handler(signum, frame):
# def _sigusr2_handler(signum, frame):
#     def setMemoryLogging(level):
#     def filter(self, event):
#     def __init__(self, fmt, datefmt, strip=True):
#     def label(self, record):
#     def format(self, record):
# def init(app_name):
# def getLogger(name, verbose=None, log_verbose=None):
# def setBoring(boring=True):
# def setGlobalVerbosity(verbosity):
# def setGlobalLogVerbosity(verbosity):
# def setSilent(Lname):
# def setLoud(Lname):
# class _DefaultWriter(object):
# class LoggerWrapper(object):
# class LogFilter(logging.Filter):
# class ColorStrippingFormatter(logging.Formatter):
# GB = float(1024 ** 3)
#                 KEYS = _log_memory_types[memlevel]
# 
# Path: cubical/tools/ModColor.py
# HEADER = '\033[95m'
# OKBLUE = '\033[94m'
# OKGREEN = '\033[92m'
# WARNING = '\033[93m'
# FAIL = '\033[91m'
# ENDC = '\033[0m'
#     HEADER = ''
#     OKBLUE = ''
#     OKGREEN = ''
#     WARNING = ''
#     FAIL = ''
#     ENDC = ''
# def disableColors():
# def Str(strin0,col="red",Bold=True):
# def Sep(strin=None,D=1):
# def Title(strin,Big=False):
# def disable():


# Path: cubical/statistics.py
from builtins import range
from future.moves import pickle
from cubical.tools import logger
from cubical.tools import ModColor
from collections import OrderedDict
import math
import numpy as np

                output_rows.append([])
            for ifreq in range(nf):
                # start new line every NF_PER_COL-th freq chunk, if frequencies span lines
                if nf_per_col is not None and output_rows[-1] and ifreq%nf_per_col == 0:
                    output_rows.append([])
                statrec = self.chunk[itime, ifreq]
                statrec_dict = {field:statrec[field] for field in self.chunk.dtype.fields}
                # new line: prepend chunk label
                label = statrec.label.decode() if hasattr(statrec.label, 'decode') else statrec.label
                if not output_rows[-1]:
                    output_rows[-1].append((label, False))
                # put it in header as well
                if len(output_rows) == 2:
                    output_rows[0].append((label, False))
                # check for threshold
                warn = False
                if threshold is not None:
                    for field, value in threshold:
                        if statrec[field] > value:
                            warn = True
                text = format_string.format(**statrec_dict)
                output_rows[-1].append((text, warn))

        # now work out column widths and format
        ncol = max([len(row) for row in output_rows])
        colwidths = [max([len(row[icol][0]) for row in output_rows if icol<len(row)]) for icol in range(ncol)]
        colformat = ["{{:{}}}  ".format(w) for w in colwidths]

        output_rows = [[(colformat[icol].format(col), warn) for icol, (col, warn) in enumerate(row)] for row in output_rows]


        return ["".join([(ModColor.Str(col, 'red') if warn else col) for col, warn in row]) for row in output_rows]