Log in

Tobin's Lab Notebook [entries|archive|friends|userinfo]
Tobin Fricke's Lab Notebook

[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

jinc function [Jun. 30th, 2013|02:37 pm]
Tobin Fricke's Lab Notebook
Reading: J. Goodman, "Intro to Fourier Optics", Ch 2-3

It turns out that the Fourier transform for a rotationally-symmetric 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!:

LinkLeave a comment

Github "gist" integration with Livejournal [Feb. 27th, 2013|06:28 pm]
Tobin Fricke's Lab Notebook
[Tags|, ]

It turns out that Livejournal recognizes github gist URLs, and will "embed" the resulting gist into an LJ entry.

Here's the relevant changelog: http://changelog.livejournal.com/16367242.html It's all done in javascript.


Link9 comments|Leave a comment

From Matlab to Python [Feb. 27th, 2013|05:38 pm]
Tobin Fricke's Lab Notebook
[Tags|, ]

Since college, Matlab has been my go-to environment for all kinds of numerical simulations, analysis, and plotting. Matlab is an exceptionally well-designed 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 add-on 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, open-source 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 Matlab-like 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 Matlab-style plots, and numpy contains lots of Matlab-like numerical functions. They work together... somehow. On Ubuntu, installation is just one shell command:
sudo apt-get install python-matplotlib python-numpy
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")
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 element-wise ./ 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")
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!
Link11 comments|Leave a comment

talk: intro to state space [Dec. 10th, 2012|12:02 am]
Tobin Fricke's Lab Notebook
[Tags|, ]

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/statespace-intro-talk
LinkLeave a comment

Chaos Pendulum [Dec. 7th, 2012|06:56 pm]
Tobin Fricke's Lab Notebook

A nicely built double pendulum from Dan Busby.
LinkLeave a comment

TeX input mode [Oct. 16th, 2012|11:35 pm]
Tobin Fricke's Lab Notebook
[Tags|, , ]

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 system-wide.

Invoke it with M-x set-input-method and then TeX. I found out about this via this stackoverflow answer.
Link1 comment|Leave a comment

TIL main() takes a third argument [Oct. 10th, 2012|11:16 am]
Tobin Fricke's Lab Notebook
[Tags|, , ]

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;
LinkLeave a comment

poles [Mar. 21st, 2012|11:56 am]
Tobin Fricke's Lab Notebook
[Tags|, ]

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]
LinkLeave a comment

H/(1+HG) [Jul. 31st, 2011|01:35 pm]
Tobin Fricke's Lab Notebook

The Barkhausen Stability Criterion is simple, intuitive, and wrong.

LinkLeave a comment

L1 LSC [Jun. 30th, 2011|09:39 pm]
Tobin Fricke's Lab Notebook


For future reference, here is a screen-shot of the LIGO Livingston (L1) length sensing and control (LSC) control screen in MEDM, while L1 was in low-noise (detection) mode. There's a full-size 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.
Link2 comments|Leave a comment

[ viewing | most recent entries ]
[ go | earlier ]