Skip to content

Commit

Permalink
Merge pull request #3141 from SasView/numpy-latest-version
Browse files Browse the repository at this point in the history
2897, 2922: Use latest version of external (numpy, scipy, PySide) packages
  • Loading branch information
krzywon authored Dec 3, 2024
2 parents 1b49bbd + 2b3969b commit 8864264
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ jobs:
run: |
git clone --depth=50 --branch=master https://github.com/SasView/sasdata.git ../sasdata
git clone --depth=50 --branch=master https://github.com/SasView/sasmodels.git ../sasmodels
git clone --depth=50 --branch=master https://github.com/bumps/bumps.git ../bumps
git clone --depth=50 --branch=v0.9.3 https://github.com/bumps/bumps.git ../bumps
- name: Build and install sasdata
run: |
Expand Down
8 changes: 4 additions & 4 deletions build_tools/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Alphabetized list of OS and version agnostic dependencies
appdirs
bumps
cffi
docutils
dominate
Expand All @@ -14,16 +13,19 @@ lxml
mako
matplotlib
numba
numpy
periodictable
pybind11
pylint
pyopengl
pyparsing
PySide6
pytest
pytest_qt
pytest-mock
pytools
qtconsole
scipy
six
sphinx
superqt
Expand All @@ -38,6 +40,4 @@ zope
pywin32; platform_system == "Windows"

# Alphabetized list of version-pinned packages
numpy==1.26.4 # 2.0.0 deprecates many functions used in the codebase (and potentially in dependencies)
PySide6==6.4.3 # Later versions do not mesh well with pyinstaller < 6.0
scipy==1.13.1 # 1.14 deprecates some functions used in the codebase (and potentially in dependencies)
bumps==0.* # v1.+ is very experimental
15 changes: 11 additions & 4 deletions src/sas/sascalc/fit/BumpsFitting.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,14 @@ def fit(self, msg_q=None,
# Check if uncertainty is missing for any parameter
uncertainty_warning = False

for fitness in problem.models:
for fitting_module in problem.models:
# CRUFT: This makes BumpsFitting compatible with bumps v0.9 and v1.0
if isinstance(fitting_module, SasFitness):
# Bumps v1.x+ - A Fitness object is returned
fitness = fitting_module
else:
# Bumps v0.x - A module is returned that holds the Fitness object
fitness = fitting_module.fitness
pars = fitness.fitted_pars + fitness.computed_pars
par_names = fitness.fitted_par_names + fitness.computed_par_names

Expand Down Expand Up @@ -346,8 +353,8 @@ def fit(self, msg_q=None,

# TODO: Let the GUI decided how to handle success/failure.
if not fitting_result.success:
fitting_result.stderr[:] = np.NaN
fitting_result.fitness = np.NaN
fitting_result.stderr[:] = np.nan
fitting_result.fitness = np.nan

all_results.append(fitting_result)

Expand Down Expand Up @@ -398,7 +405,7 @@ def abort_test():
try:
best, fbest = fitdriver.fit()
except Exception as exc:
best, fbest = None, np.NaN
best, fbest = None, np.nan
errors.extend([str(exc), traceback.format_exc()])
finally:
mapper.stop_mapper(fitdriver.mapper)
Expand Down

0 comments on commit 8864264

Please sign in to comment.