Skip to content

Conversation

@j-c-c
Copy link
Collaborator

@j-c-c j-c-c commented Aug 29, 2024

This PR resolves warning messages emitted during unit testing.

Python 3.8:

  • tests/test_sinogram.py: 12 warnings
    /scratch/jc5485/miniconda3/envs/warnings_3.8/lib/python3.8/site-packages/skimage/transform/radon_transform.py:75: UserWarning: Radon transform: image must be zero outside the reconstruction circle
    warn('Radon transform: image must be zero outside the '

  • tests/test_covar2d_denoiser.py: 15 warnings
    /scratch/jc5485/Work/ASPIRE-python.warnings_3.8/src/aspire/basis/steerable.py:524: UserWarning: BlkDiagMatrix.from_dense truncating values exceeding 0.001
    filt = BlkDiagMatrix.from_dense(

Python 3.9:

  • tests/test_FFBbasis2D.py: 52 warnings

  • tests/test_FBbasis2D.py: 70 warnings

  • tests/test_FFBbasis3D.py: 4 warnings

  • tests/test_FLEbasis2D.py: 18 warnings

  • tests/test_FBbasis3D.py: 4 warnings

  • tests/test_covar2d_denoiser.py: 664 warnings

  • tests/test_mean_estimator.py: 24 warnings

  • tests/test_mean_estimator_boosting.py: 11 warnings

  • tests/test_steerable_bases_2d.py: 10 warnings

  • tests/test_FPSWFbasis2D.py: 1 warning

  • tests/test_PSWFbasis2D.py: 1 warning

  • tests/test_weighted_mean_estimator.py: 24 warnings

  • tests/test_array_image_source.py: 2 warnings
    /scratch/jc5485/Work/ASPIRE-python.warnings_3.9/src/aspire/numeric/scipy.py:17: DeprecationWarning: 'scipy.sparse.linalg.cg' keyword argument tol is deprecated in favor of rtol and will be removed in SciPy v1.14.0. Until then, if set, it will override rtol.
    return scipy.sparse.linalg.cg(*args, **kwargs)

  • tests/test_fourier_correlation.py: 32 warnings

  • tests/test_image.py: 1 warning

  • tests/test_micrograph_source.py: 8 warnings

  • tests/test_simulation.py: 3 warnings
    /scratch/jc5485/Work/ASPIRE-python.warnings_3.9/tests/test_utils.py:403: MatplotlibDeprecationWarning: Auto-close()ing of figures upon backend switching is deprecated since 3.8 and will be removed in 3.10. To suppress this warning, explicitly call plt.close('all') first.
    matplotlib.use(backend)

  • tests/test_fourier_correlation.py::test_frc_img_plot[img_size=64-dtype=<class 'numpy.float64'>]

  • tests/test_fourier_correlation.py::test_frc_img_plot[img_size=64-dtype=<class 'numpy.float32'>]

  • tests/test_fourier_correlation.py::test_frc_img_plot[img_size=65-dtype=<class 'numpy.float64'>]

  • tests/test_fourier_correlation.py::test_fsc_vol_plot[img_size=64-dtype=<class 'numpy.float64'>]

  • tests/test_fourier_correlation.py::test_fsc_vol_plot[img_size=64-dtype=<class 'numpy.float32'>]

  • tests/test_fourier_correlation.py::test_frc_img_plot[img_size=65-dtype=<class 'numpy.float32'>]

  • tests/test_fourier_correlation.py::test_fsc_vol_plot[img_size=65-dtype=<class 'numpy.float64'>]

  • tests/test_fourier_correlation.py::test_fsc_vol_plot[img_size=65-dtype=<class 'numpy.float32'>]
    /scratch/jc5485/Work/ASPIRE-python.warnings_3.9/src/aspire/utils/resolution_estimation.py:380: UserWarning: No artists with labels found to put in legend. Note that artists whose label start with an underscore are ignored when legend() is called with no argumen
    t.
    plt.legend(title=f"Method: {self.method}")

  • tests/test_micrograph_source.py::test_rectangular_micrograph_source_files
    /scratch/jc5485/miniconda3/envs/warnings_3.9/lib/python3.9/site-packages/mrcfile/mrcobject.py:626: RuntimeWarning: Data array contains NaN values
    warnings.warn("Data array contains NaN values", RuntimeWarning)

  • tests/test_sinogram.py: 60 warnings
    /scratch/jc5485/Work/ASPIRE-python.warnings_3.9/src/aspire/image/image.py:243: DeprecationWarning: product is deprecated as of NumPy 1.25.0, and will be removed in NumPy 2.0. Please use prod instead.
    return aspire.sinogram.Sinogram(xp.asnumpy(image_rt))

  • tests/test_sinogram.py: 20 warnings
    /scratch/jc5485/Work/ASPIRE-python.warnings_3.9/src/aspire/sinogram/sinogram.py:62: DeprecationWarning: product is deprecated as of NumPy 1.25.0, and will be removed in NumPy 2.0. Please use prod instead.
    return self.class(self._data[key])

  • tests/test_sinogram.py: 22 warnings
    /scratch/jc5485/Work/ASPIRE-python.warnings_3.9/src/aspire/sinogram/sinogram.py:90: DeprecationWarning: product is deprecated as of NumPy 1.25.0, and will be removed in NumPy 2.0. Please use prod instead.
    return self.class(self._data.reshape(*shape, *self._data.shape[-2:]))

  • tests/test_sinogram.py: 12 warnings
    /scratch/jc5485/miniconda3/envs/warnings_3.9/lib/python3.9/site-packages/skimage/transform/radon_transform.py:74: UserWarning: Radon transform: image must be zero outside the reconstruction circle
    warn(

  • tests/test_covar2d_denoiser.py: 15 warnings
    /scratch/jc5485/Work/ASPIRE-python.warnings_3.9/src/aspire/basis/steerable.py:524: UserWarning: BlkDiagMatrix.from_dense truncatin
    g values exceeding 0.001
    filt = BlkDiagMatrix.from_dense(

  • tests/test_orient_symmetric.py: 2970 warnings
    /scratch/jc5485/Work/ASPIRE-python.warnings_3.9/tests/test_orient_symmetric.py:641: DeprecationWarning: Conversion of an array wit
    h ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performin
    g this operation. (Deprecated NumPy 1.25.)
    clmatrix_gt[idx, i, j] = CLSymmetryC3C4.cl_angles_to_ind(

  • tests/test_orient_symmetric.py: 2970 warnings
    /scratch/jc5485/Work/ASPIRE-python.warnings_3.9/tests/test_orient_symmetric.py:644: DeprecationWarning: Conversion of an array wit
    h ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performin
    g this operation. (Deprecated NumPy 1.25.)
    clmatrix_gt[idx, j, i] = CLSymmetryC3C4.cl_angles_to_ind(

  • tests/test_orient_symmetric.py: 1932 warnings
    /scratch/jc5485/Work/ASPIRE-python.warnings_3.9/tests/test_orient_symmetric.py:158: DeprecationWarning: Conversion of an array wit
    h ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performin
    g this operation. (Deprecated NumPy 1.25.)
    dist[s] = np.minimum(

  • tests/test_orient_symmetric.py: 192 warnings
    /scratch/jc5485/Work/ASPIRE-python.warnings_3.9/tests/test_orient_symmetric.py:195: DeprecationWarning: Conversion of an array wit
    h ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performin
    g this operation. (Deprecated NumPy 1.25.)
    dist[i] = Rotation.angle_dist(estimate, Rii_gt)

Python 3.10:

  • tests/test_fourier_correlation.py: 32 warnings

  • tests/test_image.py: 1 warning

  • tests/test_micrograph_source.py: 8 warnings

  • tests/test_simulation.py: 3 warnings
    /scratch/jc5485/Work/ASPIRE-python.warnings_3.10/tests/test_utils.py:403: MatplotlibDeprecationWarning: Auto-close()ing of figures
    upon backend switching is deprecated since 3.8 and will be removed in 3.10. To suppress this warning, explicitly call plt.close('a
    ll') first.
    matplotlib.use(backend)

  • tests/test_fourier_correlation.py::test_frc_img_plot[img_size=64-dtype=<class 'numpy.float64'>]

  • tests/test_fourier_correlation.py::test_frc_img_plot[img_size=64-dtype=<class 'numpy.float32'>]

  • tests/test_fourier_correlation.py::test_frc_img_plot[img_size=65-dtype=<class 'numpy.float64'>]

  • tests/test_fourier_correlation.py::test_frc_img_plot[img_size=65-dtype=<class 'numpy.float32'>]

  • tests/test_fourier_correlation.py::test_fsc_vol_plot[img_size=64-dtype=<class 'numpy.float64'>]

  • tests/test_fourier_correlation.py::test_fsc_vol_plot[img_size=64-dtype=<class 'numpy.float32'>]

  • tests/test_fourier_correlation.py::test_fsc_vol_plot[img_size=65-dtype=<class 'numpy.float64'>]

  • tests/test_fourier_correlation.py::test_fsc_vol_plot[img_size=65-dtype=<class 'numpy.float32'>]
    /scratch/jc5485/Work/ASPIRE-python.warnings_3.10/src/aspire/utils/resolution_estimation.py:380: UserWarning: No artists with label
    s found to put in legend. Note that artists whose label start with an underscore are ignored when legend() is called with no argume
    nt.
    plt.legend(title=f"Method: {self.method}")

  • tests/test_sinogram.py: 60 warnings
    /scratch/jc5485/Work/ASPIRE-python.warnings_3.10/src/aspire/image/image.py:243: DeprecationWarning: product is deprecated as of
    NumPy 1.25.0, and will be removed in NumPy 2.0. Please use prod instead.
    return aspire.sinogram.Sinogram(xp.asnumpy(image_rt))

  • tests/test_sinogram.py: 20 warnings
    /scratch/jc5485/Work/ASPIRE-python.warnings_3.10/src/aspire/sinogram/sinogram.py:62: DeprecationWarning: product is deprecated a
    s of NumPy 1.25.0, and will be removed in NumPy 2.0. Please use prod instead.
    return self.class(self._data[key])

  • tests/test_sinogram.py: 22 warnings
    /scratch/jc5485/Work/ASPIRE-python.warnings_3.10/src/aspire/sinogram/sinogram.py:90: DeprecationWarning: product is deprecated a
    s of NumPy 1.25.0, and will be removed in NumPy 2.0. Please use prod instead.
    return self.class(self._data.reshape(*shape, *self._data.shape[-2:]))

  • tests/test_sinogram.py: 12 warnings
    /scratch/jc5485/miniconda3/envs/warnings_3.10/lib/python3.10/site-packages/skimage/transform/radon_transform.py:74: UserWarning: R
    adon transform: image must be zero outside the reconstruction circle
    warn(

  • tests/test_covar2d_denoiser.py: 15 warnings
    /scratch/jc5485/Work/ASPIRE-python.warnings_3.10/src/aspire/basis/steerable.py:524: UserWarning: BlkDiagMatrix.from_dense truncati
    ng values exceeding 0.001
    filt = BlkDiagMatrix.from_dense(

  • tests/test_orient_symmetric.py: 1932 warnings
    /scratch/jc5485/Work/ASPIRE-python.warnings_3.10/tests/test_orient_symmetric.py:158: DeprecationWarning: Conversion of an array wi
    th ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performi
    ng this operation. (Deprecated NumPy 1.25.)
    dist[s] = np.minimum(

  • tests/test_orient_symmetric.py: 192 warnings
    /scratch/jc5485/Work/ASPIRE-python.warnings_3.10/tests/test_orient_symmetric.py:195: DeprecationWarning: Conversion of an array wi
    th ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performi
    ng this operation. (Deprecated NumPy 1.25.)
    dist[i] = Rotation.angle_dist(estimate, Rii_gt)

  • tests/test_orient_symmetric.py: 2970 warnings
    /scratch/jc5485/Work/ASPIRE-python.warnings_3.10/tests/test_orient_symmetric.py:641: DeprecationWarning: Conversion of an array wi
    th ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performi
    ng this operation. (Deprecated NumPy 1.25.)
    clmatrix_gt[idx, i, j] = CLSymmetryC3C4.cl_angles_to_ind(

  • tests/test_orient_symmetric.py: 2970 warnings
    /scratch/jc5485/Work/ASPIRE-python.warnings_3.10/tests/test_orient_symmetric.py:644: DeprecationWarning: Conversion of an array wi
    th ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performi
    ng this operation. (Deprecated NumPy 1.25.)
    clmatrix_gt[idx, j, i] = CLSymmetryC3C4.cl_angles_to_ind(

@j-c-c j-c-c added CI Continuous Integration cleanup labels Aug 29, 2024
@j-c-c j-c-c self-assigned this Aug 29, 2024
@j-c-c j-c-c linked an issue Sep 3, 2024 that may be closed by this pull request
@j-c-c
Copy link
Collaborator Author

j-c-c commented Sep 10, 2024

I've resolved all warnings for Python 3.8 - 3.11.

There are 2 remaining warnings on the ampere job. One is related to an external package not importing a pandas dependency and the other set of warnings are from cufinufft warning about copying arrays.

=============================== warnings summary ===============================
../../../../../u/gbwright/.local/lib/python3.9/site-packages/xarray/testing/assertions.py:8
  /u/gbwright/.local/lib/python3.9/site-packages/xarray/testing/assertions.py:8: DeprecationWarning: 
  Pyarrow will become a required dependency of pandas in the next major release of pandas (pandas 3.0),
  (to allow more performant data types, such as the Arrow string type, and better interoperability with other libraries)
  but was not found to be installed on your system.
  If this would cause problems for you,
  please provide us feedback at https://github.com/pandas-dev/pandas/issues/54466
          
    import pandas as pd

tests/test_FFBbasis2D.py: 6 warnings
tests/test_FLEbasis2D.py: 1 warning
tests/test_anisotropic_noise.py: 2 warnings
tests/test_bot_align.py: 2 warnings
tests/test_covar2d.py: 30 warnings
tests/test_covar3d.py: 3 warnings
tests/test_relion_interop.py: 4 warnings
tests/test_simulation.py: 7 warnings
tests/test_volume.py: 4 warnings
  /u/gbwright/.local/lib/python3.9/site-packages/cufinufft/_plan.py:336: UserWarning: Argument `data` does not satisfy the following requirement: C. Copying array (this may reduce performance)
    warnings.warn(f"Argument `{name}` does not satisfy the "

@j-c-c j-c-c requested a review from garrettwrong September 10, 2024 14:51
Copy link
Collaborator

@garrettwrong garrettwrong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not fix all the errors? We should be able to fix both the remaining ones you mentioned pretty easily to make this whole.

Also, we seem to be missing the part about putting new warnings under test so the CI indicates we have warnings to address.

@j-c-c
Copy link
Collaborator Author

j-c-c commented Sep 11, 2024

Why not fix all the errors? We should be able to fix both the remaining ones you mentioned pretty easily to make this whole.

Good point. Fixed those remaining warnings.

Also, we seem to be missing the part about putting new warnings under test so the CI indicates we have warnings to address.
Ok, I adjusted the CI workflows to fail on new warnings. In most of the CI jobs this just meant adding a --strict-warnings flag to pytest. However, on the jobs where we use python to execute pytest this flag did not work so I ended up using the environment variable PYTHONWARNINGS=error.

@j-c-c j-c-c requested a review from garrettwrong September 11, 2024 13:05
@j-c-c
Copy link
Collaborator Author

j-c-c commented Sep 11, 2024

@garrettwrong as discussed in meeting, I've changed this to fail on warnings for the ampere job only. This should be good to go now. Thanks.

Copy link
Collaborator

@garrettwrong garrettwrong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good thanks! Just two questions and it can move on.

garrettwrong
garrettwrong previously approved these changes Sep 11, 2024
Copy link
Collaborator

@garrettwrong garrettwrong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks!

@j-c-c j-c-c marked this pull request as ready for review September 12, 2024 13:32
@j-c-c j-c-c requested a review from janden as a code owner September 12, 2024 13:32
janden
janden previously approved these changes Sep 12, 2024
Copy link
Collaborator

@janden janden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Just one question, really.

@j-c-c j-c-c removed their assignment Sep 13, 2024
@j-c-c j-c-c dismissed stale reviews from janden and garrettwrong via 9a0afa9 September 13, 2024 12:58
@j-c-c j-c-c self-assigned this Sep 13, 2024
@j-c-c
Copy link
Collaborator Author

j-c-c commented Sep 13, 2024

Had to resolve a conflict related to purging pyshtools. Once CI passes I'll merge.

@j-c-c j-c-c merged commit c8ca38e into develop Sep 13, 2024
@j-c-c j-c-c mentioned this pull request Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Continuous Integration cleanup

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cleanup Warnings

4 participants