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

Replacing deprecated scipy simps method in MWA code #1377

Merged
merged 4 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ positions are near surface of whatever celestial body their positions are refere
(either the Earth or Moon, currently).

### Changed
- Changed `MWACorrFits.corrcorrect_simps` method to use the `scipy.integrate.simpson`
method rather than the `scipy.integrate.simps` method to fix deprecation warnings.
- added support for python 3.12, dropped support for python 3.8.
- Updated minimum dependency versions: pyyaml>=5.3
- Changed `UVData.write_ms` to sort polarizations based on CASA-preferred ordering.
Expand Down
10 changes: 8 additions & 2 deletions pyuvdata/uvdata/mwa_corr_fits.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,15 @@
from astropy.io import fits
from astropy.time import Time
from docstring_parser import DocstringStyle
from scipy.integrate import simps
from scipy.special import erf

try:
# TODO: Make this the only line we use once scipy >= 1.11 is required.
from scipy.integrate import simpson
except ImportError:
# Fallback to simps if working with an older version of scipy
from scipy.integrate import simps as simpson

from pyuvdata.data import DATA_PATH

from .. import _corr_fits
Expand Down Expand Up @@ -304,7 +310,7 @@ def corrcorrect_simps(rho, sig1, sig2):
x = np.linspace(0, rho, 11, dtype=np.float64)
khat = np.zeros((11, rho.size), dtype=np.float64)
khat = _corr_fits.get_khat(x, sig1, sig2)
integrated_khat = simps(khat, x, axis=0)
integrated_khat = simpson(khat, x=x, axis=0)
return integrated_khat


Expand Down
Loading