Skip to content

Instantly share code, notes, and snippets.

Matt Davis jiffyclub

Block or report user

Report or block jiffyclub

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jiffyclub
jiffyclub / imhead.py
Created Nov 28, 2011
Python 2.3+ script for printing a FITS header. Accepts multiple files and, optionally, keywords. This is a wrapper around pyfits.getheader to make it accessible from the command line.
View imhead.py
#!/usr/bin/env python
"""
Print a FITS header or keyword. Type imhead.py -h for help.
Requires pyfits.
Author
------
@jiffyclub
git.io/jiffyclub
@jiffyclub
jiffyclub / aiclass_nlp1.py
Created Dec 18, 2011
Python decoder for part one of the www.ai-class.com Natural Language Processing problem.
View aiclass_nlp1.py
"""
This code is for part one the AI Class optional Natural Language Processing
programming assignment. See youtu.be/KuSg1wcty3s for the complete problem
definition.
We are given a string which has been encoded with a Caesar cipher:
http://en.wikipedia.org/wiki/Caesar_cipher, and our job is to decode it.
You could do this by brute force, simply print out each shift of the letters
and look for the correct one by eye.
@jiffyclub
jiffyclub / aiclass_nlp2-1.py
Created Dec 20, 2011
Python, grammar based solution for part two of www.ai-class.com Natural Language Processing problem.
View aiclass_nlp2-1.py
"""
This code is for part two of the AI Class optional Natural Language Processing
programming assignment. See youtu.be/KuSg1wcty3s for the complete problem
definition.
We are given a sentence that spans several lines and has been shredded
vertically so that there are 2 characters in each column. The columns are
arranged in random order and it's our job to assemble them into the correct
order.
@jiffyclub
jiffyclub / aiclass_nlp2-2.py
Created Dec 20, 2011
Python, dictionary based solution for part two of www.ai-class.com Natural Language Processing problem.
View aiclass_nlp2-2.py
"""
This code is for part two of the AI Class optional Natural Language Processing
programming assignment. See youtu.be/KuSg1wcty3s for the complete problem
definition.
We are given a sentence that spans several lines and has been shredded
vertically so that there are 2 characters in each column. The columns are
arranged in random order and it's our job to assemble them into the correct
order.
View helmet_test.py
"""
Check helmet test data for Software Carpentry.
"""
import sys
from collections import namedtuple
HelmetTest = namedtuple('HelmetTest', ['temp', 'time', 'brittle'])
@jiffyclub
jiffyclub / NumpyLesson.ipynb
Created Jun 1, 2012
NumPy IPython Notebook - 31 May, 2012
View NumpyLesson.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jiffyclub
jiffyclub / temperatures.txt
Created Jun 7, 2012
SWC Tutorial Data - June 7, 2012
View temperatures.txt
YEAR,AUS Temp,CAN Temp
1901,21.357021,-7.672419
1902,21.382462,-7.862711
1903,20.936884,-7.910783
1904,20.791357,-8.155729
1905,20.954510,-7.547311
1906,21.767315,-7.684103
1907,21.051441,-8.413553
1908,20.649048,-7.790929
1909,20.812077,-8.239306
@jiffyclub
jiffyclub / tutorial_2012-06-07.ipynb
Created Jun 7, 2012
SWC Tutorial Notebook - June 7, 2012
View tutorial_2012-06-07.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jiffyclub
jiffyclub / fuzzy_between.py
Created Jun 7, 2012
Test whether a value is within some range with some fuzziness at the edges to allow for floating point noise.
View fuzzy_between.py
import numpy as np
def fuzzy_between(val, minval, maxval, fuzz=2, inclusive=True):
"""
Test whether a value is within some range with some fuzziness at the edges
to allow for floating point noise.
The fuzziness is implemented by expanding the range at each end `fuzz` steps
using the numpy.nextafter function. For example, with the inputs
minval = 1, maxval = 2, and fuzz = 2; the range would be expanded to
@jiffyclub
jiffyclub / ProfileDemo.ipynb
Created Jul 6, 2012
Examples of timing and profiling Python code using built-in tools and IPython. Requires IPython 0.13+.
View ProfileDemo.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
You can’t perform that action at this time.