Skip to content

Commit

Permalink
Merge pull request #356 from pllim/fix-tst-astropy-v5.3
Browse files Browse the repository at this point in the history
Compat with numpy 1.25 and doc compat with astropy v5.3
  • Loading branch information
pllim committed Jun 1, 2023
2 parents 11db7cf + 353832d commit 8887b7f
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 12 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
1.3.0 (unreleased)
==================

- Compatibility with ``numpy`` 1.25. [#356]

1.2.0 (2023-03-20)
==================

Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ integrate it::

>>> sp_rn = sp.normalize(1 * u.Jy, band=bp)
>>> sp_rn.integrate() # doctest: +FLOAT_CMP
<Quantity 12540.4613615 ph / (cm2 s)>
<Quantity 12540.4613615 ph / (s cm2)>

Create an observation by passing the redshifted and normalized source spectrum
through the box bandpass::
Expand Down
10 changes: 5 additions & 5 deletions docs/synphot/spectrum.rst
Original file line number Diff line number Diff line change
Expand Up @@ -199,16 +199,16 @@ By default, trapezoid integration is done in internal units::
>>> sp = SourceSpectrum(GaussianFlux1D, mean=6000*u.AA, fwhm=10*u.AA,
... total_flux=1*(u.erg/(u.cm**2 * u.s)))
>>> sp.integrate() # doctest: +FLOAT_CMP
<Quantity 3.02046758e+11 ph / (cm2 s)>
<Quantity 3.02046758e+11 ph / (s cm2)>
>>> with conf.set_temp('default_integrator', 'analytical'):
... print(f'{repr(sp.integrate())}') # doctest: +FLOAT_CMP
<Quantity 3.02046994e+11 ph / (cm2 s)>
<Quantity 3.02046994e+11 ph / (s cm2)>
>>> sp.integrate(integration_type='analytical') # doctest: +FLOAT_CMP
<Quantity 3.02046994e+11 ph / (cm2 s)>
<Quantity 3.02046994e+11 ph / (s cm2)>
>>> sp.integrate(flux_unit=units.FLAM) # doctest: +FLOAT_CMP
<Quantity 0.99999972 erg / (cm2 s)>
<Quantity 0.99999972 erg / (s cm2)>
>>> sp.integrate(flux_unit=units.FLAM, integration_type='analytical') # doctest: +FLOAT_CMP
<Quantity 1. erg / (cm2 s)>
<Quantity 1. erg / (s cm2)>


.. _synphot-empirical-source:
Expand Down
4 changes: 2 additions & 2 deletions docs/synphot/tutorials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ model from the
>>> extcurve = redlaw.extinction_curve(ebv, wavelengths=wav)
>>> bb = SourceSpectrum(BlackBodyNorm1D, temperature=5000 * u.K)
>>> bb.integrate() # doctest: +FLOAT_CMP
<Quantity 9.31004974 ph / (cm2 s)>
<Quantity 9.31004028 ph / (s cm2)>
>>> sp = bb * extcurve
>>> sp.integrate() # doctest: +FLOAT_CMP
<Quantity 8.27106961 ph / (cm2 s)>
<Quantity 8.27106961 ph / (s cm2)>


.. _tutorial_fit_ew:
Expand Down
5 changes: 3 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ norecursedirs = build docs/_build synphot/src
astropy_header = true
doctest_plus = enabled
doctest_subpackage_requires =
docs/index.rst = astropy<5.3
docs/synphot/spectrum.rst = astropy<5.3
docs/index.rst = astropy>=5.3
docs/synphot/spectrum.rst = astropy>=5.3
docs/synphot/tutorials.rst = astropy>=5.3
text_file_format = rst
addopts = --doctest-rst --import-mode=append
xfail_strict = true
Expand Down
4 changes: 2 additions & 2 deletions synphot/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ def validate_wavelengths(wavelengths):

# Check for monotonicity
sorted_wave = np.sort(wave)
if not np.alltrue(sorted_wave == wave):
if np.alltrue(sorted_wave[::-1] == wave):
if not np.all(sorted_wave == wave):
if np.all(sorted_wave[::-1] == wave):
pass # Monotonic descending is allowed
else:
raise exceptions.UnsortedWavelength(
Expand Down

0 comments on commit 8887b7f

Please sign in to comment.