[PIPE2D-1130] The first argument of calls to FluxTableTask.run() should have the same length as the second one Created: 13/Dec/22  Updated: 15/Dec/22  Resolved: 15/Dec/22

Status: Done
Project: DRP 2-D Pipeline
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Normal
Reporter: sogo.mineo Assignee: sogo.mineo
Resolution: Done Votes: 0
Labels: flux-calibration
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Reviewers: price

 Description   

Yamashita-san reported this error:

 File "/data22b/work/takuji/new_pfs_pipeline/drp_stella/python/pfs/drp/stella/fitFluxCal.py", line 98, in runDataRef
  ss.fluxTable = self.fluxTable.run([ref.dataId for ref in armRefList],
 File "/data22b/work/takuji/new_pfs_pipeline/drp_stella/python/pfs/drp/stella/FluxTableTask.py", line 39, in run
  return makeFluxTable(identities, spectra, flags, self.config.ignoreFlags,
 File "/data22b/work/takuji/new_pfs_pipeline/drp_stella/python/pfs/drp/stella/makeFluxTable.py", line 151, in makeFluxTable
  raise RuntimeError("Length mismatch: %d vs %d" % (len(identities), len(spectra)))
RuntimeError: Length mismatch: 4 vs 2

fitFluxCal.py:98 is among the lines copied from fluxCalibrate.py:

for ff in pfsMerged.fiberId:
    extracted = pfsMerged.extractFiber(PfsSingle, pfsConfig, ff)
    extracted.fluxTable = self.fluxTable.run(
        [ss.identity.getDict() for ss in calibrated],  # (A)
        [pfsArmList[ii].extractFiber(PfsSingle, pfsConfig, ff) for ii in fiberToArm[ff]],  # (B)
        MaskHelper.fromMerge([pfsArm.flags for pfsArm in pfsArmList]),
    )
    extracted.metadata = getPfsVersions()

FluxTableTask.run() expects that (A) has the same length as (B), but apparently it doesn't. This and the corresponding segment in fitFluxCal.py should be modified like this:

 for ff in pfsMerged.fiberId:
     extracted = pfsMerged.extractFiber(PfsSingle, pfsConfig, ff)
     extracted.fluxTable = self.fluxTable.run(
-        [ss.identity.getDict() for ss in calibrated],
+        [calibrated[ii].identity.getDict() for ii in fiberToArm[ff]],
         [pfsArmList[ii].extractFiber(PfsSingle, pfsConfig, ff) for ii in fiberToArm[ff]],
         MaskHelper.fromMerge([pfsArm.flags for pfsArm in pfsArmList]),
     )
     extracted.metadata = getPfsVersions()


 Comments   
Comment by sogo.mineo [ 14/Dec/22 ]

Could you review this PR?

Comment by sogo.mineo [ 15/Dec/22 ]

Merged. Thank you for the review.

Generated at Sat Feb 10 16:03:10 JST 2024 using Jira 8.3.4#803005-sha1:1f96e09b3c60279a408a2ae47be3c745f571388b.