Skip to content

Commit

Permalink
np return_result dict
Browse files Browse the repository at this point in the history
  • Loading branch information
loriab committed Oct 3, 2024
1 parent 2b0eedb commit 5e2b000
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions qcelemental/models/v2/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@

def generate_caster(dtype):
def cast_to_np(v):
# for driver=properties
if isinstance(v, dict):
vv = {}
for key, val in v.items():
try:
val = np.asarray(val, dtype=dtype)
except ValueError:
raise ValueError(f"Could not cast {val} to NumPy Array!")
vv[key] = val
return vv

try:
v = np.asarray(v, dtype=dtype)
except ValueError:
Expand Down

0 comments on commit 5e2b000

Please sign in to comment.