Skip to content

Commit

Permalink
load TUNITS directly
Browse files Browse the repository at this point in the history
  • Loading branch information
tapastro committed Dec 4, 2023
1 parent d3d37c4 commit 5b81bc4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/stdatamodels/jwst/datamodels/multispec.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from .model_base import JwstDataModel
from .spec import SpecModel
from astropy.io import fits


__all__ = ['MultiSpecModel']
Expand Down Expand Up @@ -57,3 +58,13 @@ def __init__(self, init=None, **kwargs):
return

super(MultiSpecModel, self).__init__(init=init, **kwargs)

try:
if init[1].name == 'EXTRACT1D':
for key in init[1].header.keys():
if 'TUNIT' in key:
col = int(key.split('TUNIT')[1]) - 1
for spec in self.spec:
spec.spec_table.columns[col].unit = init[1].header[key]
except (AttributeError, IndexError) as e:
pass

0 comments on commit 5b81bc4

Please sign in to comment.