jacobwilliams / Fortran-Astrodynamics-Toolkit

A Modern Fortran Library for Astrodynamics 🚀
Other
176 stars 50 forks source link

Getting the pork chop test to run under Python 3.7.3 and Matplotlib 3.1.1 #20

Open OrbitalMechanic opened 5 years ago

OrbitalMechanic commented 5 years ago

I am attempting to run the pork_chop.py test. I'm running Python 3.7.3 and Matplotlib 3.1.1 in the current Anaconda distribution.

Now the first issue encountered had to do with the removal of get_axes() from Matplolib. Commit 9288ba8 referenced in https://github.com/cphyc/matplotlib-label-lines/issues/1 showed me that replacing line.get_axes() with line.axes would solve that problem, and it did. A copy of the modified code has been attached to this note. Now I have a different problem.

Presently, when I run pork_chop.py I get the following error message.

(base) Samuels-Mac-Pro:pork_chop user$ python3 pork_chop.py
Traceback (most recent call last):
  File "pork_chop.py", line 229, in <module>
    draw_all_flight_time_lines()
  File "pork_chop.py", line 155, in draw_all_flight_time_lines
    draw_flight_time_line(t0[:,np.size(t0,1)/4],tf[:,np.size(t0,1)/4],'r')
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices
(base) Samuels-Mac-Pro:pork_chop user$ python3

Any suggestions?

Please advise.

Sam Dupree.

pork_chop.py.txt

jacobwilliams commented 4 years ago

I guess they changed something in python or matplotlib? It used to work. I'll try to take a look when I get a chance.

OrbitalMechanic commented 4 years ago

Taking a deeper dive into the issue I cited, I found on https://stackoverflow.com/questions/34952651/only-integers-slices-ellipsis-numpy-newaxis-none-and-intege that the problem can be caused by expressions such as np.size(t0,1)/4 result in a float type as opposed to an int. So I replaced statement like np.size(t0,1)/4) with int(np.size(t0,1)/4)) (lines 155 thru 158 in pork_chop.py), the program now works.

A text file containing the modified version of pork_chop.py is attached to this note.

Hope this helps. Sam Dupree.

pork_chop.py-2.txt

jacobwilliams commented 1 year ago

Note: in their infinite wisdom, matplotlib also changed their reference epoch in 3.3, so that would also need to be updated, or the dates on the axes will be wrong.