I hereby claim:
- I am dmeliza on github.
- I am dmeliza (https://keybase.io/dmeliza) on keybase.
- I have a public key whose fingerprint is 01EC 589A D750 9ADA B42C 7B72 F275 EE6B C700 7DBB
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
def natsorted(key): | |
""" key function for natural sorting. usage: sorted(seq, key=natsorted) """ | |
import re | |
return map(lambda t: int(t) if t.isdigit() else t, re.split(r"([0-9]+)",key)) |
# -*- coding: utf-8 -*- | |
# -*- mode: python -*- | |
# Adapted from mpl_toolkits.axes_grid1 | |
# LICENSE: Python Software Foundation (http://docs.python.org/license.html) | |
from matplotlib.offsetbox import AnchoredOffsetbox | |
class AnchoredScaleBar(AnchoredOffsetbox): | |
def __init__(self, transform, sizex=0, sizey=0, labelx=None, labely=None, loc=4, | |
pad=0.1, borderpad=0.1, sep=2, prop=None, barcolor="black", barwidth=None, | |
**kwargs): |
# two python functions to extract field names from sqlite3 database tables | |
def schema_fields(schema): | |
""" | |
Extract fields defined in a (sqlite3) table schema. | |
schema: string with CREATE TABLE statement for the table | |
returns tuple of field names | |
raises ValueError, if parsing failed |
def axgriditer(gridfun=None, figfun=None, **figparams): | |
""" | |
Generator for making a series of plots to multiple axes in multiple figures. | |
This function provides a coroutine to handle tasks involved in | |
creating a figure with one or more axes and saving the figure when | |
all the axes have been used (or all the data has been used), | |
repeating as needed. | |
Keyword arguments: |
##' Read tabular data in org format | |
##' | |
##' Reads data stored in org tables, which have '|' characters and | |
##' whitespace separating columns. Uses GNU sed to select lines that | |
##' start with '| ' (which excludes hlines), replaces separators and | |
##' excess whitespace with tabs, and passes the stream to | |
##' read.table. Missing fields will be NA in numeric columns and empty | |
##' in character columns. It's recommended to use quote="" to avoid | |
##' nasty parsing errors if there are quotation marks in the table. | |
##' |