Skip to content

Instantly share code, notes, and snippets.

View tobin's full-sized avatar

Tobin Fricke tobin

View GitHub Profile
@tobin
tobin / hk.c
Last active September 10, 2022 21:53
Hoshen-Kopelman algorithm for cluster labeling
/* Tobin Fricke's implementation of the
Hoshen-Kopelman algorithm for
cluster labeling.
Copyright (c) September 9, 2000, by Tobin Fricke <[email protected]>
Modified 2002-03-09 Tobin Fricke
Modified substantially 2004-04-21 by Tobin Fricke
This program is written in the 1999 standard of the C language (C99). Older C
@tobin
tobin / phasordemo.matlab
Created June 9, 2011 00:10
Phasor demo
% Phasor demo
%
% Tobin Fricke <[email protected]> 2011-06-08
% modulation depth
m = pi/4;
% vector of (normalized) frequencies to include
freqs = [0 1 -1 2 -2 3 -3 4 -4];
function opt = my_configuration
% RF component vector
Pin = 100;
%vMod = (-1:1)';
fMod = 10e+6;
%vFrf = fMod * vMod;
% create model - give vector of RF field frequencies
opt = Optickle([-fMod,0,fMod]);
@tobin
tobin / drawcircuit.cc
Created July 3, 2011 23:58
draw a series/parallel combination of capacitors in postscript (incomplete)
#include <iostream>
#include <vector>
#include <string>
using namespace std;
class drawable {
public:
virtual float getHeight() = 0;
@tobin
tobin / demoReadFilterFile.m
Created August 2, 2011 02:46
How to read Foton files into Matlab
filename = '/cvs/cds/llo/chans/L1LSC.txt';
% read the filter file
pfilt = readFilterFile(filename); % this is from mDV
% identify the filter modules we want
bank_name = 'DARM'; % filter bank name
modules = [1:5,9]; % FM1,2,3,4,5,9 are enabled in low-noise mode
% Extract the right SOSes and convert to digital ZPK:
@tobin
tobin / ezcaswitchreport.m
Created August 9, 2011 21:32
Decode LIGO filter bank status from _SW1R and _SW2R EPICS channels
function varargout = ezcaswitchreport(varargin)
% ezcaswitchreport(sw1r, sw2r)
%
% This function decodes the _SW1R and _SW2R filter bank status readbacks
% in the LIGO realtime control system.
%
% Use EPICS functions to get the values, for instance:
%
% caget L1:ASC-WFS1_PIT_SW1R L1:ASC-WFS1_PIT_SW2R
% L1:ASC-WFS1_PIT_SW1R 61685
@tobin
tobin / sos2freqresp.m
Created August 12, 2011 00:02
Frequency response of a second-order-section (SOS) IIR filter
function H = sos2freqresp(sos, omega, fs)
%SOS2FREQRESP Frequency response of SOS filters.
%
% H = SOS2FREQRESP(SOS,W,FS) computes the frequency response H of the
% matrix of second order section coefficients at the frequencies
% specified by the vector W. These frequencies should be real and in
% radians/second. FS is the sample rate in samples per second.
%
% Example usage:
%
@tobin
tobin / trpnb.m
Created August 28, 2011 08:17
Technical radiation pressure noise budget
%% Technical radiation pressure noise budget
%
% Produce a noise budget showing shot noise, quantum radiation pressure
% noise, and technical radiation pressure noise in a FP Michelson IFO.
%
% Reference: Chaibi and Bondu pre-print
%
% Tobin Fricke
% August 27, 2011
@tobin
tobin / author-filter.pl
Created September 28, 2011 03:23
Truncate authors list in citeulike.org-generated BibTeX file
#!/usr/bin/perl -w
# Read a BibTex file generated by citeulike.org and truncate any author lists
# that contain too many authors.
#
# Tobin Fricke, 2011-09-27
use strict;
my $max_authors = 10;
@tobin
tobin / README
Created October 21, 2011 22:40
GPS log from Pineville airplane trip and Atchafalaya boat trip
Download from my GPS from these two trips. Part of the first leg of the airplane trip
is missing.
For a quick visualization, extract the coordinates:
> grep '^T' trackOct2011.txt | awk '{print $5 " " $4}' > foo.txt
Then you can open up gnuplot and simply do:
> plot "foo.txt"