Exercise 7#

Attention

Please note that we provide assignment feedback only for students enrolled in the course at the University of Helsinki.

Start your assignment

You can start working on your copy of Exercise 7 by accepting the GitHub Classroom assignment.

Exercise 7 is due by 12:15 on Wednesday, December 17th, 2025.

You can also take a look at the open course copy of Exercise 7 in the course GitHub repository (does not require logging in). Note that you should not try to make changes to this copy of the exercise, but rather only to the copy available via GitHub Classroom.

Hints for Exercise 7#

Comparing a single predicted age to multiple measured ages#

As mentioned in Part 2 of Problem 1, you need to calculate a goodness of fit for a set of measured ages and only a single predicted age. One simple solution for this is to use the np.ones() function to create an array of ones of the same length as the number of measured ages and then multiply that array by the predicted age. This will produce an array of the same length as the measured age array with each item in the array equal to the predicted age. See below for an example.

In [1]: import numpy as np

In [2]: predicted_age = 5.1

In [3]: measured_ages = np.array([4.2, 4.3, 7.5, 3.5, 6.4, 6.5])

# Create array of ones
In [4]: predicted_ages = np.ones(len(measured_ages)) * predicted_age

In [5]: print(predicted_ages)
[5.1 5.1 5.1 5.1 5.1 5.1]

Plotting predicted ages as horizontal lines#

I suggest that you add horizontal lines to your plots of the thermochronometer data to show the predicted ages you calculate. If you have the latitude values in your data DataFrame as data['Lat'] you can plot a predicted age predicted_age as a black horizontal line as follows:

ax2.plot([data['Lat'].min(), data['Lat'].max()], [predicted_age, predicted_age], 'k-')

This will create a horizontal line from the minimum latitude to the maximum latitude with a vertical-axis value of predicted_age. The “trick” here is to put Python lists into the ax2.plot() command instead of list or array variables. Lists are values separated by commas within square brackets ([ ]), and here we just give 2 values in each list for the x and y points that define the ends of the line.