JustinClough / grasp

Guided Rib And Spar Placement
MIT License
1 stars 0 forks source link

what does np do? #2

Open kenyaalexa opened 5 years ago

kenyaalexa commented 5 years ago

https://github.com/JustinClough/grasp/blob/249cbbf0d14cb845ae8cd3d844e6ca2b10c9ef53/src/make_surface.py#L49

JustinClough commented 5 years ago

Here np is a nickname for the numpy module. We import numpy and assign its nickname here.

numpy is a module that helps standardize how math and numbers are handled in python. We're using np.zeros( (num_ribs_to_try, num_spars_to_try) ) to build a matrix that has num_ribs_to_try rows and num_spars_to_try columns and is full of zeros.

We're just using this to initialize the max_displacements variable. After that, we can treat it like a matrix and index into it. Down here we write the results from a parametric sweep of problems into it.

All in all, the whole make_surface.py script creates the data needed for the surface plot in the report. It's this line in the write up source code and Figure 7 in the final pdf.