Monday, August 16, 2010

Neat new things....

1. sptool is a quick way to compare standards to stellar spectra. Nice, I'd been looking for a tool like that.
2. GNU screen captions are useful especially when working in a screen-within-a-screen environment (who does that, really?)
3. finally got SPLAT to work... turns out I just hadn't reduced my damned data
4. kill -STOP and kill -CONT are really useful ways to pause programs that are sucking up resources if you want to resume them later. Haven't tried this on "real" code yet.

Friday, August 13, 2010

Filled step plots in matplotlib

It's not possible to do a simple filled step plot in matplotlib using default
commands. Workaround:


def steppify(arr,isX=False,interval=0):
    """
    Converts an array to double-length for step plotting
    """
    if isX and interval==0:
        interval = abs(arr[1]-arr[0]) / 2.0
        newarr = array(zip(arr-interval,arr+interval)).ravel()
        return newarr

plot(xx,yy,linestyle='steps-mid',color='b',linewidth=1.5)
fill_between(steppify(xx[x1:x2],isX=True),
    steppify(yy[x1:x2])*0,
    steppify(yy[x1:x2]),
    facecolor='b',alpha=0.2)