Skip to content

Commit

Permalink
[#897] _constraints_conflict_iout() added safety check on bspliens eq…
Browse files Browse the repository at this point in the history
…uations + _check_deriv() minor debug
  • Loading branch information
dvezinet committed Jan 26, 2024
1 parent a7f1c0c commit b470163
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions tofu/data/_class10_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -815,10 +815,10 @@ def _check_deriv(
f"{dconst[deriv]['rad'][~iok]}\n"
" => excluded"
)
warnings.warn
warnings.warn(msg)

dconst[deriv]['rad'] = dconst[deriv]['rad'][iok]
dconst[deriv]['rad'] = dconst[deriv]['rad'][iok]
dconst[deriv]['val'] = dconst[deriv]['val'][iok]

# sort vs radius
inds = np.argsort(dconst[deriv]['rad'])
Expand Down Expand Up @@ -1005,13 +1005,22 @@ def _constraints_conflict_iout(
indout = ibs_coefs[ii, it, :].nonzero()[0][0]
indin = ibs_coefs[ii, it, :].nonzero()[0][1:]

# safety check
if indin.size == 0:
msg = (
"Eq from constraint seems to address a single bspline!"
)
raise NotImplementedError(msg)

iout_coefs[it, indout] = True
iin_coefs[it, indout] = False

dcon[k0]['iout'][it] = indout
dcon[k0]['iin'][it][:] = indin

# -----------------------
# final consistency check

lterr = np.any(
(iout_offset & iout_coefs & iin_coefs)[~iconflict, :],
axis=1,
Expand Down

0 comments on commit b470163

Please sign in to comment.