matminer.utils package¶
Subpackages¶
Submodules¶
matminer.utils.data module¶
-
class
matminer.utils.data.
AbstractData
¶ Bases:
object
-
get_property
(x, property_name, *args, **kwargs)¶ Fetches data / information for an object x.
- Args:
- x: input data/object to retrieve the property of. Input type depends
- on type of abstract data, e.g., a Composition for MagpieData
property_name (str): Name of property to retrieve *args: other arguments needed by the AbstractData object **kwargs: other keyword arguments needed by the AbstractData object
- Returns:
- Property value(s), typically either float or list of float. Note: if multiple values are returned for a Composition, the convention is to sort values by the element’s atomic number.
-
-
class
matminer.utils.data.
PymatgenData
¶ Bases:
matminer.utils.data.AbstractData
Class to get data from pymatgen. See also: S.P. Ong, W.D. Richards, A. Jain, G. Hautier, M. Kocher, S. Cholia, et al., Python Materials Genomics (pymatgen): A robust, open-source python library for materials analysis, Comput. Mater. Sci. 68 (2013) 314-319.
-
get_property
(comp, property_name)¶ Get descriptor data for elements in a compound from pymatgen.
- Args:
comp (str/Composition): pymatgen Composition object property_name (str): pymatgen element attribute name, as defined in
the Element class at http://pymatgen.org/_modules/pymatgen/core/periodic_table.html. For ‘ionic_radii’ property, the Composition object must consist of oxidation state decorated Specie objects (not plain Element objects).- Returns:
- (list) of values containing descriptor floats for each atom in the
- compound (sorted by the atomic number Z of the constituent atoms)
-
matminer.utils.flattendict module¶
-
matminer.utils.flattendict.
flattenDict
(d, result=None)¶ Function to flatten a JSON dictionary. Taken from: https://gist.github.com/higarmi/6708779
example: The following JSON document: {“maps”:[{“id1”:”blabla”,”iscategorical1”:”0”, “perro”:[{“dog1”: “1”, “dog2”: “2”}]},{“id2”:”blabla”,”iscategorical2”:”0”}], “masks”:{“id”:”valore”}, “om_points”:”value”, “parameters”:{“id”:”valore”}}
will have the following output: {‘masks.id’: ‘valore’, ‘maps.iscategorical2’: ‘0’, ‘om_points’: ‘value’, ‘maps.iscategorical1’: ‘0’, ‘maps.id1’: ‘blabla’, ‘parameters.id’: ‘valore’, ‘maps.perro.dog2’: ‘2’, ‘maps.perro.dog1’: ‘1’, ‘maps.id2’: ‘blabla’}
matminer.utils.kernels module¶
-
matminer.utils.kernels.
gaussian_kernel
¶ staticmethod(function) -> method
Convert a function to be a static method.
A static method does not receive an implicit first argument. To declare a static method, use this idiom:
- class C:
@staticmethod def f(arg1, arg2, …):
…
It can be called either on the class (e.g. C.f()) or on an instance (e.g. C().f()). The instance is ignored except for its class.
Static methods in Python are similar to those found in Java or C++. For a more advanced concept, see the classmethod builtin.
-
matminer.utils.kernels.
laplacian_kernel
¶ staticmethod(function) -> method
Convert a function to be a static method.
A static method does not receive an implicit first argument. To declare a static method, use this idiom:
- class C:
@staticmethod def f(arg1, arg2, …):
…
It can be called either on the class (e.g. C.f()) or on an instance (e.g. C().f()). The instance is ignored except for its class.
Static methods in Python are similar to those found in Java or C++. For a more advanced concept, see the classmethod builtin.