Commit 4c30aa98 authored by Maude Martin's avatar Maude Martin
Browse files

write_table dmc

parent 7c0f6c4c
......@@ -226,7 +226,7 @@ def read_cat (file):
return cat
def write_covmat(file, cov, nbmodes=None):
""" Write cl to file.
""" Write cov mat to file.
Parameters
----------
......@@ -253,5 +253,29 @@ def write_covmat(file, cov, nbmodes=None):
def write_table(file, tab):
""" Write table to file.
Parameters
----------
file: string, FITS file name or DMC object name
tab: array-like
"""
if __piolib(file):
try:
grpname = pio.GetGrpName(file)
checkgroup (grpname, "TAB2D")
grp = pio.OpenTAB2DGrp(grpname, "w")
val = pio.CreateTAB2DObject(file,'PIODOUBLE')
nr = shape(tab)[0]
nc = shape(tab)[1]
val = pio.WriteTAB2DObject(tab,file, 'PIO'+precision,"tab=0:%d,0:%d"%((nc-1),(nr-1)) , grp)
pio.CloseTAB2DGrp(grp)
except pio.pioError,val:
return str(val)
else:
sp.write_table(file, tab)
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