Skip to content

Instantly share code, notes, and snippets.

View moorepants's full-sized avatar

Jason K. Moore moorepants

View GitHub Profile
@moorepants
moorepants / Redox.r
Created December 4, 2010 17:48
Yumi's data analysis in R
# bring in the data
Redox = read.csv('Redox.csv', header=TRUE)
print(names(Redox))
# make an example plot for iron, PH average
ironsub = subset(Redox, trt == "High Fe(II)" | trt == "Low Fe(II)")
xlim = range(Redox$day, na.rm=TRUE)
ylim = range(Redox$pH, na.rm=TRUE)
@moorepants
moorepants / test.r
Created December 7, 2010 04:09
shows how to loop through a subset of columns
Redox=read.csv('Redox.csv', header=TRUE)
col = c("pH", "mmol.DOC", "SUVA", "mmol.fe2")
newRedox = Redox[col] # removes columns not in col
for(item in newRedox) # for each column in newRedox
{
ylim = range(item, na.rm=TRUE)
xlim = range(Redox$day, na.rm=TRUE)
@moorepants
moorepants / gist:1007366
Created June 3, 2011 23:33
Basic Matlab Animation
t = 0:0.001:1000;
x = cos(t);
y = sin(t);
fig = figure();
ax = axes();
hold on
dot1 = plot(x(1), y(1));
dot2 = plot(1.5 * x(1), 1.5 * y(2));
hold off
@moorepants
moorepants / gist:1098315
Created July 21, 2011 21:53
Aurelia's pydy code
from sympy import *
from sympy.physics.mechanics import *
theta, phi, omega, alpha = dynamicsymbols('theta phi omega alpha')
thetad, phid, omegad, alphad = dynamicsymbols('theta phi omega alpha', 1)
gravity = symbols('gravity')
m, l = symbols('m l')
I1, I2, I3 = symbols('I1, I2, I3')
@moorepants
moorepants / gist:1100050
Created July 22, 2011 18:24
problem that hangs in pydy
from sympy import *
from sympy.physics.mechanics import *
# the unknown steer torque
Tdelta = dynamicsymbols('Tdelta')
# constants we measure on the bicycle
d, ds1, ds3 = symbols('d ds1 ds2')
c = symbols('c')
@moorepants
moorepants / vimstuff
Created September 15, 2011 01:23
vim settings for luke
this is my html file that i keep in .vim/after/ftplugin
-------------------------------------------------------
set tabstop=2 " hard tab shows up as 2 spaces
set shiftwidth=2 " autoindent and >> make 2 spaces
set textwidth=79 " wrap lines after 79 characters
this is my vimrc
----------------
@moorepants
moorepants / whipple_transfer_functions.py
Created February 8, 2012 20:16
Whipple Model Transfer Functions
#!/usr/bin/env python
# This script calculates the numerators and denominator polynomials of the
# Whipple bicycle model tranfer functions as a function of the canonical matrix
# entries given in Meijaard2007.
import numpy as np
import matplotlib.pyplot as plt
from sympy import Symbol, Matrix, symbols, eye, zeros, roots, Poly
import uncertainties as un
@moorepants
moorepants / convert_cite.txt
Created August 8, 2012 17:30
vim command to convert my Sphinx citations to sphinxcontrib-bibtex format
%s/\[\(\w*\d\d\d\d\w*\)\]_/:cite:`\1`/gc
@moorepants
moorepants / readonly.py
Created August 16, 2012 18:25
read only property
class MainClass(object):
@property
def name(self):
if self.__class__ is MainClass:
return name
else:
#dont return, give error or warning
raise StandardError
@moorepants
moorepants / bicycle.bib
Created August 29, 2012 04:52
dissertation bib file
% This file was created with JabRef 2.8.1.
% Encoding: UTF8
@ARTICLE{Astrom1976,
author = {{\AA}str{\"o}m, Karl Johan and K{\"a}llstr{\"o}m, Claes},
title = {Identification on Ship Steering Dynamics},
journal = {Automatica},
year = {1976},
volume = {12},
pages = {9–22},