Skip to content

Instantly share code, notes, and snippets.

View tacaswell's full-sized avatar

Thomas A Caswell tacaswell

View GitHub Profile
class uneven_FFT_recon(object):
"""
A class to wrap up dealing with the irregularly sampled periodic
data
"""
@classmethod
def reconstruct_iterative(cls, phi, h, target_error,
start_N=3, bound_N=15, iters=25):
"""
reconstruct a band-limited a curve from unevenly
@tacaswell
tacaswell / stack_bar.py
Created July 6, 2014 01:10
stacked bar
import numpy as np
import matplotlib.pyplot as plt
from itertools import cycle
from six.moves import zip
def stack_bar(ax, list_of_vals, color_cyle=None, **kwargs):
"""
Generalized stacked bar graph.
kwargs are passed through to the call to `bar`
# this bit of code makes sure that the head stays a fixed size in terms of
# axes fractions. To tune this size change `head_size`
head_size = 30
# to tun the ratio between the head size and the shaft, change `ascale`
ascale = .2
# tunes how 'pinched' the arrow head is, < 1 and the bottom will be indented
# > 1 the arrow will be a distorted diamond
pinched = .7
@tacaswell
tacaswell / xraylib_draft.py
Last active August 29, 2015 14:05
draft of xraylib wrapping and new Element class
from collections import Mapping
import six
_XRAYLIB_MAP_MAP = {'edges': ({'Ka1': xraylib.KALPHA,..}, xraylib.CS_FlourLine),
'levels': ({'K': xraylib.K, }),
}
_OTHER_VALUES = {'H': {'Z': 1, 'rho': .524, },
from vistrails import api
csv = api.add_module(100, 100, 'org.vistrails.vistrails.tabledata', 'CSVFile', 'read')
fd = api.add_module(65, 50, 'org.vistrails.vistrails.url', 'DownloadFile', '')
api.add_connection(fd.id, 'file', csv.id, 'file')
api.change_parameter(fd.id, 'url',['http://www.vistrails.org/download/download.php?type=DATA&id=citibike_from_launch.csv'])
@tacaswell
tacaswell / .condarc
Created September 4, 2014 21:59
condarc_for_travis
channels:
- tacaswell
- defaults
@tacaswell
tacaswell / demo.py
Last active August 29, 2015 14:06
pandas play
import pandas as pd
from datetime import datetime, timedelta
dt = timedelta(seconds=1)
base_time = datetime(2014, 9, 24, 10, 5, 30)
indx1 = [base_time + j * dt for j in range(0, 10)]
indx2 = [base_time + j * dt for j in range(0, 10, 2)]
ds1 = pd.Series(5, index=indx1)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tacaswell
tacaswell / tupper.ipynb
Last active August 29, 2015 14:19
Notebook demonstrating Tupper's Self-Referential Formula
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.