Skip to content

Instantly share code, notes, and snippets.

Avatar

Thomas A Caswell tacaswell

  • Brookhaven National Lab
  • New York
View GitHub Profile
View uneven_fft.py
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
View stack_bar.py
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`
View quiver_param.py
# 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 Aug 29, 2015
draft of xraylib wrapping and new Element class
View xraylib_draft.py
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, },
View vt_addmod.py
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 Sep 4, 2014
condarc_for_travis
View .condarc
channels:
- tacaswell
- defaults
@tacaswell
tacaswell / demo.py
Last active Aug 29, 2015
pandas play
View demo.py
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)
View fb_demo.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View Simple Broker Demo.ipynb
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 Aug 29, 2015
Notebook demonstrating Tupper's Self-Referential Formula
View tupper.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.