This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def add_range_annotation(ax, start, end, txt_str, y_height=.5, txt_kwargs=None, arrow_kwargs=None): | |
""" | |
Adds horizontal arrow annotation with text in the middle | |
Parameters | |
---------- | |
ax : matplotlib.Axes | |
The axes to draw to | |
start : float |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun tac-python-header () | |
(interactive "*") | |
(occur "^\\s-*\\(\\(class\\)\\|\\(def\\)\\)\\|\\(@\\)") | |
) | |
(define-skeleton py-np-def | |
"Skeleton for function definition that includes numppydoc style " | |
"Name: " | |
"def " str "(" ("Parameter, %s: " (unless (equal ?\( (char-before)) ", ") | |
str) "):" \n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import string | |
from itertools import cycle | |
from six.moves import zip | |
def label_axes(fig, labels=None, loc=None, **kwargs): | |
""" | |
Walks through axes and labels each. | |
kwargs are collected and passed to `annotate` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
if [ -a $1/bin/conda ]; then | |
# we are in a conda env | |
# save old QT_PLUGIN_PATH | |
OLD_QT=$QT_PLUGIN_PATH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
channels: | |
- tacaswell | |
- defaults |