
Tobin Fricke's Lab Notebook



jinc function 
[Jun. 30th, 201302:37 pm]

Reading: J. Goodman, "Intro to Fourier Optics", Ch 23
It turns out that the Fourier transform for a rotationallysymmetric function turns into:
G(rho) = 2 pi \int r g(r) J_0(2 pi r rho) dr
For the first time here I stumbled across the "jinc" or "besinc" functions. The fourier transform of the "rectangle" function is the sinc function. Well, the transform of the 2D analogue, the "circle" function, is the "jinc" function, bearing obvious similarity to its cousin the sinc:
sinc(x) = (sin pi x)/(pi x)
jinc(x) = J_1(2 pi x)/x
Naturally John D Cook has beaten me to the punch, but it seems I'm only 1.5 years behind!:
http://www.johndcook.com/blog/2012/02/01/jincfunction/ 


From Matlab to Python 
[Feb. 27th, 201305:38 pm]

Since college, Matlab has been my goto environment for all kinds of numerical simulations, analysis, and plotting. Matlab is an exceptionally welldesigned environment and I love it.
The downside to Matlab is that it is expensive. Happily my employer provides not only a Matlab license but also licenses to the many addon toolboxes that quickly become indispensable. Nonetheless, since the license server is on the network, work grinds to a halt when sitting with the laptop on a train or an airplane or anywhere else without network access.
I've heard tell that many of the useful features of Matlab have been ported over to Python. The idea of a free, opensource environment that's just as good as Matlab is very appealing. To be honest, I'm not really sure what's needed to make this Python environment work, or really, what all the pieces are. I've heard of matplotlib (for making Matlablike plots), SciPy, NumPy, and Pylab. Here's a first notebook entry in trying to sort all of this out.
Here's what I have so far:
First, install "matplotlib" and numerical python ("numpy"). Matplotlib is the package that lets us make nice Matlabstyle plots, and numpy contains lots of Matlablike numerical functions. They work together... somehow. On Ubuntu, installation is just one shell command:sudo aptget install pythonmatplotlib pythonnumpy As a first simple task, let's plot an Airy function. Here's my equivalent Matlab script:
% Matlab code to plot a cavity resonance
F = 10; % Finesse
f = linspace(0.5, 1.5, 201); P = 1./(1 + (2/pi) * F^2 * sin(pi*f).^2);
plot(f, P); xlabel('free spectral ranges'); ylabel('power buildup'); And now the python:# Python code to plot a cavity resonance
import numpy as numpy F = 10 f = numpy.linspace(0.5, 1.5, 201) P = 1 / (1 + (2/numpy.pi) * F**2 * numpy.sin(numpy.pi * f) ** 2)
import matplotlib.pyplot as plt plt.plot(f, P) plt.xlabel("free spectral ranges") plt.ylabel("power buildup") plt.show() The package names (numpy and plt) make that code a bit verbose and cumbersome. I'm not sure whether it's considered good style, but it's possible to import numpy and the plotting library into the default namespace. The resulting code is almost exactly the same as Matlab, except the power operator is ** instead of ^ and you need to call show() to make the plot appear. Also, the regular division operator seems to work in Python (instead of Matlab's elementwise ./ operator).
# Python! from numpy import * from matplotlib.pyplot import * F = 10 f = linspace(0.5, 1.5, 201) P = 1/ (1 + (2/pi) * F**2 * sin(pi*f)**2) plot(f, P) xlabel("free spectral ranges") ylabel("power buildup") show() To run that, I just started the regular python interpreter (by typing "python" at a command prompt) and typed it in by hand.
The results:
That's Matlab's plot window on the left, and Python's Matplotlib on the right. Not bad! 


talk: intro to state space 
[Dec. 10th, 201212:02 am]

At the recent GEO interferometer sensing and control meeting in Hannover, I gave a short talk titled "Introduction to State Space techniques". It's really a very brief intro, whose main purpose is to introduce the state observer/controller structure. You can find the slides and a toy demo Matlab script here: https://github.com/tobin/statespaceintrotalk 


Chaos Pendulum 
[Dec. 7th, 201206:56 pm]

A nicely built double pendulum from Dan Busby. 


TeX input mode 
[Oct. 16th, 201211:35 pm]

I've often wished for an easier way to enter unicode math symbols, for example by typing the LaTeX code. Instead the only way I know is to google for the symbol, which has got to be most complicated way of entering a symbol.
But I just found out that EMACS has a "TeX input mode", where you just type TeX symbols and they magically turn into unicode symbols.
For example, if you type
\forall x \in R, x^2 \geq 0
you get
∀ x ∈ R, x² ≥ 0
Awesome! If only I could get this input mode systemwide.
Invoke it with Mx setinputmethod and then TeX . I found out about this via this stackoverflow answer. 


TIL main() takes a third argument 
[Oct. 10th, 201211:16 am]

It turns out that the environment pointer is passed to main() as the third argument—I had no idea! This seems like something I must have read once upon a time in something like The Unix Programming Environment but I seem to have forgotten. /* This program prints out the environment in KEY=VALUE format,
one variable per line: */
#include <stdio.h>
int main(int argc, char **argv, char **envp) {
while (*envp)
printf("%s\n", *envp++);
return 0;
} https://gist.github.com/3861703 


poles 
[Mar. 21st, 201211:56 am]

Bernard Friedland's explanation of the origin of the word "pole" (in Control System Design):The roots of the denominator [of a rational function] are called the poles of the transfer function because H(s) becomes infinite at these complex frequencies and a contour map of the complex plane appears as if it has poles sticking up from these points. [emphasis mine] 


L1 LSC 
[Jun. 30th, 201109:39 pm]

For future reference, here is a screenshot of the LIGO Livingston (L1) length sensing and control (LSC) control screen in MEDM, while L1 was in lownoise (detection) mode. There's a fullsize version too; also in github.
What this is: this is the control panel for the servos that control the mirrors in LIGO. Inputs come in on the left (from photodiodes). In the middle there are a bunch of filters with complicated transfer functions. Outputs go out to the right, pushing on the mirrors. 


navigation 
[ 
viewing 
 
most recent entries 
] 
[ 
go 
 
earlier 
] 
 

