Practice Problems

Lecture 8

Answer each number in a separate cell

Rename this notebook with your last name and the lecture

ex. CychB_08
  1. Adding notes in matplotlib.pyplot
    • Similar to the lecture:
      • Read the file 'Datasets/seismicRecord/earthquake.txt'into a pandas DataFrame
      • Change the units of the x-axis to time in minutes
    • Make a plot of velocity against time
      • Include a label for the x and y-axis.
      • Plot the line red
      • Use help() to learn about the matplotlib function title() then add this title: 'Earthquake observed at Pinyon Flat Observatory'
    • Add a note
      • Place the note at x = 4 and y = 170000
      • Write the text'P-S delay interval'
      • Color the text blue
      • rotate the text so that it is vertical (hint: use rotation = 90)
  2. Panda DataFrames

    • Import the file 'Datasets/TravelTimeDelta/DeltaTime.txt' into a panda DataFrame
    • Get acquainted with the DataFrame:
      • print out the name of the columns
      • print out the first few lines of the DataFrame
      • change the column headers
      • print out the new column headers
    • Convert the P wave arrival from minutes and seconds to decimal minutes. Add the P wave arrival, in decimal minutes, to the data frame
    • Calculate the S wave arrival by:
      1. Converting S-P to decimal minutes
      2. Adding P in decimal minutes to S-P in decimal minutes
  3. Additional matplotlib.pylab

    • Plot Degrees against decimal minutes for both the Primary wave arrival and the Secondary wave arrival
    • Color the primary wave green and label it "Primary wave"
    • Color the shear wave blue and label it "Shear wave"
    • Add a legend in the lower right hand corner of your figure
    • Add a title to your figure
    • Add a label to the x and y axis
    • Save the figure
    • Remove the legend from your plot. Insert the text "Primary wave" and "Shear wave" above the appropriate line
    • Save the new figure
In [ ]: