@@ -148,7 +148,7 @@ def test_covAstier(self):
148
148
extractConfig .doExtractPhotodiodeData = True
149
149
extractConfig .doKsHistMeasurement = True
150
150
extractConfig .auxiliaryHeaderKeys = ["CCOBCURR" , "CCDTEMP" ]
151
- extractTask = cpPipe .ptc .PhotonTransferCurveExtractTask (config = extractConfig )
151
+ extractPairTask = cpPipe .ptc .PhotonTransferCurveExtractPairTask (config = extractConfig )
152
152
153
153
# Create solve task config
154
154
solveConfig = self .defaultConfigSolve
@@ -167,7 +167,7 @@ def test_covAstier(self):
167
167
inputGain = self .gain
168
168
169
169
muStandard , varStandard = {}, {}
170
- expDict = {}
170
+ expHandles = []
171
171
expIds = []
172
172
pdHandles = []
173
173
idCounter = 0
@@ -190,7 +190,7 @@ def test_covAstier(self):
190
190
191
191
mockExpRef1 = PretendRef (mockExp1 )
192
192
mockExpRef2 = PretendRef (mockExp2 )
193
- expDict [ expTime ] = ((mockExpRef1 , idCounter ), ( mockExpRef2 , idCounter + 1 ))
193
+ expHandles . extend ((mockExpRef1 , mockExpRef2 ))
194
194
expIds .append (idCounter )
195
195
expIds .append (idCounter + 1 )
196
196
for ampNumber , ampName in enumerate (self .ampNames ):
@@ -201,8 +201,8 @@ def test_covAstier(self):
201
201
imStatsCtrl ,
202
202
mu1 ,
203
203
mu2 ,
204
- ) = extractTask .getImageAreasMasksStats (mockExp1 , mockExp2 )
205
- muDiff , varDiff , covAstier , rowMeanVariance = extractTask .measureMeanVarCov (
204
+ ) = extractPairTask .getImageAreasMasksStats (mockExp1 , mockExp2 )
205
+ muDiff , varDiff , covAstier , rowMeanVariance = extractPairTask .measureMeanVarCov (
206
206
im1Area , im2Area , imStatsCtrl , mu1 , mu2
207
207
)
208
208
muStandard .setdefault (ampName , []).append (muDiff )
@@ -231,30 +231,33 @@ def test_covAstier(self):
231
231
)
232
232
idCounter += 2
233
233
234
- resultsExtract = extractTask .run (
235
- inputExp = expDict ,
236
- inputDims = expIds ,
237
- inputPhotodiodeData = pdHandles ,
238
- )
234
+ # Divide out the pairs.
235
+ outputCovariances = []
236
+ for i in range (len (expHandles ) // 2 ):
237
+ inputExp = [expHandles [2 * i ], expHandles [2 * i + 1 ]]
238
+ inputDims = [expIds [2 * i ], expIds [2 * i + 1 ]]
239
+ inputPhotodiodeData = [pdHandles [2 * i ], pdHandles [2 * i + 1 ]]
240
+ results = extractPairTask .run (
241
+ inputExp = inputExp ,
242
+ inputDims = inputDims ,
243
+ inputPhotodiodeData = inputPhotodiodeData ,
244
+ )
245
+ outputCovariances .append (results .outputCovariance )
239
246
240
247
# Force the last PTC dataset to have a NaN, and ensure that the
241
248
# task runs (DM-38029). This is a minor perturbation and does not
242
- # affect the output comparison. Note that we use index -2 because
243
- # these datasets are in pairs of [real, dummy] to match the inputs
244
- # to the extract task.
245
- resultsExtract .outputCovariances [- 2 ].rawMeans ["C:0,0" ] = np .array ([np .nan ])
246
- resultsExtract .outputCovariances [- 2 ].rawVars ["C:0,0" ] = np .array ([np .nan ])
249
+ # affect the output comparison.
250
+ outputCovariances [- 1 ].rawMeans ["C:0,0" ] = np .array ([np .nan ])
251
+ outputCovariances [- 1 ].rawVars ["C:0,0" ] = np .array ([np .nan ])
247
252
248
253
# Force the next-to-last PTC dataset to have a decreased variance to
249
- # ensure that the outlier fit rejection works. Note that we use
250
- # index -4 because these datasets are in pairs of [real, dummy] to
251
- # match the inputs to the extract task.
252
- rawVar = resultsExtract .outputCovariances [- 4 ].rawVars ["C:0,0" ]
253
- resultsExtract .outputCovariances [- 4 ].rawVars ["C:0,0" ] = rawVar * 0.9
254
+ # ensure that the outlier fit rejection works.
255
+ rawVar = outputCovariances [- 2 ].rawVars ["C:0,0" ]
256
+ outputCovariances [- 2 ].rawVars ["C:0,0" ] = rawVar * 0.9
254
257
255
258
# Reorganize the outputCovariances so we can confirm they come
256
259
# out sorted afterwards.
257
- outputCovariancesRev = resultsExtract . outputCovariances [::- 1 ]
260
+ outputCovariancesRev = outputCovariances [::- 1 ]
258
261
259
262
# Some expected values for noise matrix, just to check that
260
263
# it was calculated.
@@ -299,10 +302,8 @@ def test_covAstier(self):
299
302
self .assertAlmostEqual (ptc .ptcTurnoff [amp ], ptc .rawMeans [amp ][- 1 ])
300
303
301
304
# Test that all the quantities are correctly ordered and
302
- # have not accidentally been masked. We check every other
303
- # output ([::2]) because these datasets are in pairs of
304
- # [real, dummy] to match the inputs to the extract task.
305
- for i , extractPtc in enumerate (resultsExtract .outputCovariances [::2 ]):
305
+ # have not accidentally been masked.
306
+ for i , extractPtc in enumerate (outputCovariances ):
306
307
self .assertFloatsAlmostEqual (
307
308
extractPtc .rawExpTimes [ampName ][0 ],
308
309
ptc .rawExpTimes [ampName ][i ],
@@ -825,6 +826,7 @@ def runGetGainFromFlatPair(self, correctionType="NONE"):
825
826
expIds .append (idCounter + 1 )
826
827
idCounter += 2
827
828
829
+ # This will test the full extract task.
828
830
resultsExtract = extractTask .run (
829
831
inputExp = expDict ,
830
832
inputDims = expIds ,
0 commit comments