Commit 222de2b8 authored by Maude Le Jeune's avatar Maude Le Jeune
Browse files

add hdu option to read_table

parent 5a78c454
......@@ -132,7 +132,7 @@ def write_covmat (filename, covmat):
tbhdu.writeto(filename)
def read_table (filename, startcol=1, lastcol=None):
def read_table (filename, startcol=1, lastcol=None, hdu=1):
""" Read table from FITS file.
Parameters
......@@ -146,12 +146,12 @@ def read_table (filename, startcol=1, lastcol=None):
"""
hdulist = pyfits.open(filename)
ncols = len(hdulist[1].columns.names)-startcol+1
nrows = shape(hdulist[1].data.field(0))[0]
ncols = len(hdulist[hdu].columns.names)-startcol+1
nrows = shape(hdulist[hdu].data.field(0))[0]
mat = zeros((nrows, ncols))
for c in range(ncols):
mat[:,c] = hdulist[1].data.field(c+startcol-1)
mat[:,c] = hdulist[hdu].data.field(c+startcol-1)
hdulist.close()
return mat
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment