Class 9 – Start Arrays

Overview

Today we are going to look further into arrays.  The link (pdf=TwoDArrays-2024).

Video

Homework

Due Wednesday February 21, 2024:

  1. Your are only allowed to add two lines of code to answer this question.  Take your code from today where you read in Brian.csv and plotted the array.  You can only add two more lines of code to your work from today to make the plot.   Using two lines of code and your slicing nomenclature add an exclamation point.  Remember in the file I had the background as 0’s and the writing as 1’s.  You need to at least make a third color!.  Then print it in a color of your choice using a colormap.  My answer is below. Both answers are perfectly correct.  I just wanted to add more color this year!  To make the lines crisp I turned off interpolation.  Here is the documentation. But in imshow you need to add the keyword argument interpolation=’none’ like we did in class.                brian

2.  For part 2.  Make a new csv file in excel and make it so you can print your name in more than one color.   So read in your file and make the plot.  By plot it I mean show your name like I show my name!   As a hint.  I made my csv file in excel and I made the rows and columns smaller or changed the zoom so I could see the pattern I was entering.  When saving a csv in excel using the ms-dos csv option seems to work the best.  When making the csv file name the csv file with your name.

3.  For the third part.  Make an excel file with one column for x-values and three columns for y-values.  Label each column. I would do ten or so rows.  So approximately ten values for the x-values.  For the y-columns make each distinct.  You can choose your own function or pattern (straight, curved, etc)  for the y-values.   But make sure each line is unique.  Now read in the file and plot the lines in excel and label the axes.   So you need to make an excel file and use it to plot three distinct lines.

For handing in make sure to hand in your notebook, your csv file for you name, and the excel file for your lines.

 

13 thoughts on “Class 9 – Start Arrays

  1. I liked this assignment but it defintely tripped me up. It took me awhile to figure out how making a new array could generate the exclamation point.

    Doing it a second time with our names was fun!

  2. Arrays took me a while to fully understand what I was doing. I think the added diagram in the notebook really helped. I had to take a couple steps back and try to understand the very basic meaning. Also, the homework hint was super helpful.

  3. This was a very useful class and had a lot of information to process. I would maybe add a warning about the slice command and how every-time you run it, it adds the new “slice” to the array. I know this is obvious but I was confused as to why i had a duplicate row in my array a few lines later on and hadn’t realized I accidentally ran my slice cell twice.

  4. I really enjoyed this class. It took me a while to do it but it was worth it in the end. I enjoyed the video component as well. I struggled with the spacing between the letters but the video was useful for that.

  5. I really like this class and assignment! While I initially struggled to make the exclamation point a different color, it was very rewarding when I finally figured it out. This lesson was a useful introduction on how to use the color functions. As mentioned above, I think it would be useful to create an additional part of the assignment in which students can make any design they want for extra practice with colors.

  6. I found this classwork quite challenging because we were putting together a lot of code and different concepts. The hardest part was the sin/cosine graphs, but once I put it together the rest of the packet flowed really easily. One thing I would recommend is making the homework assignment a little more challenging because it would help me really understand the theory behind the code!

  7. This was one of the more fun assignments that we got to explore and play with a lot which I appreciated. Practicing to choose what colors we wanted represented and how on our graphs was key, I just wish that we could have continued to practice how to add colors and design our graphs in a more unique way, perhaps by making the assignments state that the line has to be a certain color and certain properties.

  8. It’s been a while since we did it, but I really enjoyed this lesson! it was very cool to see the colors change and the moment when I got the colors to switch, i realized how awesome python could be. Sounds cheesy but i thought this was a pretty important lesson in demonstrating the customize-ability of the platform. The idea that a big array of ones and zeros could become text was very cool to experience as you’re going through the notebook. As far as improvements, maybe encourage other designs aside from just letters. maybe have an in class art contest?! could be fun!

  9. This section was very useful as arrays are one of the most common form of storing data. Through binary data (1,0), we were able to generate an image through a 2-D array. Additional information to replicate the given example would have been helpful. Once I understood the techniques, I had trouble generating the ‘Brian !’ example exactly.

  10. I found this assignment very useful, indexing arrays and manipulating datasets is one of the aspects of this course that I have found most applicable to my lab work at Lamont. It might be helpful to people who do outside lab work to add an exercise where you reshape an array to the same dimensions as another existing array or how to use interp1 because this is something that I’ve run into many times.

  11. 2 great tools from this class. First, just array and column slicing and rearranging, which seems a little trivial, but can get more complicated when using different datasets or doing more complex manipulations. Often times when I would run into an error in later assignment, the issue was with slicing. Second, heat maps are incredible!! 3D representation and tripping color spectrums, what could be better?

  12. I really liked this class. It was really good practice to learn how to read in excel sheets. The coloring was challenging, I also had a hard time making the exclamation point different colors. I think that next time you should let people make any designs they want. So that they can really play around with colors in python.

  13. I liked this assignment – there was one part that tricked me for a while, but once I figured it out, I learned a lot about my input values. I struggled with figuring out how to make an exclamation point of a different color, but once I was able to figure it out, I learned more about the graphing and the representation of values for this type of graphing and plotting.

Leave a Reply