Starting from:

$30

PHYS512 Assignment 4 -Solved

1) We will do a non-linear least-squares problem. Look at the fifile side
bands.npz in the mcmc directory. This fifile 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 fifit. What are your best-fifit parameters for the amplitude, width, and 
center? Please parameterize the Lorentzian as 
d = 

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 signifificantly difffferent 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 = 

1 + (t − t0)2/w2 


1 + (t − t0 + dt)2/w2 


1 + (t − t0 − dt)2/w2 
1You 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-fifit 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 difffference in χ2 
for the perturbed parameters compared to the best-fifit χ2 ? Is this reasonable? 
g) Redo the fifit from part d), using an MCMC. IMPORTANT - please use 
your parameter covariance estimate from d) to generate your trial MCMC sam
ples, though you can introduce an overall scaling (the overall scaling should be 
order unity, but you may fifind 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

More products