Skip to content

Commit

Permalink
Suppress pymatgen element data warnings when imputing
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-evs committed Apr 10, 2024
1 parent d75d28a commit be1531c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion matminer/utils/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,12 @@ def get_elemental_property(self, elem, property_name):
block_key = {"s": 1.0, "p": 2.0, "d": 3.0, "f": 3.0}
return block_key[getattr(elem, property_name)]
else:
value = getattr(elem, property_name)
# Suppress pymatgen warnings for missing properties if we are going to impute anyway
with warnings.catch_warnings():
if self.impute_nan:
warnings.simplefilter("ignore", category=UserWarning)
value = getattr(elem, property_name)

if self.impute_nan:
if value and not pd.isnull(value):
return value
Expand Down

0 comments on commit be1531c

Please sign in to comment.