Skip to content

Instantly share code, notes, and snippets.

View moorepants's full-sized avatar

Jason K. Moore moorepants

View GitHub Profile
@moorepants
moorepants / meta-020.yml
Created November 26, 2014 18:19
Example meta data file for the perturbed walking paper.
study:
id: 1
name: Gait Control Identification
description: Perturb the subject during walking and running.
subject:
id: 8
age: 20
mass: 70
mass-units: kilograms
height: 1.572
@moorepants
moorepants / numbify.ipynb
Created February 15, 2015 16:08
Compares numba to sympy ufuncify.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@moorepants
moorepants / drop.py
Last active August 29, 2015 14:15
A simple physics example in SymPy.
import sympy as sm
g, tf, x0 = sm.symbols('g, tf, x0', real=True, positive=True)
t, vf = sm.symbols('t, vf', real=True)
x, v = sm.symbols('x, v', cls=sm.Function)
accel = sm.Eq(x(t).diff(t, 2), -g)
position = sm.dsolve(accel, x(t))
C1, C2, _, _ = list(sm.ordered(position.free_symbols))
velocity = sm.dsolve(accel.subs({x(t).diff(t): v(t)}), v(t))
@moorepants
moorepants / svg_to_matplotlib.py
Created March 4, 2015 19:42
Trying to port SVG Bezier paths to matplotlib
import matplotlib.pyplot as plt
from matplotlib.path import Path
import matplotlib.patches as patches
s = "m 369.01724,467.04725 c -0.18526,2.57511 0.025,3.71002 -0.74575,6.17343 -1.53222,4.89942 -7.46833,7.60079 -8.99133,12.50302 -1.75723,5.65693 -0.76258,11.95174 0.37357,17.76566 1.34911,6.90236 5.61166,12.84732 7.04916,19.73262 0.66711,3.19499 0.60249,6.59014 -0.27085,9.73526 -0.9587,3.45198 -3.089,5.23513 -4.4528,8.54866 -1.21939,2.96186 -2.15924,6.50136 -1.66722,9.6668 0.55788,3.58921 2.31624,7.05338 4.75882,9.74186 0.76564,0.84272 2.2695,1.96683 3.33049,2.37969 2.95478,1.1512 6.02208,1.86489 9.19306,1.87852 3.3538,0.0148 6.69086,-0.81148 9.68045,-2.33079 1.6753,-0.85214 2.95914,-3.06572 3.55483,-4.84835 1.59252,-4.76535 -0.99967,-9.16932 -1.47916,-14.171 -0.65213,-6.80233 -2.15122,-13.65888 -1.41097,-20.45291 0.4785,-4.39107 3.41465,-8.30725 3.73802,-12.71261 0.23998,-3.26968 -0.68483,-6.32005 -0.14903,-9.55505 0.32782,-1.97814 1.27144,-3.56144 1.49529,-5.55522 0.30253,-2.69162 -0.67713,-5.5023 -1.9641
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@moorepants
moorepants / INSTALL.txt
Created March 21, 2015 05:51
Notes on windows install for the perturbed gait data paper
Windows Install Instructions
- Install msysgit from http://msysgit.github.io/
default options
Use Git from Git Bash Only
CHeckout windows-style, commit unix-style line endings
Install Anaconda from continuum.io/downloads
- select install for "Just Me"
- check "add anaconda to my PATH environment variable"
@moorepants
moorepants / simplified_leg.py
Created April 9, 2015 21:53
Simple model to think about gait dynamics and control.
"""This is just a derivation of the model described here:
http://www.moorepants.info/notebook/notebook-2014-04-23.html
"""
from sympy import symbols
import sympy.physics.mechanics as me
mass_treadmill, mass_foot, mass_shank = symbols('m_t, m_f, m_s')
joint_stiffness, joint_damping = symbols('k, c')
gravity = symbols('g')
@moorepants
moorepants / eom_formulation.py
Last active August 29, 2015 14:21
Tracking down a bug in the PyDy code gen.
import sympy as sm
import numpy as np
from pydy.models import n_link_pendulum_on_cart
from pydy.codegen.ode_function_generators import generate_ode_function
sys = n_link_pendulum_on_cart(10, True, True)
x = np.random.random(len(sys.coordinates) + len(sys.speeds))
t = 0.0
r = np.random.random(len(sys.specifieds_symbols))
@moorepants
moorepants / forced_vibrations_with_viscous_damping.ipynb
Last active August 29, 2015 14:22
Forced Vibrations with Viscous Damping
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.