Skip to content

Commit

Permalink
Fix dtype
Browse files Browse the repository at this point in the history
  • Loading branch information
Scienfitz committed Mar 6, 2024
1 parent 8b6491b commit 4874cd5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions baybe/utils/chemistry.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
"""chemistry dependencies. Please run "pip install 'baybe[chem]'"."""
)

from baybe.utils.numerical import DTypeFloatNumpy

_mordred_calculator = Calculator(descriptors)


Expand Down Expand Up @@ -86,10 +88,13 @@ def _smiles_to_mordred_features(smiles: str) -> np.ndarray:
"""
try:
return np.asarray(
_mordred_calculator(Chem.MolFromSmiles(smiles)).fill_missing()
_mordred_calculator(Chem.MolFromSmiles(smiles)).fill_missing(),
dtype=DTypeFloatNumpy,
)
except Exception:
return np.full(len(_mordred_calculator.descriptors), np.NaN)
return np.full(
len(_mordred_calculator.descriptors), np.NaN, dtype=DTypeFloatNumpy
)


def smiles_to_mordred_features(
Expand Down

0 comments on commit 4874cd5

Please sign in to comment.