Compare commits

55 Commits

Author SHA256 Message Date
cbfafa462b Accepting request 1296400 from devel:languages:python:numeric
- Update to 4.17.1:
  * enhancements:
    + improved handling for OGIP products that do not follow the standards
    + Models can now be combined using arbitrary ufuncs
    + various updates to XSpec interface and support for XSpec 12.15.0
      including the additional of 17 new models
    + added interface to support ArviZ for analysis of Bayesian models
  * infrastructure and testing:
    + updated tests to work with python 3.13
  * bug fixes:
    + fixed a bug in the caching code that limited the cache size to 1
    + update to use fake_pha for missions which don't use 1 as the first
      channel
- Dropped patches:
  * sherpa-pr2188-np2docstrings.patch
  * sherpa-pr2207-mpl.patch
  * support-pytest-8.3.4.patch
- Refresed sherpa-suse-libdir.patch
- Add patch support-gcc-15.patch:
  * Specify function declarations correctly.

OBS-URL: https://build.opensuse.org/request/show/1296400
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-sherpa?expand=0&rev=26
2025-07-30 09:45:52 +00:00
78f7e6e3ac Accepting request 1245410 from devel:languages:python:numeric
- Add sherpa-pr2207-mpl.patch for matplotlib 3.10 test
  compatibility gh#sherpa/sherpa#2207

OBS-URL: https://build.opensuse.org/request/show/1245410
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-sherpa?expand=0&rev=25
2025-02-12 20:39:12 +00:00
c3d2b4e05c - Add sherpa-pr2207-mpl.patch for matplotlib 3.10 test
compatibility gh#sherpa/sherpa#2207

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-sherpa?expand=0&rev=50
2025-02-12 14:56:16 +00:00
417686b0dd Accepting request 1241023 from devel:languages:python:numeric
- Add patch support-pytest-8.3.4.patch:
  * Support pytest 8.3.4 changes.

OBS-URL: https://build.opensuse.org/request/show/1241023
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-sherpa?expand=0&rev=24
2025-01-29 15:16:47 +00:00
45278798b7 - Add patch support-pytest-8.3.4.patch:
* Support pytest 8.3.4 changes.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-sherpa?expand=0&rev=48
2025-01-29 05:29:04 +00:00
45f8ea50e6 Accepting request 1228824 from devel:languages:python:numeric
- Update to 4.17.0
  * This release of Sherpa includes various enhancements,
    documentation updates, bug fixes, and infrastructure changes.
  ## enhancements:
  * add calc_model and calc_source functions to return an evaluated
    model/source array
  * added wstat to plot_pvalue for the likelihood ratio test
  * changed XSpec interface to use FunctionUtility C++ API instead
    of XSFortran API
  * improved support for PHA data starting at channel 0 and
    handling of STAT_ERR and SYS_ERR PHA columns which are set to 0
  * improved guess for complex models
  * improved filtering handling
  * several updates to enhance plotting capabilities and layout
  ## documentation changes:
  * added paper citations to front page of Sherpa Read the Docs
    documentation
  * cleaned up various typos and URL references
  * added examples such as use of set_x/y_label
  ## infrastructure and testing:
  * improved test coverage
  * many updates to CI
  * drop support for Python 3.9 and numpy <1.24
  * initial/experimental support for Python 3.12
  ## bug fixes:
  * fixed an issue with plotting 1D data with asymmetric errs after
    filter
  * include the default identifier in save_all output if it has
    been changed
- Drop numpy2.patch
- Add sherpa-pr2188-np2docstrings.patch gh#sherpa/sherpa#2188
- Add sherpa-suse-libdir.patch

OBS-URL: https://build.opensuse.org/request/show/1228824
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-sherpa?expand=0&rev=23
2024-12-08 10:37:24 +00:00
de47efe118 - Update to 4.17.0
* This release of Sherpa includes various enhancements,
    documentation updates, bug fixes, and infrastructure changes.
  ## enhancements:
  * add calc_model and calc_source functions to return an evaluated
    model/source array
  * added wstat to plot_pvalue for the likelihood ratio test
  * changed XSpec interface to use FunctionUtility C++ API instead
    of XSFortran API
  * improved support for PHA data starting at channel 0 and
    handling of STAT_ERR and SYS_ERR PHA columns which are set to 0
  * improved guess for complex models
  * improved filtering handling
  * several updates to enhance plotting capabilities and layout
  ## documentation changes:
  * added paper citations to front page of Sherpa Read the Docs
    documentation
  * cleaned up various typos and URL references
  * added examples such as use of set_x/y_label
  ## infrastructure and testing:
  * improved test coverage
  * many updates to CI
  * drop support for Python 3.9 and numpy <1.24
  * initial/experimental support for Python 3.12
  ## bug fixes:
  * fixed an issue with plotting 1D data with asymmetric errs after
    filter
  * include the default identifier in save_all output if it has
    been changed
- Drop numpy2.patch

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-sherpa?expand=0&rev=46
2024-12-06 17:18:04 +00:00
5258946ee6 Accepting request 1200258 from devel:languages:python:numeric
OBS-URL: https://build.opensuse.org/request/show/1200258
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-sherpa?expand=0&rev=22
2024-09-12 14:57:17 +00:00
7ae14f2442 - Add numpy2.patch to fix build with the new numpy
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-sherpa?expand=0&rev=44
2024-09-12 07:17:27 +00:00
9b4ec04117 Accepting request 1177688 from devel:languages:python:numeric
OBS-URL: https://build.opensuse.org/request/show/1177688
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-sherpa?expand=0&rev=21
2024-05-30 13:33:56 +00:00
e1bfbace1a Accepting request 1177590 from home:glaubitz:branches:devel:languages:python:numeric
- Update to 4.16.1:
  * enhancements:
    + minor plotting changes; add support for splitting model expression into
    + additive components and plot the results; support of log scale axes for
    + confidence plots; improved error messages for unavailable plot backends
    + improved RMF plot display to allow choice of energy units
  * documentation changes:
    + updates to fake_pha documentation
    + updates to install.rst to fix incorrect links and outdated version references
    + updated read the docs documentation to match current code
  * bug fixes:
    + fixed multi-panel plot issue with Bokeh backend

