Testing code samples in the PySwarms project

PySwarms is a library for optimizing particle swarms using Python written for academic researchers and students. There were numerous API changes so code samples in the README may not work properly. My task is to update the code so it uses the new API.

My issue:

My PR:

I chose this project because I had zero experience with Python prior. Dealing with anxiety and imposter syndrome was probably the toughest issue when working with this issue. The only time I felt felt imposter syndrome to this extent was when I was in an internship. The ramifications of my contributions feel much more real in open source than when doing assignments for other courses because my contributions affect people in the real world.

To setup my development environment, I had to install Python 3, numpy, scipy, and matplotlib in order to install PySwarm. The example code did not work right away because some of the function signatures had changed. I searched through the code and found the function declarations and changed them accordingly. Afterwards, the code compiled but failed to produce the expected graphs and plots. There was a problem with changing matplotlib to use an interactive backend from a non-interactive backend to enable it to display the plots in separate windows.

Matplotlib uses AGG by default. It is an non-interactive backend that does not support opening new windows to display the plots. I attempted to set the backend to an interactive backend such as TkAGG, however it required the use of the Tkinter library. I installed the Tkinter library but the error would say that it was not installed. To circumvent this, I simply output the plot to a file as it was most likely a problem with my own setup of the development environment and not a problem with the code. It did not matter how the plots were output, only that I could output them to check them against the expected outputs.

Once I checked that the plots the sample code were outputting were consistent with the expected outputs. I sent in my PR, and my feelings of being an imposter dissipated somewhat. I may not be a real programmer but I mimicked one well enough.