def _featurize_single(self, structure: Structure) -> Union[np.array, list, list]: """Finds metals in the structure, featurizes the metal sites and collects the features Args: structure (pymatgen.Structure): Structure to featurize Returns: Union[np.array, list, list]: [description] """ get_feat = GetFeatures(structure, '') features = get_feat.return_features() metal_indices = get_feat.metal_indices X = [] feat_dict_list = FeatureCollector.create_dict_for_feature_table_from_dict( features) for feat_dict in feat_dict_list: X.append(feat_dict['feature']) X = np.vstack(X) ( X, _, ) = FeatureCollector._select_features_return_names( # pylint:disable=protected-access self.featureset, X) metals = [site.species_string for site in get_feat.metal_sites] return X, metal_indices, metals
def test_featurization(): s = Structure.from_file( os.path.join(THIS_DIR, '..', 'examples', 'structures', 'BaO2_mp-1105_computed.cif')) featurizer = GetFeatures(s, '') feat = featurizer.return_features() assert len(feat) == 2 assert len(feat[0]['feature']) == len(feat[1]['feature']) == 129
def test_featurization(): """Test the basic featurizer""" structure = Structure.from_file( os.path.join(THIS_DIR, "..", "..", "examples", "structures", "BaO2_mp-1105_computed.cif")) featurizer = GetFeatures(structure, "") feat = featurizer.return_features() assert len(feat) == 2 assert len(feat[0]["feature"]) == len(feat[1]["feature"]) == 129
def featurize_single(structure, outdir=OUTDIR): if Path(structure).stem not in ALREADY_FEATURIZED: try: gf = GetFeatures.from_file(structure, outdir) # pylint:disable=invalid-name gf.run_featurization() except Exception: pass
def featurize_single(structure, outdir=OUTDIR): """Runs featurization on one structure.""" if Path(structure).stem not in ALREADY_FEATURIZED: try: gf = GetFeatures.from_file(structure, outdir) # pylint:disable=invalid-name gf._run_featurization() # pylint:disable=protected-access except Exception: # pylint:disable=broad-except pass
def featurize_single(structure, outdir=OUTDIR): gf = GetFeatures.from_file(structure, outdir) # pylint:disable=invalid-name gf.run_featurization()
def featurize_single(structure, outdir=OUTDIR): """Featurize one structure""" gf = GetFeatures.from_file(structure, outdir) # pylint:disable=invalid-name gf._run_featurization() # pylint:disable=protected-access
def main(structure, outdir): """ CLI function """ gf = GetFeatures.from_file(structure, outdir, 60) # pylint: disable=invalid-name gf.run_featurization()