def test_ionic(self): featurizer = IonProperty() df_ionic = featurizer.featurize_dataframe(self.df, col_id="composition") self.assertEqual(df_ionic["compound possible"][0], 1.0) self.assertAlmostEqual(df_ionic["max ionic char"][0], 0.476922164) self.assertAlmostEqual(df_ionic["avg ionic char"][0], 0.114461319) # Test 'fast' self.assertEqual(1.0, featurizer.featurize(Composition("Fe3O4"))[0]) featurizer.fast = True self.assertEqual(0, featurizer.featurize(Composition("Fe3O4"))[0]) # Make sure 'fast' works if I use-precomputed oxidation states self.assertEqual(1, featurizer.featurize(Composition({ Specie('Fe', 2): 1, Specie('Fe', 3): 2, Specie('O', -2): 4 }))[0])
# -- start F9 from matminer.featurizers.composition import ValenceOrbital vlo_feat = ValenceOrbital() fdf = vlo_feat.featurize_dataframe(fdf, col_id='composition', ignore_errors=True) # -- end F9 # -- start F10 from matminer.featurizers.composition import IonProperty iop_feat = IonProperty() fdf = iop_feat.featurize_dataframe(fdf, col_id='composition', ignore_errors=True) # -- end F10 # -- start F12 from matminer.featurizers.composition import TMetalFraction tmf_feat = TMetalFraction() fdf = tmf_feat.featurize_dataframe(fdf, col_id='composition', ignore_errors=True) # -- end F12 # End of the basic featurization # Saving the database