EGR 103/Fall 2019/Lab 8

From PrattWiki
Jump to navigation Jump to search

The following document is meant as an outline of what is covered in this assignment.

Additional References

  • Autostylers include black, autopep8, and yapf -- we will mainly use black
    • To get the package:
      • On Windows start an Anaconda Prompt (Start->Anaconda3->Anaconda Prompt) or on macOS open a terminal and change to the \users\name\Anaconda3 folder
      • pip install black should install the code
    • To use that package:
      • Change to the directory where you files lives. On Windows, to change drives, type the driver letter and a colon by itself on a line, then use cd and a path to change directories; on macOS, type cd /Volumes/NetID where NetID is your NetID to change into your mounted drive.
      • Type black FILE.py and note that this will actually change the file - be sure to save any changes you made to the file before running black
      • As noted in class, black automatically assumes 88 characters in a line; to get it to use the standard 80, use the -l 80 adverb, e.g. black FILE.py -l 80

Typographical Errors

None yet!

Comments

  • You may get warnings (so, so many warnings) about "The PostScript backend does not support transparency; partially transparent artists will be rendered opaque." - ignore them.

Specific Problems

  • Note in the skeleton that code is already given to bring in the files and figures. If you use different names, just change the names in the skeleton.
  • Be sure to put the appropriate version of the honor code -- if you use the examples from Pundit, the original author is either DukeEgr93 or Michael R. Gustafson II depending on how you want to cite things.

Chapra 2.22

  • Don't stare at the top half of the figure too long, or you will get sleepy. Very sleeeeeeepy…
  • Since you are adding two different kinds of axes, you will need to create the figure first and then create two different axis handles - a regular one for the top and a 3-D one for the bottom.
  • Use fig.set_size_inches(6, 8, forward=True) to make the graph the correct size.
  • Don't forget fig.tight_layout()

Chapra 3.9

  • To see all the colormaps, after importing the cm group just type
help(cm)
to see the names or go to Colormap Reference to see the color maps - only the ones listed with the help command are actually installed. Avoid the qualitative maps, flag, and prism.

Chapra 15.5

  • Be sure to convert the original data sets into appropriately-shaped matrices before plotting.
  • Use the ax.set() command for labels and tick locations and remember the kwargs to set tick locations are xticks, yticks, and (though not needed here) zticks; those will take an array or list of where you want ticks.

Chapra 15.6

  • The labels and ticks and such are the same as 15.5 so re-use that code!
  • Note that you will be both doing statistics with the estimates and making a graph based on a calculation with them. The former needs a column and the latter needs a matrix.
  • Don't forget to calculate the estimate and the error for it!
  • You can copy and paste the coefficient values - just truncate them after four significant digits. They can be in scientific notation or floating point.

Chapra 15.7

  • The labels and ticks and such are the same as 15.5 so re-use that code!
  • There are very minor modifications between this and the previous script.
  • Don't forget to calculate the estimate and the error for it!
  • You can copy and paste the coefficient values - just truncate them after four significant digits. They can be in scientific notation or floating point.

Sphere

  • It should look like a sphere! Use fig.set_size_inches(6, 6, forward=True) to make the graph the correct size - if the figure window isn't square, the sphere will not actually look...spherical.
  • Don't forget to make it not blue!