@@ -150,7 +150,7 @@ def toDict(self):
150
150
return outDict
151
151
152
152
@classmethod
153
- def fromTable (cls , tableList ):
153
+ def fromTable (cls , tableList , ** kwargs ):
154
154
"""Construct calibration from a list of tables.
155
155
156
156
This method uses the `fromDict` method to create the
@@ -169,15 +169,40 @@ def fromTable(cls, tableList):
169
169
The calibration defined in the tables.
170
170
"""
171
171
dataTable = tableList [0 ]
172
-
173
172
metadata = dataTable .meta
173
+
174
+ # Dump useless entries that are carried over from merging
175
+ # HDU[0]'s header with the header from HDU[1] (which has the
176
+ # data table).
177
+ for key in ("SIMPLE" , "BITPIX" , "NAXIS" , "EXTEND" ):
178
+ metadata .pop (key )
179
+
180
+ # Do translations:
181
+ instrument = metadata .pop ("INSTRUME" , None )
182
+ location = metadata .pop ("LOCATN" , "NO_LOCATION" )
183
+
184
+ if instrument == "Electrometer_index_201" and location == "AuxTel" :
185
+ metadata ["INSTRUME" ] = "LATISS"
186
+ elif location == "MainTel" and instrument in ("Electrometer_index_101" ,
187
+ "Electrometer_index_102" ,
188
+ "Electrometer_index_103" ):
189
+ metadata ["INSTRUME" ] = "LSSTCam"
190
+ else :
191
+ # This will cause problems in ingest, but we don't know
192
+ # what to associate it with.
193
+ metadata ["INSTRUME" ] = instrument
194
+
174
195
inDict = {}
175
196
inDict ['metadata' ] = metadata
197
+
176
198
if 'OBSTYPE' not in metadata :
177
199
inDict ['metadata' ]['OBSTYPE' ] = cls ._OBSTYPE
178
200
inDict ['integrationMethod' ] = metadata .pop ('INTEGRATION_METHOD' , 'DIRECT_SUM' )
179
201
180
- for key in ('TIME' , 'Elapsed Time' , ):
202
+ # These will use the last column found, so "RNUM" (which is in
203
+ # seconds) will replace "Elapsed Time" (which is in integer
204
+ # sample counts) when both are found in the table.
205
+ for key in ('TIME' , 'Elapsed Time' , 'RNUM' ):
181
206
if key in dataTable .columns :
182
207
inDict ['timeSamples' ] = dataTable [key ]
183
208
for key in ('CURRENT' , 'Signal' , ):
0 commit comments