PHYS 460 Spring 2021

Task 1: Compute the gap of a semiconductor from measurements

Suppose we have a measurement of carrier concentration versus temperature. Your job is to estimate the gap of the semiconductor in eV. Your data is given in this file. Your tasks will be:

  1. Download and plot the data given. What quantities are given, in what units?
  2. Use pen and paper to explicitly write out the transformations you’ll need to make to the given data to get the gap. Are there any terms you can ignore?
  3. Discuss a plan with your groupmates on what operations need to be done.
  4. Transform the data by making new columns.
  5. Use linear regression to fit the data. One of the coefficients should be the desired value.
  6. Does the answer make sense? What errors did you make? Are you confident in your processing?

The correct answer is on this page, but convince yourself of your work before you look at it.

Useful code

These are examples; they will not work if you copy/paste them!

Import all libraries you’ll need and grab physical constants (Boltzmann constant in eV)

import seaborn as sns
import statsmodels.formula.api as sm
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy
import scipy.constants
k_eV = scipy.constants.k/scipy.constants.e

Rename a column

df = pd.DataFrame({"A": [1, 2, 3], "B": [4, 5, 6]})
df = df.rename(columns={"A": "a", "B": "c"})
   a  c
0  1  4
1  2  5
2  3  6

Read in data from a URL

df = pd.read_csv("http://courses.engr.illinois.edu/phys460/cooldata.csv")

Do math on columns of data

df['inversex'] = 1.0/df['x']
df['z'] = df['x'] + df['y']
df['logx'] = np.log(df['x'])

Plot the data

plt.scatter('x','y',data=df, label='data')
plt.legend()
plt.xlabel("x (units)")
plt.ylabel("y (units)")

Fit a function and provide a report on the fit. This will perform linear regression and print out the coefficients and their error bars, listed under ‘std err’

fit = sm.ols("y ~ x", data = df).fit()
fit.summary()

Plot the fit versus the data, and save to a PDF.

plt.scatter('x','y',data=df, label='Data')
plt.plot(df['x'], fit.predict(df), label='Fit')
plt.legend()
plt.xlabel("x (units)")
plt.ylabel("y (units)")
plt.savefig("fit_plot.pdf", bbox_inches='tight')
The gap used to generate the data is here. Don’t click this until you’re ready to check!

1.2 eV

Task 2: Fit to an asymptotic behavior

We know that for insulators, the heat capacity is proportional to T3 at low temperature. But how do we know what low temperature is? For this case, I’ve made up a silly function that you will play with. You’ll also use some of the tools from above. The data is in this file.

What you should do:

  1. Make a new notebook for this!
  2. Make a log-log plot. At what temperature does the slope change? Don’t forget that you’ve plotted the log!
  3. Try fitting to a T3 behavior for different cutoffs. Does it converge as the cutoff decreases? How does that compare to the number you got from (1)?

More snippets

Try to fit to a T3 with different cutoffs.

for cutoff in [100, 50, 30, 20, 10, 5]:
    fit = sm.ols('C ~ np.power(T,3)', data=df[df['T']<cutoff]).fit()
    print(cutoff, fit.params['np.power(T, 3)'])
The function used to make the data is here. Don’t click this until you’re ready to check your work!

0.2 T3 + 0.00000001T5 + 0.000000001T9