Skip to content

Commit

Permalink
convert numpy ints to ints in testing function
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinsung committed Jan 2, 2025
1 parent 2347b3c commit 92be4f1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions python/ffsim/testing/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ def random_occupied_orbitals(
"""
rng = np.random.default_rng(seed)
if isinstance(nelec, int):
return list(rng.choice(norb, nelec, replace=False))
return [int(x) for x in rng.choice(norb, nelec, replace=False)]
n_alpha, n_beta = nelec
occ_a = list(rng.choice(norb, n_alpha, replace=False))
occ_b = list(rng.choice(norb, n_beta, replace=False))
occ_a = [int(x) for x in rng.choice(norb, n_alpha, replace=False)]
occ_b = [int(x) for x in rng.choice(norb, n_beta, replace=False)]
return (occ_a, occ_b)


Expand Down

0 comments on commit 92be4f1

Please sign in to comment.