Skip to content

Instantly share code, notes, and snippets.

View tobin's full-sized avatar

Tobin Fricke tobin

View GitHub Profile
@tobin
tobin / example1.m
Last active December 14, 2015 07:19
Experimenting with Numerical Python
% 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');
@tobin
tobin / README
Last active December 11, 2015 17:58
This Mathematica notebook shows some properties of 1d Hermite Gauss modes:
* They are orthonormal
* What happens when the 0-mode and a higher-order mode are incident on a split photodiode?
* A displaced 0-mode can be written as a sum of higher order modes
Tobin Fricke
2013-01-25
@tobin
tobin / tumblr-dump-titles.py
Created January 16, 2013 22:08
List titles of all posts from a Tumblr blog
# This script prints out a list of the TITLES of all posts on a Tumblr blog
#
# TF 2013-01-16
import requests
import sys
if len(sys.argv) != 2:
print "Usage: " + sys.argv[0] + " blog_name.tumblr.com"
@tobin
tobin / uniqueperms.m
Created October 28, 2012 17:30
Generate unique permutations (Matlab)
function P = uniqueperms(varargin)
% This function allows two possible calling formats:
% perms_nodupes(syms)
% perms_nodupes(syms,counts)
%
% Here perms_nodupes returns all permutations of the vector SYMS.
% COUNTS is an optional vector indicating how many times each symbol should
% be included. The following are equivalent:
%
@tobin
tobin / README
Created October 24, 2012 16:41
TTFSS Overview
This diagram gives an overview of the Table-Top Frequency Stabilization Servo (TTFSS).
Nice overview wiki:
https://awiki.ligo-wa.caltech.edu/aLIGO/TTFSS
@tobin
tobin / QMeigfunc.m
Created October 19, 2012 18:10
Numerical quantum mechanics in one dimension
%% Numerical quantum mechanics (one-dimensional)
% This little program solves the eigenstate problem H|Psi> = E|Psi>
% numerically for an arbitrary hamiltonian H. Just plug in your potential
% V and seconds later take a peek at the eigenstates and eigenvalues. I'm
% sure all of this could be done in smarter ways, but I like that all the
% machinery is exposed. The only matlab trickery we use is
% matrix multiplication.
%
% Tobin Fricke <tfricke@ligo.caltech.edu>
% 2009-02-12
@tobin
tobin / boxcar_test.m
Created October 18, 2012 10:09
A look at the frequency response of sample-and-hold (aka boxcar filter)
%% Frequency response of a boxcar filter
%
% A look at the frequency response of sample-and-hold.
%
% Tobin Fricke 2012-10-18
Fs = 2^16; % Higher sample rate
R = 32; % upsampling factor
N = 1 * Fs; % number of sample data to generate
@tobin
tobin / myenv.c
Created October 9, 2012 21:58
The third argument to main()
/* It turns out that the environment pointer is passed to main()
as the third argument -- I had no idea! The usual way to get
the environment is via an "extern char **environ;" declaration.
This program prints out the environment in KEY=VALUE format,
one variable per line.
*/
#include <stdio.h>
@tobin
tobin / DACtimeseries.txt
Created October 8, 2012 22:02
Effect of zero-padding a DC signal
0 101
1.52588e-05 100
3.05176e-05 100
4.57764e-05 99
6.10352e-05 99
7.6294004e-05 98
9.15528e-05 96
0.0001068116 95
0.0001220704 127
0.0001373292 92
@tobin
tobin / Makefile
Created October 6, 2012 17:41
cin / scanf comparison
all: xor-c xor-cpp xor-cpp-noflush rand
test: xor-c xor-cpp xor-cpp-noflush
time ./xor-c < rand.txt
time ./xor-cpp < rand.txt
time ./xor-cpp-noflush < rand.txt
rand: rand.c
gcc -Wall rand.c -o rand