Skip to content

Commit

Permalink
Handle multi-extension tables correctly.
Browse files Browse the repository at this point in the history
  • Loading branch information
czwa committed Oct 6, 2020
1 parent 111fe95 commit c9e4c79
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions python/lsst/ip/isr/calibType.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,13 +305,17 @@ def readFits(cls, filename):
tableList = []
tableList.append(Table.read(filename, hdu=1))
extNum = 2 # Fits indices start at 1, we've read one already.
try:
with warnings.catch_warnings("error"):
newTable = Table.read(filename, hdu=extNum)
tableList.append(newTable)
extNum += 1
except Exception:
pass
keepTrying = True

while keepTrying:
with warnings.catch_warnings():
warnings.simplefilter("error")
try:
newTable = Table.read(filename, hdu=extNum)
tableList.append(newTable)
extNum += 1
except Exception:
keepTrying = False

return cls.fromTable(tableList)

Expand Down

0 comments on commit c9e4c79

Please sign in to comment.