Exemplo n.º 1
0
def create_print_mad(run_info, d_mad, list_order):
    """
    Create the table then print the mad
    """
    # -#-#-#- #
    # I n i t #
    # -#-#-#- #

    table_body = []

    # -#-#-#-#-#- #
    # H e a d e r #
    # -#-#-#-#-#- #

    header_name = "Run_id Method Basis Geo Comments mad".split()
    header_unit = [DEFAULT_CHARACTER] * 5 + ["kcal/mol"]

    # -#-#-#- #
    # B o d y #
    # -#-#-#- #

    for run_id, l in run_info.iteritems():
        mad = d_mad[run_id] if run_id in d_mad else 0.

        line = [run_id] + l + [mad]
        table_body.append(line)

    # -#-#-#-#-#- #
    # F o r m a t #
    # -#-#-#-#-#- #

    table_body = order_by(list_order, header_name, table_body)
    table_body = format_table(header_name, table_body)

    # -#-#-#-#-#-#-#- #
    # B i g  Ta b l e #
    # -#-#-#-#-#-#-#- #

    table_body = [map(str, i) for i in table_body]
    table_data = [header_name] + [header_unit] + table_body

    table_big = AsciiTable(table_data)
    print table_big.table(row_separator=2)
Exemplo n.º 2
0
def create_print_mad(run_info, d_mad, list_order):
    """
    Create the table then print the mad
    """
    # -#-#-#- #
    # I n i t #
    # -#-#-#- #

    table_body = []

    # -#-#-#-#-#- #
    # H e a d e r #
    # -#-#-#-#-#- #

    header_name = "Run_id Method Basis Geo Comments mad".split()
    header_unit = [DEFAULT_CHARACTER] * 5 + ["kcal/mol"]

    # -#-#-#- #
    # B o d y #
    # -#-#-#- #

    for run_id, l in run_info.iteritems():
        mad = d_mad[run_id] if run_id in d_mad else 0.

        line = [run_id] + l + [mad]
        table_body.append(line)

    # -#-#-#-#-#- #
    # F o r m a t #
    # -#-#-#-#-#- #

    table_body = order_by(list_order, header_name, table_body)
    table_body = format_table(header_name, table_body)

    # -#-#-#-#-#-#-#- #
    # B i g  Ta b l e #
    # -#-#-#-#-#-#-#- #

    table_body = [map(str, i) for i in table_body]
    table_data = [header_name] + [header_unit] + table_body

    table_big = AsciiTable(table_data)
    print table_big.table(row_separator=2)
Exemplo n.º 3
0
def print_table_energy(run_info, table_body, header_name, header_unit):
    """
    Print the famous energy table.
    If is to big, split it !
    """
    # -#-#-#-#-#-#-#- #
    # B i g  Ta b l e #
    # -#-#-#-#-#-#-#- #
    from src.terminaltables import AsciiTable

    table_body = [map(str, i) for i in table_body]
    table_data = [header_name] + [header_unit] + table_body

    table_big = AsciiTable(table_data)

    # -#-#-#-#-#- #
    # F i l t e r #
    # -#-#-#-#-#- #

    # Table_big.ok Check if the table will fit in the terminal

    mode = config.get("Size", "mode")
    if all([mode == "Auto",
            not table_big.ok]) or mode == "Small":

            # Split into two table
            # table_run_id  (run _id -> method,basis, comment)
            # table_data_small (run_id -> energy, etc)
        table_run_id = ["Run_id Method Basis Geo Comments".split()]

        for run_id, l in run_info.iteritems():
            line = [run_id] + l
            table_run_id.append(line)

        t = AsciiTable([map(str, i) for i in table_run_id])
        print t.table()

        table_data_small = [[l[0]] + l[5:] for l in table_data]
        t = AsciiTable(table_data_small)
        print t.table(row_separator=2)

    else:
        print table_big.table(row_separator=2)
Exemplo n.º 4
0
def print_table_energy(run_info, table_body, header_name, header_unit):
    """
    Print the famous energy table.
    If is to big, split it !
    """
    # -#-#-#-#-#-#-#- #
    # B i g  Ta b l e #
    # -#-#-#-#-#-#-#- #
    from src.terminaltables import AsciiTable

    table_body = [map(str, i) for i in table_body]
    table_data = [header_name] + [header_unit] + table_body

    table_big = AsciiTable(table_data)

    # -#-#-#-#-#- #
    # F i l t e r #
    # -#-#-#-#-#- #

    # Table_big.ok Check if the table will fit in the terminal

    mode = config.get("Size", "mode")
    if all([mode == "Auto", not table_big.ok]) or mode == "Small":

        # Split into two table
        # table_run_id  (run _id -> method,basis, comment)
        # table_data_small (run_id -> energy, etc)
        table_run_id = ["Run_id Method Basis Geo Comments".split()]

        for run_id, l in run_info.iteritems():
            line = [run_id] + l
            table_run_id.append(line)

        t = AsciiTable([map(str, i) for i in table_run_id])
        print t.table()

        table_data_small = [[l[0]] + l[5:] for l in table_data]
        t = AsciiTable(table_data_small)
        print t.table(row_separator=2)

    else:
        print table_big.table(row_separator=2)