Details
-
Type:
Story
-
Status: Done
-
Resolution: Done
-
Fix Version/s: None
-
Component/s: ip_isr
-
Labels:
-
Story Points:0.5
-
Epic Link:
-
Sprint:Alert Production S17 - 2
-
Team:Alert Production
Description
E.g. when running ip_isr's examples/runAssembleTask.py:
Traceback (most recent call last):
|
File "runAssembleTask.py", line 36, in <module>
|
runAssembler()
|
File "runAssembleTask.py", line 21, in runAssembler
|
assembledExposure = assembleTask.assembleCcd(assemblyInput)
|
File "/scratch/swinbank/ip_isr/python/lsst/ip/isr/assembleCcdTask.py", line 200, in assembleCcd
|
ccd = next(assembleInput.values()).getDetector()
|
TypeError: list object is not an iterator
|
Looks like a bad conversion to Python 3: it assumes that dict.values() returns an iterator, but in Python 2 it returns a list. Simple (but ugly) fix:
--- a/python/lsst/ip/isr/assembleCcdTask.py
|
+++ b/python/lsst/ip/isr/assembleCcdTask.py
|
@@ -197,7 +197,7 @@ class AssembleCcdTask(pipeBase.Task):
|
ccd = None
|
if hasattr(assembleInput, "has_key"):
|
# Get a detector object for this set of amps
|
- ccd = next(assembleInput.values()).getDetector()
|
+ ccd = next(iter(assembleInput.values())).getDetector()
|
# Sent a dictionary of input exposures, assume one amp per key keyed on amp name
|
|
def getNextExposure(amp):
|
Better suggestions welcome.
Rather shocking that this wasn't caught by tests. Sufficiently shocking that I'm wondering if I missed something. I suggest that rather than just committing the above tweak, this ticket should include a test which demonstrates that the task actually runs. An easy way to do that might be to simply migrate a slightly modified version of the code from examples/ to tests/.
PS This ticket is duplicated now by https://jira.lsstcorp.org/browse/DM-9370 which I just filed. Not sure whether to delete that or what, but presumable John Swinbank can help me clean up the mess :/