Пример #1
0
 def __init__(self):
     BaseFeaturizer.__init__(self)
     self._types = ["cn", "lin"]
     self._labels = ["cn", "lin"]
     self._paras = [[], []]
     for i in range(5, 180, 5):
         self._types.append("bent")
         self._labels.append("bent{}".format(i))
         self._paras.append([float(i), 0.0667])
     for t in ["tet", "oct", "bcc", "q2", "q4", "q6", "reg_tri", "sq", \
             "sq_pyr", "tri_bipyr"]:
         self._types.append(t)
         self._labels.append(t)
         self._paras.append([])
Пример #2
0
def generate_tables():
    """
    Generate nicely formatted tables of all features in RST format.

    Args:
        None

    Returns:
        Prints a formatted string, where each main entry is a separate table
        representing one module of featurizers.
    """

    mmfeat = "====================\nTable of Featurizers\n====================\n"
    mmdes = "Below, you will find a description of each featurizer, listed in " \
            "tables grouped by module.\n"
    subclasses = []
    scnames = BaseFeaturizer.__subclasses__() + [BaseFeaturizer]
    scnames += conversions.ConversionFeaturizer.__subclasses__()
    for sc in scnames:
        scdict = {"name": sc.__name__}
        scdict["doc"] = sc.__doc__.splitlines()[1].lstrip()
        scdict["module"] = sc.__module__
        scdict["type"] = sc.__module__.split(".")[-1]
        subclasses.append(scdict)

    df = pd.DataFrame(subclasses)
    print(mmfeat)
    print(mmdes)

    for ftype in np.unique(df['type']):
        dftable = df[df['type'] == ftype]
        dftable['codename'] = [":code:`" + n + "`" for n in dftable['name']]

        ftype_border = "-" * len(ftype)
        mod = "(" + dftable['module'].iloc[0] + ")"
        des_border = "-" * len(mod_summs[ftype])

        print(ftype_border)
        print(ftype)
        print(ftype_border)
        print(mod_summs[ftype])
        print(des_border + "\n")
        print(mod)

        print("\n.. list-table::")
        print("   :align: left")
        print("   :widths: 30 70")
        # print("   :width: 70%")
        print("   :header-rows: 1\n")
        print("   * - Name")
        print("     - Description")
        for i, n in enumerate(dftable['codename']):
            # url = url_base + dftable["module"].iloc[0] + "." + \
            #       dftable["name"].iloc[i] + ">`_"
            url = ""

            print(f"   * - {n}")
            description = dftable["doc"].iloc[i]
            print(f"     - {description} {url}    ")
        print("\n\n")
Пример #3
0
def generate_tables():
    """
    Generate nicely formatted tables of all features in RST format.

    Args:
        None

    Returns:
        tables ([str]): A list of formatted strings, where each entry is a
            separate table representing one module.
    """

    mmfeat = "====================\nTable of Featurizers\n====================\n"
    mmdes = "Below, you will find a description of each featurizer, listed in " \
            "tables grouped by module.\n"
    tables = [mmfeat, mmdes]
    subclasses = []
    scnames = BaseFeaturizer.__subclasses__() + [BaseFeaturizer]
    scnames += conversions.ConversionFeaturizer.__subclasses__()
    for sc in scnames:
        scdict = {"name": sc.__name__}
        scdict["doc"] = sc.__doc__.splitlines()[1].lstrip()
        scdict["module"] = sc.__module__
        scdict["type"] = sc.__module__.split(".")[-1]
        subclasses.append(scdict)

    df = pd.DataFrame(subclasses)

    for ftype in np.unique(df['type']):
        dftable = df[df['type'] == ftype]
        dftable['codename'] = [":code:`" + n + "`" for n in dftable['name']]
        mod = "\n(" + dftable['module'].iloc[0] + ")\n\n"
        namelen = max([len(n) for n in dftable['codename']])
        # doclen = max([len(d) for d in dftable['doc']])
        doclen = 400
        borderstr = "=" * namelen + "   " + "=" * doclen + "\n"
        headerstr = "Name" + " " * (namelen - 1) + "Description\n"
        tablestr = ""
        for i, n in enumerate(dftable['codename']):
            url = url_base + dftable["module"].iloc[0] + "." + \
                  dftable["name"].iloc[i] + ">`_"
            tablestr += n + " " * (namelen - len(n) + 3) + \
                        dftable['doc'].iloc[i] + url + "\n"


        ftype_border = "\n" + "-" * len(ftype) + "\n"
        des_border = "-" * len(mod_summs[ftype]) + "\n"
        tables.append(ftype_border + ftype + ftype_border + mod_summs[ftype] +
                      des_border + mod + borderstr + headerstr + borderstr +
                      tablestr + borderstr + "\n\n")

    return tables
Пример #4
0
def generate_tables():
    """
    Generate nicely formatted tables of all features in RST format.

    Args:
        None

    Returns:
        tables ([str]): A list of formatted strings, where each entry is a
            separate table representing one module.
    """

    mmfeat = "====================\nTable of Featurizers\n====================\n"
    mmdes = "Below, you will find a description of each featurizer, listed in " \
            "tables grouped by module.\n"
    tables = [mmfeat, mmdes]
    subclasses = []
    scnames = BaseFeaturizer.__subclasses__() + [BaseFeaturizer]
    scnames += conversions.ConversionFeaturizer.__subclasses__()
    for sc in scnames:
        scdict = {"name": sc.__name__}
        scdict["doc"] = sc.__doc__.splitlines()[1].lstrip()
        scdict["module"] = sc.__module__
        scdict["type"] = sc.__module__.split(".")[-1]
        subclasses.append(scdict)

    df = pd.DataFrame(subclasses)

    for ftype in np.unique(df['type']):
        dftable = df[df['type'] == ftype]
        dftable['codename'] = [":code:`" + n + "`" for n in dftable['name']]
        mod = "\n(" + dftable['module'].iloc[0] + ")\n\n"
        namelen = max([len(n) for n in dftable['codename']])
        # doclen = max([len(d) for d in dftable['doc']])
        doclen = 400
        borderstr = "=" * namelen + "   " + "=" * doclen + "\n"
        headerstr = "Name" + " " * (namelen - 1) + "Description\n"
        tablestr = ""
        for i, n in enumerate(dftable['codename']):
            url = url_base + dftable["module"].iloc[0] + "." + \
                  dftable["name"].iloc[i] + ">`_"
            tablestr += n + " " * (namelen - len(n) + 3) + \
                        dftable['doc'].iloc[i] + url + "\n"

        ftype_border = "\n" + "-" * len(ftype) + "\n"
        des_border = "-" * len(mod_summs[ftype]) + "\n"
        tables.append(ftype_border + ftype + ftype_border + mod_summs[ftype] +
                      des_border + mod + borderstr + headerstr + borderstr +
                      tablestr + borderstr + "\n\n")

    return tables
Пример #5
0
 def __init__(self):
     BaseFeaturizer.__init__(self)
Пример #6
0
 def __init__(self, featurizer: BaseFeaturizer, composition: Composition):
     self._featurizer = featurizer
     self._composition = composition
     self._values = featurizer.featurize(self._composition)