peterdsharpe / AeroSandbox

Aircraft design optimization made fast through computational graph transformations (e.g., automatic differentiation). Composable analysis tools for aerodynamics, propulsion, structures, trajectory design, and much more.
https://peterdsharpe.github.io/AeroSandbox/
MIT License
741 stars 119 forks source link

Numpy Error #15

Closed alexandroslessis closed 4 years ago

alexandroslessis commented 4 years ago

I am having trouble running any of the examples given. I get the same error every time (below is the error given from the example shown on the code home page):

Running VLM3 calculation... Meshing... Traceback (most recent call last): File "example.py", line 97, in aero_problem.run() # Runs and prints results to console File "C:\Users\ALEXANDROS\Anaconda3\envs\panel\lib\site-packages\aerosandbox\aerodynamics\vlm3.py", line 26, in run self.make_panels() File "C:\Users\ALEXANDROS\Anaconda3\envs\panel\lib\site-packages\aerosandbox\aerodynamics\vlm3.py", line 185, in make_panels np.expand_dims((1 - nondim_spanwise_coordinates), 2) np.expand_dims( File "C:\Users\ALEXANDROS\Anaconda3\envs\panel\lib\site-packages\autograd\tracer.py", line 48, in f_wrapped return f_raw(args, **kwargs) File "<__array_function__ internals>", line 6, in expand_dims File "C:\Users\ALEXANDROS\Anaconda3\envs\panel\lib\site-packages\numpy\lib\shape_base.py", line 597, in expand_dims axis = normalize_axis_tuple(axis, out_ndim) File "C:\Users\ALEXANDROS\Anaconda3\envs\panel\lib\site-packages\numpy\core\numeric.py", line 1327, in normalize_axis_tuple axis = tuple([normalize_axis_index(ax, ndim, argname) for ax in axis]) File "C:\Users\ALEXANDROS\Anaconda3\envs\panel\lib\site-packages\numpy\core\numeric.py", line 1327, in axis = tuple([normalize_axis_index(ax, ndim, argname) for ax in axis]) numpy.AxisError: axis 2 is out of bounds for array of dimension 2

I tried with and without the use of anaconda and virtual environments on 2 different computers, however, I get the same error every time. Could it be that the newest version of numpy or autograd made changes that affect the functions used? I would really appreciate your reply.

alexandroslessis commented 4 years ago

Apologies. Just reinstalled from git directory rather than pip. I need to be more careful next time. I did not notice you fixed the issue 11 days ago.

alexandroslessis commented 4 years ago

The same fix of np.expand_dims needs to be applied to panel1.py as well. Both in lines 179 and 313.

peterdsharpe commented 4 years ago

Ah - good catch! Thanks for the report!

I've fixed this and updated the releases on both GitHub and PyPI to prevent future issues. Note that panel1.py is still in development (seems to be having issues with multiple-section wings...), so vlm3.py is recommended for general use.

Also, this whole library is about to get a massive, shiny overhaul with much better performance, coupling with optimizers, and visualization - be on the lookout for that over the next few weeks!

-Peter