Skip to content

Instantly share code, notes, and snippets.

View taldcroft's full-sized avatar

Tom Aldcroft taldcroft

View GitHub Profile
@taldcroft
taldcroft / pytables_examples.py
Created May 18, 2012 19:17
PyTables example
import tables
def make_h5_file(dat, filename, colname, n_rows):
"""Make a new HDF5 table to hold numpy array data ``dat``
"""
filters = tables.Filters(complevel=5, complib='zlib')
h5 = tables.openFile(filename, mode='w', filters=filters)
h5shape = (0,) + dat.shape[1:]
h5type = tables.Atom.from_dtype(dat.dtype)
@taldcroft
taldcroft / xija_define.py
Created May 18, 2012 21:29
Xija - defining model
import xija
# Create Xija model named "dpa" (Digital Processor Assembly)
mdl = xija.ThermalModel('dpa')
# Add node for DPA temperature 1DPAMZT in telemetry
dpamzt = mdl.add(xija.Node, '1dpamzt')
simz = mdl.add(xija.SimZ) # Science Instrument Module posn
pitch = mdl.add(xija.Pitch) # Sun angle w/r/t spacecraft
core_ext = Extension('xija.core', ['xija/core.c'])
setup(name='xija',
version=version,
description='Thermal modeling framework for Chandra',
author='Tom Aldcroft',
author_email='[email protected]',
url='https://github.com/sot/xija',
license='BSD',
platforms=['any'],
@taldcroft
taldcroft / embed_gtk.py
Created May 21, 2012 01:47
embed gtk in matplotlib example
import gtk
import numpy as np
from matplotlib.figure import Figure
from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg
win = gtk.Window()
win.connect("destroy", lambda x: gtk.main_quit())
win.set_default_size(400,300)
@taldcroft
taldcroft / header_chars.py
Created July 30, 2012 18:32
Find header character sets used in a list of RST files
#!/usr/bin/env python
"""
Find the sets of characters used in RST section headers. For input like
::
##########
header
##########
Section
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@taldcroft
taldcroft / idl_python_jug.ipynb
Last active December 11, 2015 10:29
IDL Python Jugalbandi
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@taldcroft
taldcroft / binop.py
Created January 25, 2013 15:13
Expression evaluation
import operator
class Query(object):
def __init__(self, name, val=None, left=None, right=None, op=None):
self.name = name
self.val = val
self.left = left
self.right = right
self.op = op
@taldcroft
taldcroft / test_new_col.ipynb
Created February 4, 2013 22:08
Test auto-creation of new columns in astropy.table
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@taldcroft
taldcroft / ACE_ratios.ipynb
Last active December 12, 2015 05:48
Ratio of ACE channels investigation
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.