Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix false counting and numpy to int #80

Merged
merged 2 commits into from
Aug 19, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix false counting and numpy to int
  • Loading branch information
stevenhua0320 committed Aug 19, 2024
commit 4fad5d1789f470c909ec2ba6e2c58ca515112562
4 changes: 2 additions & 2 deletions src/diffpy/srmise/baselines/polynomial.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def estimate_parameters(self, r, y):
# TODO: Make this more sophisticated.
try:
cut = np.max([len(y) / 10, 1])
cut_idx = y.argsort()[:cut]
cut_idx = y.argsort()[:int(cut)]

import numpy.linalg as la

Expand Down Expand Up @@ -121,7 +121,7 @@ def _jacobianraw(self, pars, r, free):
emsg = "Argument free must have " + str(self.npars) + " elements."
raise ValueError(emsg)
jacobian = [None for p in range(self.npars)]
if (free is False).sum() == self.npars:
if np.sum(np.logical_not(free)) == self.npars:
return jacobian

# The partial derivative with respect to the nth coefficient of a
Expand Down
Loading