OBS-URL: https://build.opensuse.org/request/show/1177590
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-sherpa?expand=0&rev=42
2024-05-30 07:39:19 +00:00
3b8e0a2a55 Accepting request 1173052 from devel:languages:python:numeric
OBS-URL: https://build.opensuse.org/request/show/1173052
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-sherpa?expand=0&rev=20
2024-05-10 10:05:57 +00:00
da2366ddf7 Accepting request 1172907 from home:badshah400:lapack2023
Do not run tests in parallel to avoid random failures (gh#sherpa/sherpa#2031).

OBS-URL: https://build.opensuse.org/request/show/1172907
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-sherpa?expand=0&rev=40
2024-05-10 07:50:13 +00:00
603ff0adc1 Accepting request 1147599 from devel:languages:python:numeric
Forwarded request #1147463 from bnavigator

- Skip python312: Requires setuptools < 60 and distutils

OBS-URL: https://build.opensuse.org/request/show/1147599
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-sherpa?expand=0&rev=19
2024-02-20 20:13:57 +00:00
0cf622083d Accepting request 1147463 from home:bnavigator:branches:devel:languages:python:numeric
- Skip python312: Requires setuptools < 60 and distutils

OBS-URL: https://build.opensuse.org/request/show/1147463
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-sherpa?expand=0&rev=38
2024-02-19 14:15:29 +00:00
1019696aa2 We don't need _constraints after all.
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-sherpa?expand=0&rev=37
2024-01-03 21:40:09 +00:00
c21dedd431 Perhaps not.
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-sherpa?expand=0&rev=36
2024-01-03 21:26:31 +00:00
898d30b293 - Add _constraints to add memory and disk available for testing.
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-sherpa?expand=0&rev=35
2024-01-03 19:46:16 +00:00
7fcc21ca5f Accepting request 1133227 from devel:languages:python:numeric
- Update to 4.16.0:
  * enhancements:
    + the grouping commands like group_counts and group_snr now default to
      only grouping within the noticed range of channels, which is a change
      in behaviour
    + new plotting backend: Users can now choose between matplotlib and
      bokeh (experimental) support use of arbitrary python functions when
      linking model parameters
    + updates to fake_pha, save_all, allowing to write out RMF/ARF files
    + get_plot_prefs and get_contour_prefs call to simplify access to the
      plot and contour preferences
    + implementation of RMFPlot and DataIMGPlot classes and associated UI
      functions (plot_rmf, get_rmf_plot)
    + update support for XSPEC to include version 12.13.1, allow XSPEC
      table models which include the ESCALE parameter, and provide
      experimental support for writing out XSPEC table models.
  * changes to use the NumPy random generator API
  * bug fixes:
    + PHA source plot Y axis scaling (#1825)
    + fix model display for grouped data (#1779, #1784)
    + Change in the ordering of operations when grouping background PHA
      datasets. (#1881)
- Drop patch numpy125.patch and numpy125-CI.patch: Included upstream.
- Skip a misbehaving test.

OBS-URL: https://build.opensuse.org/request/show/1133227
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-sherpa?expand=0&rev=18
2023-12-15 20:48:44 +00:00
f50f69dd2d - Update to 4.16.0:
* enhancements:
    + the grouping commands like group_counts and group_snr now default to
      only grouping within the noticed range of channels, which is a change
      in behaviour
    + new plotting backend: Users can now choose between matplotlib and
      bokeh (experimental) support use of arbitrary python functions when
      linking model parameters
    + updates to fake_pha, save_all, allowing to write out RMF/ARF files
    + get_plot_prefs and get_contour_prefs call to simplify access to the
      plot and contour preferences
    + implementation of RMFPlot and DataIMGPlot classes and associated UI
      functions (plot_rmf, get_rmf_plot)
    + update support for XSPEC to include version 12.13.1, allow XSPEC
      table models which include the ESCALE parameter, and provide
      experimental support for writing out XSPEC table models.
  * changes to use the NumPy random generator API
  * bug fixes:
    + PHA source plot Y axis scaling (#1825)
    + fix model display for grouped data (#1779, #1784)
    + Change in the ordering of operations when grouping background PHA
      datasets. (#1881)
- Drop patch numpy125.patch and numpy125-CI.patch: Included upstream.
- Skip a misbehaving test.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-sherpa?expand=0&rev=33
2023-12-15 03:58:15 +00:00
66ebaa0d74 Accepting request 1109765 from devel:languages:python:numeric
OBS-URL: https://build.opensuse.org/request/show/1109765
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-sherpa?expand=0&rev=17
2023-09-10 11:10:01 +00:00
d49bf1d729 Accepting request 1109557 from home:mcalabkova:branches:devel:languages:python:numeric
- Add upstream patches numpy125.patch and numpy125-CI.patch

OBS-URL: https://build.opensuse.org/request/show/1109557
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-sherpa?expand=0&rev=31
2023-09-08 17:10:57 +00:00
8a95e0eb93 Accepting request 1089585 from devel:languages:python:numeric
- update to 4.15.1:
  * further improvements to filtering/grouping including
    reporting a filter change in the UI
  * fake_pha can be called with a list of ARF/RMF names
  * added linewidth option for line and histogram plots
  * documentation changes:
  * fixed broken URLs
  * improved documentation for templates, plot_pvalue
  * added documentation testing with doctestplus
  * Infrastructure changes:
  * dropped support for Python 3.8
  * experimental support of Python 3.11
  * supported versions of Xspec are 12.12.0 - 12.13.0
  * bug fixes:
  * various updates to notice/ignore and group/ungroup code
  * fixed issue with show_bkg
  * fixed issue when binning values into a 1D histogram
  * fixed cache errors with the TableModel class

OBS-URL: https://build.opensuse.org/request/show/1089585
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-sherpa?expand=0&rev=16
2023-05-30 20:02:12 +00:00
79996de9c9 - update to 4.15.1:
* further improvements to filtering/grouping including
    reporting a filter change in the UI
  * fake_pha can be called with a list of ARF/RMF names
  * added linewidth option for line and histogram plots
  * documentation changes:
  * fixed broken URLs
  * improved documentation for templates, plot_pvalue
  * added documentation testing with doctestplus
  * Infrastructure changes:
  * dropped support for Python 3.8
  * experimental support of Python 3.11
  * supported versions of Xspec are 12.12.0 - 12.13.0
  * bug fixes:
  * various updates to notice/ignore and group/ungroup code
  * fixed issue with show_bkg
  * fixed issue when binning values into a 1D histogram
  * fixed cache errors with the TableModel class

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-sherpa?expand=0&rev=29
2023-05-29 14:13:39 +00:00
e5206e31b5 Accepting request 1060053 from devel:languages:python:numeric
OBS-URL: https://build.opensuse.org/request/show/1060053
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-sherpa?expand=0&rev=15
2023-01-21 18:11:17 +00:00
f06ed7f1b8 Accepting request 1059941 from home:bnavigator:branches:devel:languages:python:numeric
- Update to 4.15.0
  * This release of Sherpa includes various enhancements,
    documentation updates,  bug fixes, and infrastructure changes.
  ## Enhancements:
  * Improved validation of arguments when creating Data objects:
    - arrays sent to Data objects are now converted to ndarrays
    - the independent axis is now made read-only
    - the size of a data object is now fixed.
  * Filter setting with notice/ignore are reported to the screen
    for the users of the UI layer.
  * Increased test coverage for plotting
  ## Documentation changes:
  * updated readthedocs to use pip and pytest instead of setup.py
  * several updates to documentation, including updates to
    fake_pha, calc_ftest, calc_mlr
  ## Infrastructure changes:
  * Drop support for Python 3.7
  * Updates to start creating Python 3.10 Conda packages.
  * Use Numpy 1.20 for Python 3.8/3.9 and Numpy 1.21 for Python
    3.10.
  * Moves toward PEP-517 with some distutils cleanup and more
    configuration moved from setup.py to setup.cfg
  * Various improvements to the GitHub Actions and GitLab workflows
  ## Bug fixes:
  * Ensure chi2xspecvar errors match XSPEC when 0 counts are
    present during background subtraction
  * Remove model instances from the global symbol table when clean
    is called
  * Addresses new warnings in the tests for Matplotlib 3.6.0 and
    AstroPy 5.1

OBS-URL: https://build.opensuse.org/request/show/1059941
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-sherpa?expand=0&rev=27
2023-01-20 22:42:00 +00:00
2403224e1f Accepting request 995127 from devel:languages:python:numeric
OBS-URL: https://build.opensuse.org/request/show/995127
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-sherpa?expand=0&rev=14
2022-08-16 15:07:02 +00:00
6951b439d9 Accepting request 993811 from home:bnavigator:branches:devel:languages:python:numeric
- Sherpa requires a build with setuptools < 60:
  * Use python3X bundled setuptools instead of distribution package
  * Enable early skip_python311 because that bundles setuptools 62

OBS-URL: https://build.opensuse.org/request/show/993811
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-sherpa?expand=0&rev=25
2022-08-15 07:21:58 +00:00
d0305603b7 Accepting request 982377 from devel:languages:python:numeric
OBS-URL: https://build.opensuse.org/request/show/982377
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-sherpa?expand=0&rev=13
2022-06-14 22:31:55 +00:00
6273b367ad Accepting request 981947 from home:bnavigator:branches:devel:languages:python:numeric
- Update to 4.14.1
  * enhancements:
    - various plotting backend improvements
    - various i/o backend improvements
    - data object class improvements
    - basic support for Xspec 12.12.1
    - beta support for python 3.10
  * documentation changes:
    - updated build with CIAO documentation
    - Add a missing class (DataOgipResponse) to the documentation
    - Improves the docstrings for DataPHA
    - fixed typos in plot docs
    - clean up readthedocs issues such as missing bullets
  * Infrastructure changes:
    - updates for compatibility with Clang 12.0
    - updates to the regression tests
  * bug fixes:
    - Improve the FITS headers created when writing out a PHA file (to better match OGIP standards)
    - addresses delete_model_component call failing if a key does not exist
    - fixed issue with writing a PHA dataset as a table rather than a PHA file
    - ensure FITS column access is case insensitive
    - image handling and image coordinates
 - Drop sherpa-pr1318-py310tests.patch fixed upstream
 - Drop sherpa-pr1319-distutils-hack.patch fixed upstream

OBS-URL: https://build.opensuse.org/request/show/981947
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-sherpa?expand=0&rev=23
2022-06-13 08:29:00 +00:00
e635a6f41a Accepting request 952081 from devel:languages:python:numeric
- Add sherpa-pr1318-py310tests.patch -- gh#sherpa/sherpa#1318
- Skip two tests failing on non x86_64 due to floating point
  precision
- Disable 32-bit ARM build
- Add sherpa-pr1319-distutils-hack.patch -- another attempt for
  python310 compatibility (gh#sherpa/sherpa#1319)

OBS-URL: https://build.opensuse.org/request/show/952081
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-sherpa?expand=0&rev=12
2022-02-07 22:38:13 +00:00
10e1774ca2 Fix changelog
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-sherpa?expand=0&rev=22
2022-02-07 09:22:44 +00:00
902ac9b232 Accepting request 951639 from home:bnavigator:branches:devel:languages:python:numeric
- Add sherpa-pr1318-py310tests.patch -- gh#sherpa/sherpa#1318
- Skip two tests failing on non x86_64 due to floating point
  precision
- Disable 32-bit ARM build

OBS-URL: https://build.opensuse.org/request/show/951639
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-sherpa?expand=0&rev=21
2022-02-06 07:07:42 +00:00
ab152915d1 Accepting request 935928 from devel:languages:python:numeric
OBS-URL: https://build.opensuse.org/request/show/935928
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-sherpa?expand=0&rev=11
2021-12-06 22:59:56 +00:00
7ec0f4a8b5 Accepting request 935920 from home:Guillaume_G:branches:devel:languages:python:numeric
- Update to 4.14.0:
  * enhancements:
    - filtering and grouping area for binned (1D) spectral data has been improved
    with changes to the default behavior and many bug fixes resulting in changes
    to the statistics, degrees-of-freedom and energy flux in comparison to the
    previous version for the same data with the same filter.
    - updates to allow users to change the hard limits of XSPEC model parameters
    - the sample_flux routine now returns correct information for the clip column
  * documentation changes:
    - improved PHA simulation documentation
    - improved Filtering and grouping of PHA data documentation
    - added sherpa.image module documentation
    - added section on running tests to developer docs
  * Infrastructure Changes:
    - updates to support Apple ARM
    - update to support Xspec version 12.12
    - update fftw from version 3.3.8 to 3.3.9
    - clean up of compiler and sphinx warnings
    - changes to support gcc 9.3.0 in conda defaults
    - updates to support python 3.9 including readline 8.1 upgrade, numpy minimum
    1.19 (numpy 1.18 minimum for python 3.7/8)
    - test infrastructure clean up and updates
  * bug fixes:
    - updates to fix several 'unable to parse region string: None' errors
    - fix issue where save_all() of a loaded image with no region filter would fail
    on reload
    - fixed issue with plot_model() being called before notice or ignore could
    lead to filters not getting applied
    - fix to error out instead of crash when grouping data using an unsupported
    method

OBS-URL: https://build.opensuse.org/request/show/935920
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-sherpa?expand=0&rev=20
2021-12-06 08:40:46 +00:00
f476be3318 Accepting request 910430 from devel:languages:python:numeric
OBS-URL: https://build.opensuse.org/request/show/910430
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-sherpa?expand=0&rev=10
2021-08-06 20:44:50 +00:00
80d61407f3 Accepting request 910375 from home:bnavigator:astropy
- Add sherpa-pr1227-astropy43.patch in order to fix test failure
  gh#sherpa/sherpa#1227

OBS-URL: https://build.opensuse.org/request/show/910375
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-sherpa?expand=0&rev=19
2021-08-06 06:28:57 +00:00
b20946ac29 Accepting request 899444 from devel:languages:python:numeric
OBS-URL: https://build.opensuse.org/request/show/899444
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-sherpa?expand=0&rev=9
2021-06-11 20:30:48 +00:00
e6b2dc634a Accepting request 899441 from home:Guillaume_G:branches:devel:languages:python:numeric
- Update to 4.13.1:
  * documentation changes:
    - updates to documentation for TableModel, Notice2D, cache
    support for evaluating models, and low level optimization code
    - jupyter notebook uopdates
  * Infrastructure Changes:
    - the master branch has been migrated from master to main
    - updates to support numpy 1.20
    - updates to support astropy 4.2.1
    - updates to support matplotlib 3.4
    - test infrastructure clean up and updates
  * bug fixes:
    - fix an issue with cache evaluation on 1D models using
    integrated bins
    - fix for aarch64 build issue
    - fix to sherpa citation command
    - fix to honor clearwindow setting for plot_source
    - fix errors from save_data when the output file exists
    - fix build issues using gcc 7.3 with -Werror=format-security
    compilation flag
    - fix for reg_proj and reg_unc erroring out when the min or max
    arguments are tuples rather than lists
- Drop upstreamed patches:
  * sherpa-fix-aarch64.patch
  * sherpa-numpy-1.20.patch
  * sherpa-mpl-3.4.patch

OBS-URL: https://build.opensuse.org/request/show/899441
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-sherpa?expand=0&rev=17
2021-06-11 10:23:51 +00:00
b40171e0be Accepting request 888258 from devel:languages:python:numeric
OBS-URL: https://build.opensuse.org/request/show/888258
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-sherpa?expand=0&rev=8
2021-04-25 19:27:20 +00:00
f2cfdec32b Accepting request 888253 from home:bnavigator:branches:devel:languages:python:numeric
- Fix python3 flavor multibuild:
  * Compile bundled libs for every flavor
  * Fix bundled lib location configuration
  * Use system fftw3
- Enable tests with matplotlib and astropy
- Add sherpa-mpl-3.4.patch for Matplotlib 3.4 gh#sherpa/sherpa#1125

OBS-URL: https://build.opensuse.org/request/show/888253
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-sherpa?expand=0&rev=15
2021-04-24 20:33:16 +00:00
ba8c84b5c1 Accepting request 873034 from devel:languages:python:numeric
OBS-URL: https://build.opensuse.org/request/show/873034
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-sherpa?expand=0&rev=7
2021-02-17 17:12:34 +00:00
14bc0b2cc6 Accepting request 873000 from home:badshah400:branches:devel:languages:python:numeric
* Update to version 4.13.0.
* Add sherpa-numpy-1.20.patch: Fix test errors with numpy 1.20 [gh#sherpa/sherpa#/1092]; patch committed upstream.
* Disable python 3.6 flavour: dependency numpy not supported.

OBS-URL: https://build.opensuse.org/request/show/873000
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-sherpa?expand=0&rev=13
2021-02-17 08:51:12 +00:00
a2e2b9a0e3 Accepting request 841871 from devel:languages:python:numeric
OBS-URL: https://build.opensuse.org/request/show/841871
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-sherpa?expand=0&rev=6
2020-10-15 11:51:17 +00:00
Tomáš Chvátal
2e12bdc119 Accepting request 841790 from home:Guillaume_G:branches:openSUSE:Factory:ARM
- Fix aarch64 build and test:
  * sherpa-fix-aarch64.patch

OBS-URL: https://build.opensuse.org/request/show/841790
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-sherpa?expand=0&rev=11
2020-10-15 08:08:32 +00:00
969376c5c6 Accepting request 834270 from devel:languages:python:numeric
OBS-URL: https://build.opensuse.org/request/show/834270
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-sherpa?expand=0&rev=5
2020-09-15 14:27:53 +00:00
Tomáš Chvátal
9af53e5796 Accepting request 834267 from home:badshah400:branches:devel:languages:python:numeric
- Update to version 4.12.1.
- Drop already incorporated patches:
  * python-sherpa-python3.8.patch.
  * config_with_build.patch.

OBS-URL: https://build.opensuse.org/request/show/834267
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-sherpa?expand=0&rev=9
2020-09-14 10:12:53 +00:00
7eb9c82140 Accepting request 807290 from devel:languages:python:numeric
OBS-URL: https://build.opensuse.org/request/show/807290
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-sherpa?expand=0&rev=4
2020-05-19 12:59:12 +00:00
Tomáš Chvátal
18219ebf9c Accepting request 807247 from home:pgajdos:python
submit

OBS-URL: https://build.opensuse.org/request/show/807247
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-sherpa?expand=0&rev=7
2020-05-19 12:14:25 +00:00
bf66c7bfcb Accepting request 784359 from devel:languages:python:numeric
OBS-URL: https://build.opensuse.org/request/show/784359
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-sherpa?expand=0&rev=3
2020-03-12 22:09:24 +00:00
Tomáš Chvátal
a9249c5ebb Accepting request 784357 from home:badshah400:branches:devel:languages:python:numeric
- Add python-sherpa-python3.8.patch: Fix building with python3.8; taken from upstream commit [gh#sherpa/sherpa#696].
- Disbale bytecode generation when running tests.
- Remove hashbangs from non executable files.

OBS-URL: https://build.opensuse.org/request/show/784357
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-sherpa?expand=0&rev=5
2020-03-12 15:40:02 +00:00
a84ca1a1bc Accepting request 760916 from devel:languages:python:numeric
OBS-URL: https://build.opensuse.org/request/show/760916
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-sherpa?expand=0&rev=2
2020-01-05 14:22:09 +00:00
Tomáš Chvátal
edbc2bdf07 Accepting request 760838 from home:bmwiedemann:branches:devel:languages:python:numeric
Add reproducible.patch to disable optimizing for build CPU to make package build reproducible

OBS-URL: https://build.opensuse.org/request/show/760838
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-sherpa?expand=0&rev=3
2020-01-05 07:53:45 +00:00
afae7db087 Accepting request 755354 from devel:languages:python:numeric
Modeling and fitting package for scientific data analysis

OBS-URL: https://build.opensuse.org/request/show/755354
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-sherpa?expand=0&rev=1
2019-12-27 12:43:54 +00:00
Todd R
58ba0f8406 Accepting request 755353 from home:TheBlackCat:branches:devel:languages:python:numeric
Modeling and fitting package for scientific data analysis

OBS-URL: https://build.opensuse.org/request/show/755353
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-sherpa?expand=0&rev=1
2019-12-09 18:49:08 +00:00
8 changed files with 0 additions and 1608 deletions

View File

@@ -1,297 +0,0 @@
From 72028ffe7ce2566a8f1e88c2c06d79cf5f0be9c1 Mon Sep 17 00:00:00 2001
From: Douglas Burke <dburke.gw@gmail.com>
Date: Thu, 27 Jun 2024 12:42:52 -0400
Subject: [PATCH 1/7] root: internal code cleanup
The root-finding code is not documented well. This adds a small
wrapper routine to avoid some replicated code, but could we
just add this to transformed_quad_coef() instead - which is
not explicitly marked as an external routine?
Several comments have been added for potential future work.
---
sherpa/utils/__init__.py | 38 ++++++++++++++++++++++-----------
sherpa/utils/tests/test_root.py | 5 +++++
2 files changed, 30 insertions(+), 13 deletions(-)
Index: sherpa-4.16.1/sherpa/utils/__init__.py
===================================================================
--- sherpa-4.16.1.orig/sherpa/utils/__init__.py
+++ sherpa-4.16.1/sherpa/utils/__init__.py
@@ -1480,7 +1480,7 @@ def create_expr_integrated(lovals, hival
delim : str, optional
The separator for a range.
eps : number, optional
- The tolerance for comparing two numbers with sao_fcmp.
+ This value is unused.
Raises
------
@@ -3389,6 +3389,7 @@ def bisection(fcn, xa, xb, fa=None, fb=N
return [[None, None], [[xa, fa], [xb, fb]], nfev[0]]
+# Is this used at all?
def quad_coef(x, f):
"""
p( x ) = f( xc ) + A ( x - xc ) + B ( x - xc ) ( x - xb )
@@ -3461,6 +3462,11 @@ def transformed_quad_coef(x, f):
xa, xb, xc = x[0], x[1], x[2]
fa, fb, fc = f[0], f[1], f[2]
+ # What happens if xb_xa or xc_xa are 0? That is, either
+ # xa == xb
+ # xc == xa
+ # Is the assumption that this just never happen?
+ #
xc_xb = xc - xb
fc_fb = fc - fb
A = fc_fb / xc_xb
@@ -3472,6 +3478,21 @@ def transformed_quad_coef(x, f):
return [B, C]
+def _get_discriminant(xa, xb, xc, fa, fb, fc):
+ """Wrap up code to transformed_quad_coef.
+
+ This is common code that could be added to transformed_quad_coef
+ but is left out at the moment, to make it easier to look back
+ at code changes. There is no description of the parameters as
+ the existing code has none.
+
+ """
+
+ [B, C] = transformed_quad_coef([xa, xb, xc], [fa, fb, fc])
+ discriminant = max(C * C - 4.0 * fc * B, 0.0)
+ return B, C, discriminant
+
+
def demuller(fcn, xa, xb, xc, fa=None, fb=None, fc=None, args=(),
maxfev=32, tol=1.0e-6):
"""A root-finding algorithm using Muller's method.
@@ -3578,10 +3599,7 @@ def demuller(fcn, xa, xb, xc, fa=None, f
while nfev[0] < maxfev:
- [B, C] = transformed_quad_coef([xa, xb, xc], [fa, fb, fc])
-
- discriminant = max(C * C - 4.0 * fc * B, 0.0)
-
+ B, C, discriminant = _get_discriminant(xa, xb, xc, fa, fb, fc)
if is_nan(B) or is_nan(C) or \
0.0 == C + mysgn(C) * np.sqrt(discriminant):
return [[None, None], [[None, None], [None, None]], nfev[0]]
@@ -3685,11 +3703,7 @@ def new_muller(fcn, xa, xb, fa=None, fb=
if abs(fc) <= tol:
return [[xc, fc], [[xa, fa], [xb, fb]], nfev[0]]
- tran = transformed_quad_coef([xa, xb, xc], [fa, fb, fc])
- B = tran[0]
- C = tran[1]
-
- discriminant = max(C * C - 4.0 * fc * B, 0.0)
+ B, C, discriminant = _get_discriminant(xa, xb, xc, fa, fb, fc)
xd = xc - 2.0 * fc / (C + mysgn(C) * np.sqrt(discriminant))
@@ -3827,11 +3841,9 @@ def apache_muller(fcn, xa, xb, fa=None,
oldx = 1.0e128
while nfev[0] < maxfev:
- tran = transformed_quad_coef([xa, xb, xc], [fa, fb, fc])
- B = tran[0]
- C = tran[1]
- discriminant = max(C * C - 4.0 * fc * B, 0.0)
- den = mysgn(C) * np.sqrt(discriminant)
+
+ B, C, discriminant = _get_discriminant(xa, xb, xc, fa, fb, fc)
+ den = np.sign(C) * np.sqrt(discriminant)
xplus = xc - 2.0 * fc / (C + den)
if C != den:
xminus = xc - 2.0 * fc / (C - den)
@@ -4008,9 +4020,13 @@ def zeroin(fcn, xa, xb, fa=None, fb=None
warning('%s: %s fa * fb < 0 is not met', __name__, fcn.__name__)
return [[None, None], [[None, None], [None, None]], nfev[0]]
+ # With NumPy 2.0 the casting rules changed, leading to some
+ # behavioural changes in this code. The simplest fix was to
+ # make sure DBL_EPSILON did not remain a np.float32 value.
+ #
xc = xa
fc = fa
- DBL_EPSILON = np.finfo(np.float32).eps
+ DBL_EPSILON = float(np.finfo(np.float32).eps)
while nfev[0] < maxfev:
prev_step = xb - xa
Index: sherpa-4.16.1/sherpa/utils/tests/test_root.py
===================================================================
--- sherpa-4.16.1.orig/sherpa/utils/tests/test_root.py
+++ sherpa-4.16.1/sherpa/utils/tests/test_root.py
@@ -1,5 +1,6 @@
#
-# Copyright (C) 2007, 2016, 2018, 2020, 2021 Smithsonian Astrophysical Observatory
+# Copyright (C) 2007, 2016, 2018, 2020, 2021, 2024
+# Smithsonian Astrophysical Observatory
#
#
# This program is free software; you can redistribute it and/or modify
@@ -27,7 +28,7 @@ from sherpa.utils import demuller, bisec
zeroin
-def sqr(x, *args):
+def sqr(x):
return x * x
@@ -177,9 +178,7 @@ def prob34(x, *args):
return 1.0 / x - numpy.sin(x) + 1.0
-def prob35(x, *args):
- return (x*x - 2.0) * x - 5.0
-
+# prob35 was the same as prob16
def prob36(x, *args):
return 1.0 / x - 1.0
@@ -288,7 +287,6 @@ def demuller2(fcn, xa, xb, fa=None, fb=N
(prob32, 0.1, 0.9),
(prob33, 2.8, 3.1),
(prob34, -1.3, -0.5),
- (prob35, 2.0, 3.0),
(prob36, 0.5, 1.5),
(prob37, 0.5, 5.0),
(prob38, 1.0, 4.0),
Index: sherpa-4.16.1/sherpa/estmethods/__init__.py
===================================================================
--- sherpa-4.16.1.orig/sherpa/estmethods/__init__.py
+++ sherpa-4.16.1/sherpa/estmethods/__init__.py
@@ -380,6 +380,11 @@ def covariance(pars, parmins, parmaxes,
eflag = est_success
ubound = diag[num]
lbound = -diag[num]
+
+ # What happens when lbound or ubound is NaN? This is
+ # presumably why the code is written as it is below (e.g. a
+ # pass if the values can be added to pars[num]).
+ #
if pars[num] + ubound < parhardmaxes[num]:
pass
else:
@@ -1093,6 +1098,7 @@ def confidence(pars, parmins, parmaxes,
print_status(myblog.blogger.info, verbose, status_prefix[dirn],
delta_zero, lock)
+ # This should really set the error flag appropriately.
error_flags.append(est_success)
#
Index: sherpa-4.16.1/sherpa/fit.py
===================================================================
--- sherpa-4.16.1.orig/sherpa/fit.py
+++ sherpa-4.16.1/sherpa/fit.py
@@ -277,7 +277,7 @@ class FitResults(NoNewAttributesAfterIni
self.succeeded = results[0]
self.parnames = tuple(p.fullname for p in fit.model.get_thawed_pars())
- self.parvals = tuple(results[1])
+ self.parvals = tuple(float(r) for r in results[1])
self.istatval = init_stat
self.statval = results[2]
self.dstatval = np.abs(results[2] - init_stat)
@@ -439,25 +439,28 @@ class ErrorEstResults(NoNewAttributesAft
self.sigma = fit.estmethod.sigma
self.percent = erf(self.sigma / sqrt(2.0)) * 100.0
self.parnames = tuple(p.fullname for p in parlist if not p.frozen)
- self.parvals = tuple(p.val for p in parlist if not p.frozen)
+ self.parvals = tuple(float(p.val) for p in parlist if not p.frozen)
self.parmins = ()
self.parmaxes = ()
- self.nfits = 0
for i in range(len(parlist)):
if (results[2][i] == est_hardmin or
- results[2][i] == est_hardminmax):
+ results[2][i] == est_hardminmax or
+ results[0][i] is None # It looks like confidence does not set the flag
+ ):
self.parmins = self.parmins + (None,)
warning("hard minimum hit for parameter %s", self.parnames[i])
else:
- self.parmins = self.parmins + (results[0][i],)
+ self.parmins = self.parmins + (float(results[0][i]),)
if (results[2][i] == est_hardmax or
- results[2][i] == est_hardminmax):
+ results[2][i] == est_hardminmax or
+ results[1][i] is None # It looks like confidence does not set the flag
+ ):
self.parmaxes = self.parmaxes + (None,)
warning("hard maximum hit for parameter %s", self.parnames[i])
else:
- self.parmaxes = self.parmaxes + (results[1][i],)
+ self.parmaxes = self.parmaxes + (float(results[1][i]),)
self.nfits = results[3]
self.extra_output = results[4]
Index: sherpa-4.16.1/sherpa/astro/tests/test_astro.py
===================================================================
--- sherpa-4.16.1.orig/sherpa/astro/tests/test_astro.py
+++ sherpa-4.16.1/sherpa/astro/tests/test_astro.py
@@ -206,7 +206,7 @@ def test_sourceandbg(parallel, run_threa
assert fit_results.numpoints == 1330
assert fit_results.dof == 1325
- assert covarerr[0] == approx(0.012097, rel=1e-3)
+ assert covarerr[0] == approx(0.012097, rel=1.05e-3)
assert covarerr[1] == approx(0, rel=1e-3)
assert covarerr[2] == approx(0.000280678, rel=1e-3)
assert covarerr[3] == approx(0.00990783, rel=1e-3)
Index: sherpa-4.16.1/docs/developer/index.rst
===================================================================
--- sherpa-4.16.1.orig/docs/developer/index.rst
+++ sherpa-4.16.1/docs/developer/index.rst
@@ -100,6 +100,17 @@ files and shows exactly which lines were
Run doctests locally
--------------------
+
+.. note::
+ The documentation tests are known to fail if NumPy 2.0 is installed
+ because the representation of NumPy types such as ``np.float64``
+ have changed, leading to errors like::
+
+ Expected:
+ 2.5264364698914e-06
+ Got:
+ np.float64(2.5264364698914e-06)
+
If `doctestplus <https://pypi.org/project/pytest-doctestplus/>` is installed
(and it probably is because it's part of
`sphinx-astropy <https://pypi.org/project/sphinx-astropy/>`,
Index: sherpa-4.16.1/docs/install.rst
===================================================================
--- sherpa-4.16.1.orig/docs/install.rst
+++ sherpa-4.16.1/docs/install.rst
@@ -34,17 +34,14 @@ Requirements
Sherpa has the following requirements:
* Python 3.9 to 3.11
-* NumPy (the exact lower limit has not been determined,
- 1.21.0 or later will work, earlier version may work)
+* NumPy (version 2.0 should work but there has been limited testing)
* Linux or OS-X (patches to add Windows support are welcome)
Sherpa can take advantage of the following Python packages
if installed:
* :term:`Astropy`: for reading and writing files in
- :term:`FITS` format. The minimum required version of astropy
- is version 1.3, although only versions 2 and higher are used in testing
- (version 3.2 is known to cause problems, but version 3.2.1 is okay).
+ :term:`FITS` format.
* :term:`matplotlib`: for visualisation of
one-dimensional data or models, one- or two- dimensional
error analysis, and the results of Monte-Carlo Markov Chain

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ed4dfba237c4a6b60b4141e5619b53b25cb9e23be26cbcd7dbf00f8822d4669c
size 13738921

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f22f9dcb1b6326508d4142ea88931492972782fd292871ed942d1a212e70091a
size 13985328

View File

@@ -1,248 +0,0 @@
From 388a7b3c87b8068c572041aeb57d2136a583e83b Mon Sep 17 00:00:00 2001
From: Douglas Burke <dburke.gw@gmail.com>
Date: Tue, 29 Oct 2024 14:35:02 -0400
Subject: [PATCH] TEST: address numpy 2 changes to output for docstring tests
The str/repr output in NumPy 2 is much-more verbose and no-longet
matches the behaviour of the associated Python types. This breaks
a number of doctests, which had things like
>>> (a == b).all()
True
>>> x.val
3.4
which now fails for "textual" reasons even though the values are
the same. The simplest approach is just to print the values, so
we now have
>>> print((a == b).all())
True
>>> print(x.val)
3.4
It is not ideal, but is a simple fix that works with versions 1
and 2 of NumPy.
---
sherpa/astro/data.py | 14 +++++++-------
sherpa/data.py | 8 ++++----
sherpa/models/basic.py | 24 ++++++++++++------------
sherpa/models/model.py | 2 +-
sherpa/models/parameter.py | 10 +++++-----
5 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/sherpa/astro/data.py b/sherpa/astro/data.py
index 15f91fad72..87db02f617 100644
--- a/sherpa/astro/data.py
+++ b/sherpa/astro/data.py
@@ -2563,9 +2563,9 @@ def _get_ebins(self,
>>> pha.ungroup()
>>> pha.units = 'channel'
>>> clo, chi = pha._get_ebins()
- >>> (clo == pha.channel).all()
+ >>> print((clo == pha.channel).all())
True
- >>> (chi == clo + 1).all()
+ >>> print((chi == clo + 1).all())
True
>>> pha.units = 'energy'
@@ -2574,7 +2574,7 @@ def _get_ebins(self,
True
>>> elo[0:5]
array([0.00146, 0.0146 , 0.0292 , 0.0438 , 0.0584 ])
- >>> (elo[1:] == ehi[:-1]).all()
+ >>> print((elo[1:] == ehi[:-1]).all())
True
>>> pha.group()
@@ -2587,7 +2587,7 @@ def _get_ebins(self,
>>> pha.units = 'wave'
>>> wlo, whi = pha._get_ebins()
- >>> (wlo == glo).all()
+ >>> print((wlo == glo).all())
True
"""
@@ -2702,7 +2702,7 @@ def _get_indep(self,
array([0.1 , 0.11, 0.12, 0.13, 0.14])
>>> ehi[0:5]
array([0.11 , 0.12 , 0.13 , 0.14 , 0.15000001])
- >>> (elo[1:] == ehi[:-1]).all()
+ >>> print((elo[1:] == ehi[:-1]).all())
True
>>> pha.units = 'wave'
@@ -2711,7 +2711,7 @@ def _get_indep(self,
array([112.71289825, 103.32015848, 95.37245534, 88.56013348])
>>> whi[0:4]
array([123.98418555, 112.71289825, 103.32015848, 95.37245534])
- >>> (wlo[:-1] == whi[1:]).all()
+ >>> print((wlo[:-1] == whi[1:]).all())
True
"""
@@ -3425,7 +3425,7 @@ def apply_grouping(self, data, groupfunc=np.sum):
>>> v1 = pha.apply_grouping(dvals)
>>> pha.notice(1.2, 4.5)
>>> v2 = pha.apply_grouping(dvals)
- >>> np.all(v1 == v2)
+ >>> print(np.all(v1 == v2))
True
"""
diff --git a/sherpa/data.py b/sherpa/data.py
index 30fe9dbf0f..daf79d93e2 100644
--- a/sherpa/data.py
+++ b/sherpa/data.py
@@ -2042,8 +2042,8 @@ def notice(self,
>>> x = np.arange(0.4, 2.6, 0.2)
>>> y = np.ones_like(x)
>>> d = Data1D('example', x, y)
- >>> d.x[0], d.x[-1]
- (0.4, 2.4000000000000004)
+ >>> print(d.x[0], d.x[-1])
+ 0.4 2.4000000000000004
>>> d.notice()
>>> d.get_filter(format='%.1f')
'0.4:2.4'
@@ -2326,8 +2326,8 @@ def notice(self,
>>> xlo, xhi = edges[:-1], edges[1:]
>>> y = np.ones_like(xlo)
>>> d = Data1DInt('example', xlo, xhi, y)
- >>> d.xlo[0], d.xhi[-1]
- (0.4, 2.400000000000001)
+ >>> print(d.xlo[0], d.xhi[-1])
+ 0.4 2.400000000000001
>>> d.get_filter(format='%.1f')
'0.4:2.4'
>>> d.notice(0.8, 1.9)
diff --git a/sherpa/models/basic.py b/sherpa/models/basic.py
index c1061e033a..d5280eda0f 100644
--- a/sherpa/models/basic.py
+++ b/sherpa/models/basic.py
@@ -539,14 +539,14 @@ class Gauss1D(RegriddableModel1D):
>>> m1.pos, m2.pos = 10, 10
>>> m1.ampl, m2.ampl = 10, 10
>>> m1.fwhm, m2.fwhm = 5, 5
- >>> m1(10)
+ >>> print(m1(10))
10.0
- >>> m2(10)
+ >>> print(m2(10))
1.8788745573993026
>>> m1.fwhm, m2.fwhm = 1, 1
- >>> m1(10)
+ >>> print(m1(10))
10.0
- >>> m2(10)
+ >>> print(m2(10))
9.394372786996513
The normalised version will sum to the amplitude when given
@@ -558,9 +558,9 @@ class Gauss1D(RegriddableModel1D):
>>> m1.fwhm, m2.fwhm = 12.2, 12.2
>>> grid = np.arange(-90, 110, 0.01)
>>> glo, ghi = grid[:-1], grid[1:]
- >>> m1(glo, ghi).sum()
+ >>> print(m1(glo, ghi).sum())
129.86497637060958
- >>> m2(glo, ghi).sum()
+ >>> print(m2(glo, ghi).sum())
10.000000000000002
"""
@@ -1923,12 +1923,12 @@ class TableModel(ArithmeticModel):
>>> d.staterror = [.2, .2, .2, .2, .2]
>>> tm1 = TableModel('tabmodel')
>>> tm1.load(None, [.6, .2, 1.1, .2, .5])
- >>> tm1.ampl.val
+ >>> print(tm1.ampl.val)
1.0
>>> tm1.fold(d)
>>> fit1 = Fit(d, tm1)
>>> res1 = fit1.fit()
- >>> tm1.ampl.val
+ >>> print(tm1.ampl.val)
1.9894736842102083
In this case the `fold` method is necessary, to ensure that the
@@ -1941,11 +1941,11 @@ class TableModel(ArithmeticModel):
>>> tm2 = TableModel('tabmodel')
>>> tm2.load(None, [.6, .2, 1.1, .2, .5])
>>> tm2.fold(d)
- >>> tm2.ampl.val
+ >>> print(tm2.ampl.val)
1.0
>>> fit2 = Fit(d, tm2)
>>> res2 = fit2.fit()
- >>> tm2.ampl.val
+ >>> print(tm2.ampl.val)
1.9866666666663104
The masking also holds if the notice or ignore method has been
@@ -1957,11 +1957,11 @@ class TableModel(ArithmeticModel):
>>> tm3 = TableModel('tabmodel')
>>> tm3.load(None, [.6, .2, 1.1, .2, .5])
>>> tm3.fold(d)
- >>> tm3.ampl.val
+ >>> print(tm3.ampl.val)
1.0
>>> fit3 = Fit(d, tm3)
>>> res = fit3.fit()
- >>> tm3.ampl.val
+ >>> print(tm3.ampl.val)
1.9866666666663104
"""
diff --git a/sherpa/models/model.py b/sherpa/models/model.py
index 5b89181d28..020ef7a30f 100644
--- a/sherpa/models/model.py
+++ b/sherpa/models/model.py
@@ -152,7 +152,7 @@
>>> m1.ampl = 10
>>> m2.ampl = 12
- >>> m3.ampl.val
+ >>> print(m3.ampl.val)
11.0
>>> m3.ampl.link
<BinaryOpParameter '(gauss1d.ampl + gmdl.ampl) / 2'>
diff --git a/sherpa/models/parameter.py b/sherpa/models/parameter.py
index 3e1ee5215a..09af7c9bcf 100644
--- a/sherpa/models/parameter.py
+++ b/sherpa/models/parameter.py
@@ -60,7 +60,7 @@
The `val` attribute is used to retrieve or change the parameter value:
- >>> p.val
+ >>> print(p.val)
2.0
>>> p.val = 3
@@ -72,9 +72,9 @@
for these are the 32-bit floating point maximum value, and it's
negative:
- >>> p.max
+ >>> print(p.max)
3.4028234663852886e+38
- >>> p.min
+ >>> print(p.min)
-3.4028234663852886e+38
Setting a value outside this range will raise a
@@ -578,9 +578,9 @@ def _set_link(self, link: Optional[Parameter]) -> None:
>>> a = Parameter("mdl", "a", 2)
>>> b = Parameter("mdl", "b", 1)
>>> b.link = 10 - a
->>> a.val
+>>> print(a.val)
2.0
->>> b.val
+>>> print(b.val)
8.0
""")

View File

@@ -1,86 +0,0 @@
From 5e3d13df1c09134fe5b1cbb27bfc3559ef0641a0 Mon Sep 17 00:00:00 2001
From: Doug Burke <dburke@cfa.harvard.edu>
Date: Fri, 3 Jan 2025 16:46:36 -0500
Subject: [PATCH] TESTS: avoid matplotlib version differences (fix #2206)
The matlpotlib get_linestyles method can return
[(x, None)]
where x = None, 0.0, or np.float64(0.0) depending on matplotlib
version (and probably NumPy).
Since we don't really care too much here, just check the return
has length of 1, the first element has length of 2, and the
second element is None.
---
sherpa/astro/ui/tests/test_astro_ui_plot.py | 35 +++++++++++----------
1 file changed, 18 insertions(+), 17 deletions(-)
diff --git a/sherpa/astro/ui/tests/test_astro_ui_plot.py b/sherpa/astro/ui/tests/test_astro_ui_plot.py
index a6b7c07aa8..5a41d3ce4e 100644
--- a/sherpa/astro/ui/tests/test_astro_ui_plot.py
+++ b/sherpa/astro/ui/tests/test_astro_ui_plot.py
@@ -1,5 +1,5 @@
#
-# Copyright (C) 2019 - 2024
+# Copyright (C) 2019 - 2025
# Smithsonian Astrophysical Observatory
#
#
@@ -32,6 +32,7 @@
import copy
import logging
+
import numpy as np
import pytest
@@ -1843,15 +1844,15 @@ def test_pha1_plot_data_options(caplog, clean_astro_ui, requires_pylab,
assert len(coll.get_segments()) == 42
- # The return value depends on matplotlib version (>= 3.3
- # returns something). What has changed? Maybe this should
- # not be tested?
+ # The linestyles return value has changed with matplotib
+ # and NumPy version, so just check the second element
+ # and not the first (which can be None, 0.0, np.float64(0)).
#
- expected = [(None, None)]
- if matplotlib.__version__ >= '3.3.0':
- expected = [(0.0, None)]
-
- assert coll.get_linestyles() == expected
+ #
+ ls = coll.get_linestyles()
+ assert len(ls) == 1
+ assert len(ls[0]) == 2
+ assert ls[0][1] is None
# looks like the color has been converted to individual channels
# - e.g. floating-point values for R, G, B, and alpha.
@@ -2041,15 +2042,15 @@ def test_pha1_plot_fit_options(clean_astro_ui, requires_pylab, basic_pha1):
assert len(coll.get_segments()) == 42
- # The return value depends on matplotlib version (>= 3.3
- # returns something). What has changed? Maybe this should
- # not be tested?
+ # The linestyles return value has changed with matplotib
+ # and NumPy version, so just check the second element
+ # and not the first (which can be None, 0.0, np.float64(0)).
#
- expected = [(None, None)]
- if matplotlib.__version__ >= '3.3.0':
- expected = [(0.0, None)]
-
- assert coll.get_linestyles() == expected
+ #
+ ls = coll.get_linestyles()
+ assert len(ls) == 1
+ assert len(ls[0]) == 2
+ assert ls[0][1] is None
# looks like the color has been converted to individual channels
# - e.g. floating-point values for R, G, B, and alpha.

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c61443bf3530e42322cec52887cc2f170c2d5d9aaba2822e107da2626c269a1c
size 137775313

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:215d3465c7a9d1b4307ec5eeb1f489a1251de9cee71e75e7162f491ad6037126
size 137775257

View File

@@ -1,965 +0,0 @@
From 0fafdd4522408e15561ae79a502b096317bb0d9e Mon Sep 17 00:00:00 2001
From: Douglas Burke <dburke.gw@gmail.com>
Date: Fri, 6 Dec 2024 12:06:50 -0500
Subject: [PATCH 1/2] TEST: handle pytest 8.3.4 change in bool tests with
approx
Fix #2202
In pytest 8.3.3 and earlier
>>> import numpy as np; import pytest
>>> pytest.__version__
'8.3.3'
>>> np.ones(2, dtype=bool) == pytest.approx([True, True])
True
However, pytest 8.3.4 now causes this to fail
>>> import numpy as np; import pytest
>>> pytest.__version__
'8.3.4'
>>> np.ones(2, dtype=bool) == pytest.approx([True, True])
False
This is because of "pytest.approx considers boolean numeric types"
https://github.com/pytest-dev/pytest/issues/9353
The solution is to make the "expected" value be a ndarray, and so
>>> np.ones(2, dtype=bool) == pytest.approx(np.asarray([True, True]))
True
holds with both pytest 8.3.3 and 8.3.4.
So this commit basically goes through and updates the tests so that
we use a ndarray for boolean arrays.
An alternative would be to change from
assert got == pytest.approx(expected)
to something like
assert np.all(got == expected)
However, the error message when the array lengths are different or
an element is different are a **lot less** useful, and the change would
be even-more invasive than this change.
---
sherpa/astro/io/tests/test_io_pha.py | 2 +-
sherpa/astro/tests/test_astro_data.py | 43 +++---
sherpa/astro/tests/test_astro_data2.py | 131 +++++++++++-------
sherpa/astro/tests/test_astro_instrument.py | 3 +-
sherpa/astro/tests/test_astro_plot.py | 6 +-
sherpa/astro/ui/tests/test_astro_ui.py | 3 +-
sherpa/astro/ui/tests/test_astro_ui_unit.py | 9 +-
sherpa/astro/ui/tests/test_filtering.py | 8 +-
.../utils/tests/test_astro_utils_unit.py | 8 +-
sherpa/tests/test_data.py | 6 +-
sherpa/ui/tests/test_session.py | 3 +-
sherpa/ui/tests/test_ui_unit.py | 10 +-
sherpa/utils/tests/test_utils.py | 10 +-
13 files changed, 146 insertions(+), 96 deletions(-)
diff --git a/sherpa/astro/io/tests/test_io_pha.py b/sherpa/astro/io/tests/test_io_pha.py
index 84dcd4a98c..ceab1609a4 100644
--- a/sherpa/astro/io/tests/test_io_pha.py
+++ b/sherpa/astro/io/tests/test_io_pha.py
@@ -1504,7 +1504,7 @@ def test_write_pha_with_bad_quality(tmp_path):
counts = chans * 2
group = [1, -1, -1, 1, -1, 1, 1, 1, -1]
quality = [0, 5, 0, 0, 0, 0, 0, 2, 2]
- qfilt = [True, False] + [True] * 5 + [False] * 2
+ qfilt = np.asarray([True, False] + [True] * 5 + [False] * 2)
pha0 = DataPHA("qual", chans, counts, grouping=group,
quality=quality)
diff --git a/sherpa/astro/tests/test_astro_data.py b/sherpa/astro/tests/test_astro_data.py
index b4ab684ce5..9ca381763c 100644
--- a/sherpa/astro/tests/test_astro_data.py
+++ b/sherpa/astro/tests/test_astro_data.py
@@ -2367,7 +2367,7 @@ def test_pha_check_limit(ignore, lo, hi, evals):
pha.units = 'energy'
assert pha.mask is True
- assert pha.get_mask() == pytest.approx([True] * 10)
+ assert pha.get_mask() == pytest.approx(np.ones(10, dtype=bool))
func = pha.ignore if ignore else pha.notice
func(lo, hi)
@@ -2380,7 +2380,7 @@ def test_pha_check_limit(ignore, lo, hi, evals):
vin = True
c1, c2, c3 = evals
- expected = [vout] * c1 + [vin] * c2 + [vout] * c3
+ expected = np.asarray([vout] * c1 + [vin] * c2 + [vout] * c3)
assert pha.mask == pytest.approx(pha.get_mask())
assert pha.mask == pytest.approx(expected)
@@ -2449,7 +2449,7 @@ def test_pha_check_limit_channel(ignore, lo, hi, evals):
pha.units = 'channel'
assert pha.mask is True
- assert pha.get_mask() == pytest.approx([True] * 10)
+ assert pha.get_mask() == pytest.approx(np.ones(10, dtype=bool))
func = pha.ignore if ignore else pha.notice
func(lo, hi)
@@ -2462,7 +2462,7 @@ def test_pha_check_limit_channel(ignore, lo, hi, evals):
vin = True
c1, c2, c3 = evals
- expected = [vout] * c1 + [vin] * c2 + [vout] * c3
+ expected = np.asarray([vout] * c1 + [vin] * c2 + [vout] * c3)
assert pha.mask == pytest.approx(pha.get_mask())
assert pha.mask == pytest.approx(expected)
@@ -2672,7 +2672,9 @@ def test_is_mask_reset_pha(caplog):
# Pick a value somewhere within the independent axis
assert data.mask is True
data.ignore(None, 2)
- assert data.mask == pytest.approx([False, False, True])
+
+ mask = np.asarray([False, False, True])
+ assert data.mask == pytest.approx(mask)
# Change the independent axis, but to something of the same
# length.
@@ -2683,7 +2685,7 @@ def test_is_mask_reset_pha(caplog):
assert len(caplog.records) == 0
# The mask has *not* been cleared
- assert data.mask == pytest.approx([False, False, True])
+ assert data.mask == pytest.approx(mask)
def test_is_mask_reset_pha_channel(caplog):
@@ -2703,7 +2705,8 @@ def test_is_mask_reset_pha_channel(caplog):
assert len(caplog.records) == 0
# The mask has not been cleared
- assert data.mask == pytest.approx([False, False, True])
+ mask = np.asarray([False, False, True])
+ assert data.mask == pytest.approx(mask)
@requires_region
@@ -3376,9 +3379,11 @@ def test_pha_notice_bkg_id_none():
pha.notice(lo=2, bkg_id=None) # the default
- assert pha.mask == pytest.approx([False, True])
- assert b1.mask == pytest.approx([False, True])
- assert bup.mask == pytest.approx([False, True])
+ bfilt = np.asarray([False, True])
+
+ assert pha.mask == pytest.approx(bfilt)
+ assert b1.mask == pytest.approx(bfilt)
+ assert bup.mask == pytest.approx(bfilt)
@pytest.mark.parametrize("bkg_id", [1, "up"])
@@ -3394,13 +3399,15 @@ def test_pha_notice_bkg_id_scalar(bkg_id):
pha.notice(lo=2, bkg_id=bkg_id)
+ bfilt = np.asarray([False, True])
+
assert pha.mask is True
if bkg_id == 1:
- assert b1.mask == pytest.approx([False, True])
+ assert b1.mask == pytest.approx(bfilt)
assert bup.mask is True
else:
assert b1.mask is True
- assert bup.mask == pytest.approx([False, True])
+ assert bup.mask == pytest.approx(bfilt)
def test_pha_notice_bkg_id_array_all():
@@ -3415,9 +3422,11 @@ def test_pha_notice_bkg_id_array_all():
pha.notice(lo=2, bkg_id=["up", 1])
+ bfilt = np.asarray([False, True])
+
assert pha.mask is True
- assert b1.mask == pytest.approx([False, True])
- assert bup.mask == pytest.approx([False, True])
+ assert b1.mask == pytest.approx(bfilt)
+ assert bup.mask == pytest.approx(bfilt)
@pytest.mark.parametrize("bkg_id", [1, "up"])
@@ -3433,13 +3442,15 @@ def test_pha_notice_bkg_id_array_subset(bkg_id):
pha.notice(lo=2, bkg_id=[bkg_id])
+ bfilt = np.asarray([False, True])
+
assert pha.mask is True
if bkg_id == 1:
- assert b1.mask == pytest.approx([False, True])
+ assert b1.mask == pytest.approx(bfilt)
assert bup.mask is True
else:
assert b1.mask is True
- assert bup.mask == pytest.approx([False, True])
+ assert bup.mask == pytest.approx(bfilt)
def get_img_spatial_mask():
diff --git a/sherpa/astro/tests/test_astro_data2.py b/sherpa/astro/tests/test_astro_data2.py
index b5eaf3b598..d6bdb19e49 100644
--- a/sherpa/astro/tests/test_astro_data2.py
+++ b/sherpa/astro/tests/test_astro_data2.py
@@ -97,7 +97,7 @@ def test_get_mask_is_none():
"""
pha = DataPHA('name', [1, 2, 3], [1, 1, 1])
assert pha.mask is True
- assert pha.get_mask() == pytest.approx([True] * 3)
+ assert pha.get_mask() == pytest.approx(np.asarray([True] * 3))
def test_get_mask_is_none_when_all_filtered():
@@ -497,7 +497,7 @@ def test_288_a():
# with bools the use of approx is okay (it can tell the
# difference between 0 and 1, aka False and True).
#
- assert pha.mask == pytest.approx([True, False, True])
+ assert pha.mask == pytest.approx(np.asarray([True, False, True]))
def test_288_a_energy():
@@ -525,7 +525,7 @@ def test_288_a_energy():
# with bools the use of approx is okay (it can tell the
# difference between 0 and 1, aka False and True).
#
- assert pha.mask == pytest.approx([True, False, True])
+ assert pha.mask == pytest.approx(np.asarray([True, False, True]))
def test_288_b():
@@ -565,7 +565,7 @@ def test_288_b_energy():
assert pha.mask is True
pha.ignore(3.1, 4)
- assert pha.mask == pytest.approx([True, False, True])
+ assert pha.mask == pytest.approx(np.asarray([True, False, True]))
@requires_group
@@ -621,8 +621,8 @@ def test_416_a():
# grouped)
# - pha.get_mask() always returns the ungrouped mask
#
- mask_ungrouped = [False] * 3 + [True] * 3 + [False] * 4
- mask_grouped = [False] * 3 + [True] * 2 + [False] * 4
+ mask_ungrouped = np.asarray([False] * 3 + [True] * 3 + [False] * 4)
+ mask_grouped = np.asarray([False] * 3 + [True] * 2 + [False] * 4)
assert pha.mask == pytest.approx(mask_ungrouped)
assert pha.get_mask() == pytest.approx(mask_ungrouped)
@@ -685,7 +685,7 @@ def test_416_c():
pha.notice(4.5, 6.5)
# this should be ~pha.mask
- tabstops = [True] * 3 + [False] * 3 + [True] * 4
+ tabstops = np.asarray([True] * 3 + [False] * 3 + [True] * 4)
assert ~pha.mask == pytest.approx(tabstops)
assert pha.grouping is None
@@ -1688,10 +1688,13 @@ def test_pha_quality_all_bad_basic_checks():
"""
+ all4 = np.ones(4, dtype=bool)
+ none4 = np.zeros(4, dtype=bool)
+
pha = DataPHA("q", [1, 2, 3, 4], [9, 0, 1, 64])
fvals = [12, 2, 7, 8]
assert pha.mask is True
- assert pha.get_mask() == pytest.approx([True] * 4)
+ assert pha.get_mask() == pytest.approx(all4)
assert pha.get_filter() == "1:4"
assert pha.get_x() == pytest.approx([1, 2, 3, 4])
assert pha.apply_filter(fvals) == pytest.approx(fvals)
@@ -1699,15 +1702,15 @@ def test_pha_quality_all_bad_basic_checks():
pha.quality = [2, 2, 2, 5]
assert pha.mask is True
- assert pha.get_mask() == pytest.approx([True] * 4)
+ assert pha.get_mask() == pytest.approx(all4)
assert pha.get_filter() == "1:4"
assert pha.get_x() == pytest.approx([1, 2, 3, 4])
assert pha.apply_filter(fvals) == pytest.approx(fvals)
assert pha.apply_grouping(fvals) == pytest.approx(fvals)
pha.ignore_bad()
- assert pha.mask == pytest.approx([False] * 4)
- assert pha.get_mask() == pytest.approx([False] * 4)
+ assert pha.mask == pytest.approx(none4)
+ assert pha.get_mask() == pytest.approx(none4)
assert pha.get_filter() == ""
assert pha.get_x() == pytest.approx([1, 2, 3, 4])
assert pha.apply_filter(fvals) == pytest.approx([])
@@ -1742,7 +1745,7 @@ def test_pha_quality_change_mask(make_quality_pha):
pha.ignore_bad()
assert pha.mask is True
pha.mask = [1, 1, 0]
- assert pha.mask == pytest.approx([True, True, False])
+ assert pha.mask == pytest.approx(np.asarray([True, True, False]))
def test_pha_quality_change_mask_ungrouped(make_quality_pha):
@@ -1753,7 +1756,8 @@ def test_pha_quality_change_mask_ungrouped(make_quality_pha):
pha.ungroup()
assert pha.mask is True
pha.mask = [1, 1, 0, 1, 1, 0, 0, 1, 1]
- assert pha.mask == pytest.approx([True, True, False, True, True, False, False, True, True])
+ mask = np.asarray([True, True, False, True, True, False, False, True, True])
+ assert pha.mask == pytest.approx(mask)
def test_pha_quality_change_mask_fullsize(make_quality_pha):
@@ -1972,23 +1976,26 @@ def test_pha_quality_ignore_bad_clear_filter(make_quality_pha):
pha = make_quality_pha
+ mask0 = np.ones(9, dtype=bool)
assert pha.get_filter() == "1:9"
assert pha.mask is True
- assert pha.get_mask() == pytest.approx([True] * 9)
+ assert pha.get_mask() == pytest.approx(mask0)
assert pha.quality_filter is None
# channels 2,3 and 7-9 are "bad"
pha.ignore(hi=3)
+ mask = np.asarray([False] + [True] * 3)
+ mask_full = np.asarray([False] * 4 + [True] * 5)
assert pha.get_filter() == "5:9"
- assert pha.mask == pytest.approx([False] + [True] * 3)
- assert pha.get_mask() == pytest.approx([False] * 4 + [True] * 5)
+ assert pha.mask == pytest.approx(mask)
+ assert pha.get_mask() == pytest.approx(mask_full)
assert pha.quality_filter is None
# This resets the previous filters
pha.ignore_bad()
- qflags = [True] * 1 + [False] * 2 + [True] * 3 + [False] * 3
+ qflags = np.asarray([True] * 1 + [False] * 2 + [True] * 3 + [False] * 3)
assert pha.get_filter() == "1:9"
assert pha.mask is True
assert pha.get_mask() == pytest.approx(qflags)
@@ -1996,16 +2003,19 @@ def test_pha_quality_ignore_bad_clear_filter(make_quality_pha):
pha.ignore(hi=3)
+ mask2 = np.asarray([False] + [True] * 2)
+ mask2_full = np.asarray([False] * 2 + [True] * 2)
+
assert pha.get_filter() == "5:6"
- assert pha.mask == pytest.approx([False] + [True] * 2)
- assert pha.get_mask() == pytest.approx([False] * 2 + [True] * 2)
+ assert pha.mask == pytest.approx(mask2)
+ assert pha.get_mask() == pytest.approx(mask2_full)
assert pha.quality_filter == pytest.approx(qflags)
pha.ignore(lo=2, hi=4)
assert pha.get_filter() == "5:6"
- assert pha.mask == pytest.approx([False] + [True] * 2)
- assert pha.get_mask() == pytest.approx([False] * 2 + [True] * 2)
+ assert pha.mask == pytest.approx(mask2)
+ assert pha.get_mask() == pytest.approx(mask2_full)
assert pha.quality_filter == pytest.approx(qflags)
# This removes the quality filter!
@@ -2013,7 +2023,7 @@ def test_pha_quality_ignore_bad_clear_filter(make_quality_pha):
assert pha.get_filter() == "1:9"
assert pha.mask is True
- assert pha.get_mask() == pytest.approx([True] * 9)
+ assert pha.get_mask() == pytest.approx(mask0)
assert pha.quality_filter is None
@@ -2443,7 +2453,8 @@ def test_pha_change_quality_values(caplog):
pha.ignore_bad()
assert len(caplog.records) == 0
- assert pha.quality_filter == pytest.approx([True] * 5 + [False] * 2)
+ qfilt = np.asarray([True] * 5 + [False] * 2)
+ assert pha.quality_filter == pytest.approx(qfilt)
assert pha.get_dep(filter=True) == pytest.approx([6])
assert pha.get_filter() == '1:7'
@@ -2456,7 +2467,7 @@ def test_pha_change_quality_values(caplog):
assert pha.quality == pytest.approx([0, 0, 0, 2, 2, 0, 0])
# Should quality filter be reset?
- assert pha.quality_filter == pytest.approx([True] * 5 + [False] * 2)
+ assert pha.quality_filter == pytest.approx(qfilt)
assert pha.get_dep(filter=True) == pytest.approx([4, 2])
assert pha.get_filter() == '1:7'
@@ -2499,14 +2510,14 @@ def test_pha_group_ignore_bad_then_filter(caplog):
assert len(caplog.records) == 0
assert pha.mask is True
- assert pha.get_mask() == pytest.approx([True] * 7)
+ assert pha.get_mask() == pytest.approx(np.ones(7, dtype=bool))
assert pha.get_filter() == '1:7'
assert pha.quality_filter is None
pha.ignore_bad()
assert len(caplog.records) == 0
- qual_mask = [True] * 2 + [False] + [True] * 3 + [False]
+ qual_mask = np.asarray([True] * 2 + [False] + [True] * 3 + [False])
assert pha.mask is True
assert pha.get_mask() == pytest.approx(qual_mask)
assert pha.get_filter() == '1:7'
@@ -2518,8 +2529,10 @@ def test_pha_group_ignore_bad_then_filter(caplog):
pha.ignore(4, 5)
assert len(caplog.records) == 0
- assert pha.mask == pytest.approx([True, False, True])
- assert pha.get_mask() == pytest.approx([True] * 2 + [False] * 2 + [True])
+ mask = np.asarray([True, False, True])
+ mask_full = np.asarray([True] * 2 + [False] * 2 + [True])
+ assert pha.mask == pytest.approx(mask)
+ assert pha.get_mask() == pytest.approx(mask_full)
assert pha.get_filter() == '1:2,6'
assert pha.quality_filter == pytest.approx(qual_mask)
assert pha.quality == pytest.approx([0, 0, 2, 0, 0, 0, 2])
@@ -2536,7 +2549,7 @@ def test_pha_group_ignore_bad_then_group(caplog):
pha.ignore_bad()
assert len(caplog.records) == 0
- qual_mask = [True] * 2 + [False] + [True] * 3 + [False]
+ qual_mask = np.asarray([True] * 2 + [False] + [True] * 3 + [False])
assert pha.mask is True
assert pha.get_mask() == pytest.approx(qual_mask)
assert pha.quality_filter == pytest.approx(qual_mask)
@@ -2562,7 +2575,7 @@ def test_pha_group_ignore_bad_then_group(caplog):
pha.ignore_bad()
assert len(caplog.records) == 0
- qual_mask = [True] + [False] + [True] * 5
+ qual_mask = np.asarray([True] + [False] + [True] * 5)
assert pha.mask is True
assert pha.get_mask() == pytest.approx(qual_mask)
assert pha.get_filter() == '1:7'
@@ -2584,7 +2597,7 @@ def test_pha_filter_ignore_bad_filter(caplog):
pha.ignore(lo=4, hi=4)
assert len(caplog.records) == 0
- data_mask = [True] * 3 + [False] + [True] * 3
+ data_mask = np.asarray([True] * 3 + [False] + [True] * 3)
assert pha.mask == pytest.approx(data_mask)
assert pha.get_mask() == pytest.approx(data_mask)
assert pha.get_filter() == '1:3,5:7'
@@ -2596,7 +2609,8 @@ def test_pha_filter_ignore_bad_filter(caplog):
pha.group_counts(5)
assert len(caplog.records) == 0
- assert pha.mask == pytest.approx([True] * 2 + [False] + [True] * 3)
+ data_mask2 = np.asarray([True] * 2 + [False] + [True] * 3)
+ assert pha.mask == pytest.approx(data_mask2)
assert pha.get_mask() == pytest.approx(data_mask)
assert pha.get_filter() == '1:3,5:7'
assert pha.quality_filter is None
@@ -2612,7 +2626,7 @@ def test_pha_filter_ignore_bad_filter(caplog):
assert r.levelname == "WARNING"
assert r.getMessage() == "filtering grouped data with quality flags, previous filters deleted"
- new_mask = [True] * 2 + [False] + [True] * 4
+ new_mask = np.asarray([True] * 2 + [False] + [True] * 4)
assert pha.mask is True
assert pha.get_mask() == pytest.approx(new_mask)
assert pha.get_filter() == '1:7'
@@ -2624,8 +2638,10 @@ def test_pha_filter_ignore_bad_filter(caplog):
pha.ignore(lo=2, hi=2)
assert len(caplog.records) == 1
- assert pha.mask == pytest.approx([False] + [True] * 4)
- assert pha.get_mask() == pytest.approx([False] * 2 + [True] * 4)
+ mask3 = np.asarray([False] + [True] * 4)
+ mask3_full = np.asarray([False] * 2 + [True] * 4)
+ assert pha.mask == pytest.approx(mask3)
+ assert pha.get_mask() == pytest.approx(mask3_full)
assert pha.get_filter() == '4:7'
assert pha.quality_filter == pytest.approx(new_mask)
assert pha.quality == pytest.approx([0, 0, 2, 0, 0, 0, 0])
@@ -2732,7 +2748,7 @@ def test_pha_ignore_bad_group_quality(caplog):
assert pha.get_filter(format="%.1f") == "3.0:7.0"
assert pha.get_noticed_channels() == pytest.approx(np.arange(3, 7))
- omask = [False] * 2 + [True] * 4 + [False] * 4
+ omask = np.asarray([False] * 2 + [True] * 4 + [False] * 4)
assert pha.mask == pytest.approx(omask)
assert pha.get_mask() == pytest.approx(omask)
@@ -2749,7 +2765,8 @@ def test_pha_ignore_bad_group_quality(caplog):
assert pha.get_dep(filter=False) == pytest.approx(y)
assert pha.get_dep(filter=True) == pytest.approx([3, 1])
- assert pha.mask == pytest.approx([False] * 2 + [True] * 2 + [False] * 4)
+ mask = np.asarray([False] * 2 + [True] * 2 + [False] * 4)
+ assert pha.mask == pytest.approx(mask)
assert pha.get_mask() == pytest.approx(omask)
grouping = [0, 0, 1, -1, -1, 1, 0, 0, 0, 0]
@@ -2788,7 +2805,7 @@ def test_pha_ignore_bad_group_quality(caplog):
# However, get_mask reflects the quality filter, so is all True
# except for the 6th element.
#
- single_bad = [True] * 5 + [False] + [True] * 4
+ single_bad = np.asarray([True] * 5 + [False] + [True] * 4)
assert pha.get_mask() == pytest.approx(single_bad)
# What about the quality fields?
@@ -2862,7 +2879,7 @@ def test_pha_ignore_bad_quality(groupit, caplog):
assert pha.get_dep(filter=False) == pytest.approx(y)
assert pha.get_dep(filter=True) == pytest.approx(y[2:6])
- mask = [False] * 2 + [True] * 4 + [False] * 4
+ mask = np.asarray([False] * 2 + [True] * 4 + [False] * 4)
assert pha.mask == pytest.approx(mask)
assert pha.get_mask() == pytest.approx(mask)
@@ -2900,7 +2917,7 @@ def test_pha_ignore_bad_quality(groupit, caplog):
# The mask changed (the channel=6 value is now filtered out).
#
- mask2 = [False] * 2 + [True] * 3 + [False] * 5
+ mask2 = np.asarray([False] * 2 + [True] * 3 + [False] * 5)
assert pha.mask == pytest.approx(mask2)
assert pha.get_mask() == pytest.approx(mask2)
@@ -3098,7 +3115,7 @@ def test_grouped_pha_mask(make_grouped_pha):
def test_grouped_pha_get_mask(make_grouped_pha):
"""What is the default get_mask value?"""
pha = make_grouped_pha
- assert pha.get_mask() == pytest.approx([True] * 4 + [False])
+ assert pha.get_mask() == pytest.approx(np.asarray([True] * 4 + [False]))
def test_quality_pha_mask(make_quality_pha):
@@ -3115,11 +3132,13 @@ def test_quality_pha_mask(make_quality_pha):
def test_quality_pha_get_mask(make_quality_pha):
"""What is the default get_mask value?"""
pha = make_quality_pha
- assert pha.get_mask() == pytest.approx([True] * 9)
+ m1 = np.ones(9, dtype=bool)
+ assert pha.get_mask() == pytest.approx(m1)
pha.ignore_bad()
# This is a regression test
- assert pha.get_mask() == pytest.approx([True] + [False] * 2 + [True] * 3 + [False] * 3)
+ m2 = np.asarray([True] + [False] * 2 + [True] * 3 + [False] * 3)
+ assert pha.get_mask() == pytest.approx(m2)
@pytest.mark.parametrize("field,expected",
@@ -3576,8 +3595,10 @@ def test_pha_quality_filtered_apply_filter_invalid_size(vals, make_grouped_pha):
pha.ignore(hi=1)
# safety check to make sure we've excluded points
- assert pha.mask == pytest.approx([False, True])
- assert pha.get_mask() == pytest.approx([False, False, False, True])
+ m1 = np.asarray([False, True])
+ m2 = np.asarray([False, False, False, True])
+ assert pha.mask == pytest.approx(m1)
+ assert pha.get_mask() == pytest.approx(m2)
with pytest.raises(DataErr,
match="^size mismatch between filtered data and array: 1 vs [28]$"):
@@ -4193,7 +4214,7 @@ def test_rmf_simple_filter_check(startchan, na, nb, nc):
assert rmf.apply_rmf(mvals) == pytest.approx(mvals)
selected = rmf.notice([startchan, startchan + 1, startchan + 2])
- expected = [False] * na + [True] * nb + [False] * nc
+ expected = np.asarray([False] * na + [True] * nb + [False] * nc)
assert selected == pytest.approx(expected)
# Drop everything but the selected values.
@@ -4295,7 +4316,7 @@ def test_rmf_offset_check_square(offset, caplog):
nchans = [offset + 2]
selected = rmf.notice(nchans)
- assert selected == pytest.approx([False, True, True, True])
+ assert selected == pytest.approx(np.asarray([False, True, True, True]))
expected2 = [0.0 * 0.2 + 0.6 * 0.4,
0.4 * 0.4 + 0.5 * 0.2,
@@ -4387,11 +4408,13 @@ def test_rmf_offset_check_rectangular(offset):
# - drop the last channel
nchans2 = offset + np.arange(0, 9)
+ mask = np.asarray([True] * 19 + [False])
+
selected2 = rmf.notice(nchans2)
- assert selected2 == pytest.approx([True] * 19 + [False])
+ assert selected2 == pytest.approx(mask)
selected2 = rmf.notice(offset + np.arange(0, 9))
- assert selected2 == pytest.approx([True] * 19 + [False])
+ assert selected2 == pytest.approx(mask)
expected2 = mvals[selected2] @ full_matrix[selected2, :]
got2 = rmf.apply_rmf(mvals[selected2])
@@ -4414,8 +4437,11 @@ def test_rmf_offset_check_rectangular(offset):
#
nchans3 = offset + np.asarray([4, 5, 6])
+ mask3 = np.asarray([True, False] * 2 + [True] * 10 +
+ [False] * 4 + [True, False])
+
selected3 = rmf.notice(nchans3)
- assert selected3 == pytest.approx([True, False] * 2 + [True] * 10 + [False] * 4 + [True, False])
+ assert selected3 == pytest.approx(mask3)
# It is not clear what the RMF application does here.
#
@@ -5970,7 +5996,7 @@ def test_group_xxx_tabtops_not_ndarray(asarray):
assert pha.get_y() == pytest.approx([2, 3, 4.5, 6])
assert pha.mask is True
- assert pha.get_mask() == pytest.approx([True] * 5)
+ assert pha.get_mask() == pytest.approx(np.ones(5, dtype=bool))
@requires_group
@@ -6002,7 +6028,8 @@ def test_group_xxx_tabstops_already_grouped():
assert pha.get_y(filter=True) == pytest.approx([12, 5.5, 4])
tstops = ~pha.mask
- assert tstops == pytest.approx([False, True, False, False, True])
+ mask = np.asarray([False, True, False, False, True])
+ assert tstops == pytest.approx(mask)
# Apply the mask as the tabStops (after inversion) where
# len(tstops) < nchannel but does match the number of groups.
diff --git a/sherpa/astro/tests/test_astro_instrument.py b/sherpa/astro/tests/test_astro_instrument.py
index b466e3fe5a..584fe371c6 100644
--- a/sherpa/astro/tests/test_astro_instrument.py
+++ b/sherpa/astro/tests/test_astro_instrument.py
@@ -712,7 +712,8 @@ def test_rmfmodelpha_delta_no_ebounds(analysis, caplog):
assert len(caplog.records) == 0
if analysis == "energy":
- assert pha.mask == pytest.approx([False, True, True, True, False])
+ expected = np.asarray([False, True, True, True, False])
+ assert pha.mask == pytest.approx(expected)
else:
assert not pha.mask.any()
diff --git a/sherpa/astro/tests/test_astro_plot.py b/sherpa/astro/tests/test_astro_plot.py
index 3f978728dc..a7df4cb1ee 100644
--- a/sherpa/astro/tests/test_astro_plot.py
+++ b/sherpa/astro/tests/test_astro_plot.py
@@ -227,8 +227,8 @@ def test_sourceplot_filtered(caplog, make_basic_datapha):
# The filtering should probably be this, but let's test the
# current behavior:
#
- # expected = [False] * 2 + [True] * 6 + [False] * 2
- expected = [False] * 3 + [True] * 5 + [False] * 2
+ # expected = np.asarray([False] * 2 + [True] * 6 + [False] * 2)
+ expected = np.asarray([False] * 3 + [True] * 5 + [False] * 2)
assert sp.mask == pytest.approx(expected)
assert len(caplog.records) == 0
check_sourceplot_energy(sp)
@@ -365,7 +365,7 @@ def test_sourceplot_wavelength_filtered(caplog, make_basic_datapha):
# Given the filtering for energy didn't quite match, DJB is
# slightly surprised this works.
#
- expected = [False] * 2 + [True] * 6 + [False] * 2
+ expected = np.asarray([False] * 2 + [True] * 6 + [False] * 2)
assert sp.mask == pytest.approx(expected)
assert len(caplog.records) == 0
check_sourceplot_wavelength(sp)
diff --git a/sherpa/astro/ui/tests/test_astro_ui.py b/sherpa/astro/ui/tests/test_astro_ui.py
index 26acfb96b0..f6872a3497 100644
--- a/sherpa/astro/ui/tests/test_astro_ui.py
+++ b/sherpa/astro/ui/tests/test_astro_ui.py
@@ -1962,7 +1962,8 @@ def check_pha_offset(specresp, matrix, energ_lo, energ_hi,
ui.notice(0.5, 0.8)
data = ui.get_data()
- assert data.mask == pytest.approx([False] * 3 + [True] * 3 + [False] * 3)
+ expected = np.asarray([False] * 3 + [True] * 3 + [False] * 3)
+ assert data.mask == pytest.approx(expected)
assert ui.get_filter(format="%.2f", delim="-") == "0.45-0.85"
diff --git a/sherpa/astro/ui/tests/test_astro_ui_unit.py b/sherpa/astro/ui/tests/test_astro_ui_unit.py
index 5a321fa733..a5c23dca45 100644
--- a/sherpa/astro/ui/tests/test_astro_ui_unit.py
+++ b/sherpa/astro/ui/tests/test_astro_ui_unit.py
@@ -2957,7 +2957,7 @@ def test_pha_set_filter_unmasked(simple_pha):
expected = [True, True, False, True, False]
ui.set_filter(expected)
- assert data.mask == pytest.approx(expected)
+ assert data.mask == pytest.approx(np.asarray(expected))
def test_pha_set_filter_unmasked_wrong(simple_pha):
@@ -2973,11 +2973,14 @@ def test_pha_set_filter_masked(simple_pha):
data = ui.get_data()
+ mask = np.asarray([True, False, False, False, True])
+ mask2 = np.asarray([True, False, True, False, True])
+
ui.ignore(4, 8)
- assert data.mask == pytest.approx([True, False, False, False, True])
+ assert data.mask == pytest.approx(mask)
ui.set_filter(np.asarray([True, False, True, False, False]))
- assert data.mask == pytest.approx([True, False, True, False, True])
+ assert data.mask == pytest.approx(mask2)
def test_pha_set_filter_masked_wrong(simple_pha):
diff --git a/sherpa/astro/ui/tests/test_filtering.py b/sherpa/astro/ui/tests/test_filtering.py
index 6e7c331456..eeb41cad3f 100644
--- a/sherpa/astro/ui/tests/test_filtering.py
+++ b/sherpa/astro/ui/tests/test_filtering.py
@@ -709,7 +709,7 @@ def test_ignore_bad_simple_comparison(caplog):
d = s.get_data(idval)
assert d.mask is True
- assert d.get_mask() == pytest.approx([True] * 5)
+ assert d.get_mask() == pytest.approx(np.ones(5, dtype=bool))
assert len(caplog.records) == 2
s.ignore_bad(1)
@@ -733,7 +733,7 @@ def test_ignore_bad_simple_comparison(caplog):
assert s.get_filter(1) == "1,3:5"
assert s.get_filter(2) == "1:5"
- mask = [True] + [False] + [True] * 3
+ mask = np.asarray([True] + [False] + [True] * 3)
d1 = s.get_data(1)
assert d1.mask == pytest.approx(mask)
assert d1.get_mask() == pytest.approx(mask)
@@ -762,12 +762,12 @@ def test_ignore_bad_simple_comparison(caplog):
assert s.get_filter(1) == "1,3"
assert s.get_filter(2) == "1:3"
- mask = [True] + [False] + [True] + [False] * 2
+ mask = np.asarray([True] + [False] + [True] + [False] * 2)
d1 = s.get_data(1)
assert d1.mask == pytest.approx(mask)
assert d1.get_mask() == pytest.approx(mask)
- mask = [True] * 2 + [False] * 2
+ mask = np.asarray([True] * 2 + [False] * 2)
d2 = s.get_data(2)
assert d2.mask == pytest.approx(mask)
assert d2.get_mask() == pytest.approx(mask)
diff --git a/sherpa/astro/utils/tests/test_astro_utils_unit.py b/sherpa/astro/utils/tests/test_astro_utils_unit.py
index 27551d5d22..de8b5e4bf5 100644
--- a/sherpa/astro/utils/tests/test_astro_utils_unit.py
+++ b/sherpa/astro/utils/tests/test_astro_utils_unit.py
@@ -194,7 +194,7 @@ def test_filter_resp_basics(offset, selected, ng, fch, nch, mat, msk):
assert f_chan2 == pytest.approx(np.asarray(fch) + delta)
assert n_chan2 == pytest.approx(nch)
assert matrix2 == pytest.approx(mat)
- assert mask2 == pytest.approx(msk)
+ assert mask2 == pytest.approx(np.asarray(msk))
@pytest.mark.parametrize("lo, hi, expected",
@@ -414,7 +414,8 @@ def test_qual_setting():
"""Regression test."""
pha = make_data("qual")
- assert pha.quality_filter == pytest.approx([True, True, False, True])
+ expected = np.asarray([True, True, False, True])
+ assert pha.quality_filter == pytest.approx(expected)
@pytest.mark.parametrize("data_class", ["1d", "1dint", "pha", "grp", "qual"])
@@ -869,4 +870,5 @@ def test_expand_grouped_mask_ingalid_group():
def test_expand_grouped_mask(mask, group, expected):
"""Check how test_expand_grouped_mask works."""
- assert expand_grouped_mask(mask, group) == pytest.approx(expected)
+ evals = np.asarray(expected)
+ assert expand_grouped_mask(mask, group) == pytest.approx(evals)
diff --git a/sherpa/tests/test_data.py b/sherpa/tests/test_data.py
index f7a41ebf79..e6744aeb8d 100644
--- a/sherpa/tests/test_data.py
+++ b/sherpa/tests/test_data.py
@@ -1321,7 +1321,7 @@ def test_data_filter_invalid_size_scalar():
x = numpy.asarray([1, 2, 5])
d = Data1D('x', x, x)
d.ignore(None, 2)
- assert d.mask == pytest.approx([False, False, True])
+ assert d.mask == pytest.approx(numpy.asarray([False, False, True]))
with pytest.raises(DataErr,
match="Array must be a sequence or None"):
@@ -1567,7 +1567,7 @@ def test_data1dint_check_limit(ignore, lo, hi, evals):
c1, c2, c3 = evals
expected = [vout] * c1 + [vin] * c2 + [vout] * c3
- assert d.mask == pytest.approx(expected)
+ assert d.mask == pytest.approx(numpy.asarray(expected))
def test_filter_apply_none():
@@ -1993,7 +1993,7 @@ def test_mask_sent_array_non_bool():
expected = [True, False, True, False, True, True, False, True, False, True]
data.mask = mask
- assert data.mask == pytest.approx(expected)
+ assert data.mask == pytest.approx(numpy.asarray(expected))
@pytest.mark.parametrize("data", ALL_DATA_CLASSES, indirect=True)
diff --git a/sherpa/ui/tests/test_session.py b/sherpa/ui/tests/test_session.py
index 4b352c203b..5723f4a655 100644
--- a/sherpa/ui/tests/test_session.py
+++ b/sherpa/ui/tests/test_session.py
@@ -1408,7 +1408,8 @@ def test_load_filter_simple(idval, tmp_path):
else:
s.load_filter(idval, str(infile), ncols=1, ignore=True)
- assert s.get_data().mask == pytest.approx([True, True, False])
+ expected = np.asarray([True, True, False])
+ assert s.get_data().mask == pytest.approx(expected)
@pytest.mark.parametrize("idval", [None, 1])
diff --git a/sherpa/ui/tests/test_ui_unit.py b/sherpa/ui/tests/test_ui_unit.py
index 99cc4e21b5..14f15a78e0 100644
--- a/sherpa/ui/tests/test_ui_unit.py
+++ b/sherpa/ui/tests/test_ui_unit.py
@@ -1209,7 +1209,7 @@ def test_set_filter_unmasked(ignore, clean_ui):
ui.load_arrays(1, x, y)
data = ui.get_data()
- assert data.mask
+ assert data.mask is True
if ignore:
expected = [False, True, False]
@@ -1217,7 +1217,7 @@ def test_set_filter_unmasked(ignore, clean_ui):
expected = [True, False, True]
ui.set_filter(np.asarray([True, False, True]), ignore=ignore)
- assert data.mask == pytest.approx(expected)
+ assert data.mask == pytest.approx(np.asarray(expected))
def test_set_filter_unmasked_wrong(clean_ui):
@@ -1245,7 +1245,9 @@ def test_set_filter_masked(ignore, clean_ui):
ui.ignore(lo=15, hi=45)
data = ui.get_data()
- assert data.mask == pytest.approx([True, False, False, False, True])
+
+ orig = np.asarray([True, False, False, False, True])
+ assert data.mask == pytest.approx(orig)
# Unlike test_set_filter_masked the two expected values are not
# logical inverses, since we need to consider the existing mask.
@@ -1256,7 +1258,7 @@ def test_set_filter_masked(ignore, clean_ui):
expected = [True, False, True, False, True]
ui.set_filter(np.asarray([True, False, True, False, False]), ignore=ignore)
- assert data.mask == pytest.approx(expected)
+ assert data.mask == pytest.approx(np.asarray(expected))
def test_set_filter_masked_wrong(clean_ui):
diff --git a/sherpa/utils/tests/test_utils.py b/sherpa/utils/tests/test_utils.py
index a11338d8b8..60e56f82ba 100644
--- a/sherpa/utils/tests/test_utils.py
+++ b/sherpa/utils/tests/test_utils.py
@@ -1,5 +1,5 @@
#
-# Copyright (C) 2010, 2016, 2018, 2019, 2020, 2021, 2022, 2023
+# Copyright (C) 2010, 2016, 2018 - 2024
# Smithsonian Astrophysical Observatory
#
#
@@ -374,9 +374,11 @@ def test_filter_bins_one(lo, hi, res):
lo>hi.
"""
+ expected = numpy.asarray(res)
+
dvals = numpy.asarray([1, 2, 3, 4, 5])
flags = utils.filter_bins([lo], [hi], [dvals])
- assert flags == pytest.approx(res)
+ assert flags == pytest.approx(expected)
# We can also check an identity: that
# a <= x <= b
@@ -385,7 +387,7 @@ def test_filter_bins_one(lo, hi, res):
# x <= b
#
flags = utils.filter_bins([lo, None], [None, hi], [dvals, dvals])
- assert flags == pytest.approx(res)
+ assert flags == pytest.approx(expected)
@@ -418,7 +420,7 @@ def test_filter_bins_one_int(lo, hi, res):
hivals = lovals + 1
flags = utils.filter_bins([None, lo], [hi, None], [lovals, hivals],
integrated=True)
- assert flags == pytest.approx(res)
+ assert flags == pytest.approx(numpy.asarray(res))
From af47af723c4fb054f037555e9c5fd219871c9695 Mon Sep 17 00:00:00 2001
From: Douglas Burke <dburke.gw@gmail.com>
Date: Fri, 6 Dec 2024 12:58:17 -0500
Subject: [PATCH 2/2] CI: use macos-13 for the macOS Intel run
This also
- bumps up the python version from 3.10 to 3.11
- adds bokeh to the mac test (as it's supposed to be a
"gull build")
- adds "Intel" to the name of the test, in preparation for
adding an ARM build, such as
https://github.com/sherpa/sherpa/pull/2198/
---
.github/workflows/ci-conda-workflow.yml | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/ci-conda-workflow.yml b/.github/workflows/ci-conda-workflow.yml
index 6bab3c77ae..507c06efb2 100644
--- a/.github/workflows/ci-conda-workflow.yml
+++ b/.github/workflows/ci-conda-workflow.yml
@@ -30,13 +30,14 @@ jobs:
strategy:
matrix:
include:
- - name: MacOS Full Build
- os: macos-12
- python-version: "3.10"
+ - name: MacOS Intel Full Build
+ os: macos-13
+ python-version: "3.11"
install-type: develop
fits: astropy
test-data: submodule
matplotlib-version: 3
+ bokeh-version: 3
xspec-version: 12.14.0i
- name: Linux Minimum Setup (Python 3.10)