Skip to content

Commit

Permalink
Ensure PhaseDiagram qhull_data is a numpy array (#731)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Munro authored Jan 20, 2023
1 parent ece1b3e commit 1e83e2b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mp_api/client/routes/thermo.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import warnings
import numpy as np
from collections import defaultdict
from typing import Optional, List, Tuple, Union
from mp_api.client.core import BaseRester
Expand Down Expand Up @@ -179,6 +180,7 @@ def get_phase_diagram_from_chemsys(
pd = response[0].get("phase_diagram", None)

# Ensure el_ref keys are Element objects for PDPlotter.
# Ensure qhull_data is a numpy array
# This should be fixed in pymatgen
if pd:
for key, entry in list(pd.el_refs.items()):
Expand All @@ -188,4 +190,7 @@ def get_phase_diagram_from_chemsys(
pd.el_refs[Element(str(key))] = entry
pd.el_refs.pop(key)

if isinstance(pd.qhull_data, list):
pd.qhull_data = np.array(pd.qhull_data)

return pd # type: ignore

0 comments on commit 1e83e2b

Please sign in to comment.