Skip to content

Update of package for newer python versions (python 3.10 and above) - #26

Merged
chrisbrand-droid merged 2 commits into
WUST-FOG:mainfrom
chrisbrand-droid:main
Nov 12, 2026
Merged

chrisbrand-droid merged 2 commits into
WUST-FOG:mainfrom
chrisbrand-droid:main

Conversation

@chrisbrand-droid

Copy link
Copy Markdown
Collaborator

Updated the following files:

  1. setup.py
  • import pkg_resources was deprecated and removed in Python 3.12. The code was updated to reflect this change by removing the import statement and any references to pkg_resources in the setup.py file. Now it takes the lines directly from the requirements.txt file without using pkg_resources.
  1. gnlse/dispersion.py
  • numpy.math.factorial was deprecated and removed in numpy 1.25.0. The code was updated to use the math module instead of numpy for calculating factorials. This change ensures compatibility with newer versions of numpy and avoids potential issues with deprecated functions.
  1. gnlse/visualization.py
  • scipy.interpolate.interp1d was deprecated and removed in Scipy 1.14.0. The code was updated to use the new SciPy interpolator RegularGridInterpolator, ensuring that the visualization functions continue to work correctly with the latest version of the library.
  1. examples/test_Dudley.py
  • The plotting functions were updated to use logarithmic scales (plot_wavelength_vs_distance and plot_delay_vs_distance to plot_wavelength_vs_distance_logarithmic and plot_delay_vs_distance_logarithmic) for better visualization of the data to reflect what was plotted in the book Supercontinuum Generation by Dudley and Taylor. The changes include replacing the original plotting functions with their logarithmic counterparts, allowing for a more accurate representation of the results in the plots.

- setup.py
    import pkg_resources was deprecated and removed in Python 3.12. The code was updated to reflect this change by removing the import statement and any references to pkg_resources in the setup.py file. Now it takes the lines directly from the requirements.txt file without using pkg_resources.
- gnlse/dispersion.py
    numpy.math.factorial was deprecated and removed in numpy 1.25.0. The code was updated to use the math module instead of numpy for calculating factorials. This change ensures compatibility with newer versions of numpy and avoids potential issues with deprecated functions.
- gnlse/visualization.py
    Scipy.interpolate.interp1d was deprecated and removed in Scipy 1.14.0. The code was updated to use the new SciPy interpolator RegularGridInterpolator, ensuring that the visualization functions continue to work correctly with the latest version of the library.
- examples/test_Dudley.py
    The plotting functions were updated to use logarithmic scales for better visualization of the data to reflect what was plotted in the book Supercontinuum Generation by Dudley and Taylor. The changes include replacing the original plotting functions with their logarithmic counterparts, allowing for a more accurate representation of the results in the plots.
@karoltarnowski karoltarnowski self-assigned this Nov 5, 2026
…evious pull request and some warnings.

Changes to requirements.txt to update the minimum version
of numpy, matplotlib, hdf5storage and scipy.

Warnings:
 - visualization.py: in np.log10, added out=None to avoid warnings when the where condition is not met.
 - gnlse.py: in the tqdm progress bar, round the total (fibre length) to avoid warnings when the rounded fraction is greater than the total.
 - plot_input_pulse.py: Changed the plotting to plot the absolute values of the amplitude envelopes to avoid warnings when plotting complex numbers.

Cosmetic changes:
 - Changed to logarithmic plots in test_raman.py to visualise the spectrum better.
 - setup.py: removed commented out code.
 - plot_input_pulse.py: fixed typos in comments.
 - visualization.py: split long line into two lines to avoid line length warnings.
@chrisbrand-droid
chrisbrand-droid marked this pull request as draft November 6, 2026 15:55
@chrisbrand-droid
chrisbrand-droid marked this pull request as ready for review November 6, 2026 15:58
@chrisbrand-droid

Copy link
Copy Markdown
Collaborator Author

Update: Formatting changes and requirement updates to fix test failures on previous pull request and some warnings.

  • Changes to requirements.txt to update the minimum version of numpy, matplotlib, hdf5storage and scipy.

Warnings:

  • visualization.py: in np.log10, added out=None to avoid warnings when the where condition is not met.
  • gnlse.py: in the tqdm progress bar, round the total (fibre length) to avoid warnings when the rounded fraction is greater than the total.
  • plot_input_pulse.py: Changed the plotting to plot the absolute values of the amplitude envelopes to avoid warnings when plotting complex numbers.

Cosmetic changes:

  • Changed to logarithmic plots in test_raman.py to visualise the spectrum better.
  • setup.py: removed commented out code.
  • plot_input_pulse.py: fixed typos in comments.
  • visualization.py: split long line into two lines to avoid line length warnings.

@chrisbrand-droid
chrisbrand-droid merged commit f4494a9 into WUST-FOG:main Nov 12, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants