$30
Phys 512 Problem Set 4
In preparation for next week, I also suggest you try to run
planck_likelihood.py
in the mcmc directory. You will need to install CAMB (pip3 install camb may
work for you, but it also may not), and your life will be easier next week if you
already have the dependencies sorted out.
1) We will do a non-linear least-squares problem. Look at the file sidebands.npz in the mcmc directory. This file contains data from one of your TA’s
who is trying to measure the width of a resonance in an optical cavity. To do
this, they send in a laser with sidebands (so, most of the laser power is at a
central frequency ν plus a bit of power at ν + dν and ν − dν). They use a piezo
to mechanically push on the cavity, which in turn alters the resonant frequency
of the cavity. You can assume that over the stretch of data we use, the piezo
shifts the cavity resonant frequency linearly in time. You can load the data with
e.g.:
stuff=np.load(’sidebands.npz’)
t=stuff[’time’]
d=stuff[’signal’]
a) To start, model the data as a single Lorentzian and use analytic derivatives.
Please use Newton’s method (or Levenberg-Marquardt if you prefer) to carry
out the fit. What are your best-fit parameters for the amplitude, width, and
center? Please parameterize the Lorentzian as
d =
a
1 + (t − t0)
2/w2
b) Estimate the noise in the data, and use that to estimate the errors in
your parameters.
c) Repeat part a), but use numerical derivatives. I suggest you use a helper
function that accepts an input function (and any ancillary data/arguments you
want to pass it) and returns the derivatives of that function with respect to the
model parameters. Are your answers statistically significantly different from
your answers in a)?
d) Repeat part c), but now model the data as the sum of three Lorentzians.
The width of all three Lorentzians should be the same, and the separation of
the side peaks from the main peak should be equal, i.e.:
d =
a
1 + (t − t0)
2/w2
+
b
1 + (t − t0 + dt)
2/w2
+
c
1 + (t − t0 − dt)
2/w2
1
You should have sensible guesses for a, t0, w from earlier, so you should try to
estimate reasonable initial guesses for b, c, dt. What are your errors on these
parameters?
e) Look at the residuals from subtracting your best-fit model from the data.
Do you believe the error bars you got by assuming the data are independent
with uniform variance, and that the model is a complete description of the data?
f) Generate some some realizations for the parameter errors using the full
covariance matrix AT N−1A from part d). Plot the models you get from adding
these parameters to the parameter errors. What is the typical difference in χ
2
for the perturbed parameters compared to the best-fit χ
2
? Is this reasonable?
g) Redo the fit from part d), using an MCMC. IMPORTANT - please use
your parameter covariance estimate from d) to generate your trial MCMC samples, though you can introduce an overall scaling (the overall scaling should be
order unity, but you may find faster convergence if it isn’t exactly 1). Show at
least one plot that explains why you think your chain is converged. Did your
error bars change?
h) The laser sidebands are separated from the main peak by 9 GHz (so dx
maps to 9 GHz). What is the actual width of the cavity resonance, in GHz?
2