Skip to content

Commit

Permalink
Fix empty index lists
Browse files Browse the repository at this point in the history
  • Loading branch information
trossi committed Aug 15, 2024
1 parent cbbd703 commit 9e1f264
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hmsc/utils/import_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def load_random_level_hyperparams(hmscModel, dataParList, dtype=np.float64):
iWList_csr = [None] * gN
RiWList = [None] * gN
detW = np.zeros([gN], dtype)
indMat = np.concatenate([ind for ind in indList if len(ind) > 0], 1).T.astype(int) - 1
indMat = np.concatenate([ind for ind in indList if (ind is not None and len(ind) > 0)], 1).T.astype(int) - 1
for ag in range(gN):
alpha = rLPar["alphapw"][ag,0]
if alpha == 0:
Expand All @@ -177,7 +177,7 @@ def load_random_level_hyperparams(hmscModel, dataParList, dtype=np.float64):
D[0] = 1
valList = [[]] * npVec[r]
for i in range(1,npVec[r]):
if len(indList[i]) > 1:
if indList[i] is not None and len(indList[i]) > 1:
Kp = np.exp(-np.array(distList[i]).astype(dtype)/alpha)
valList[i] = np.linalg.solve(Kp[:-1,:-1], Kp[:-1,-1])
D[i] = Kp[-1,-1] - np.matmul(Kp[:-1,-1], valList[i])
Expand Down

0 comments on commit 9e1f264

Please sign in to comment.