Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-5680

makePsfCandidate needs to be easier and safer to use

    XMLWordPrintable

    Details

      Description

      The following code can fail at getMaskedImage:

                  try:
                      psfCandidate = algorithmsLib.makePsfCandidate(star, exposure)
                  except Exception as err:
                      self.log.warn("Failed to make a psfCandidate from star %d: %s" % (star.getId(), err))
                      continue
                      
                  # The setXXX methods are class static, but it's convenient to call them on
                  # an instance as we don't know Exposure's pixel type
                  # (and hence psfCandidate's exact type)
                  if psfCandidate.getWidth() == 0:
                      psfCandidate.setBorderWidth(self.config.borderWidth)
                      psfCandidate.setWidth(self.config.kernelSize + 2*self.config.borderWidth)
                      psfCandidate.setHeight(self.config.kernelSize + 2*self.config.borderWidth)
       
                  im = psfCandidate.getMaskedImage().getImage()
      

      with an error such as:

      Box2I(Point2I(-2,1120),Extent2I(41,41)) doesn't fit in image 2048x4176...
      

      It is easy to wrap more of this code in a try/except block (and that is what we will do for now in starSelector.py) but it would be nice if the code was more robust and complained when the bad values were set, instead of later when the masked image was requested.

        Attachments

          Issue Links

            Activity

            rowen Russell Owen created issue -
            rowen Russell Owen made changes -
            Field Original Value New Value
            Link This issue is triggered by DM-5532 [ DM-5532 ]
            rowen Russell Owen made changes -
            Link This issue is triggered by DM-5663 [ DM-5663 ]
            rowen Russell Owen made changes -
            Epic Link DM-5053 [ 22713 ]
            rowen Russell Owen made changes -
            Team Alert Production [ 10300 ]
            Labels SciencePipelines
            rowen Russell Owen made changes -
            Epic Link DM-5053 [ 22713 ] DM-3543 [ 19632 ]
            rowen Russell Owen made changes -
            Team Alert Production [ 10300 ] Data Release Production [ 10301 ]
            rowen Russell Owen made changes -
            Link This issue relates to DM-5578 [ DM-5578 ]
            rowen Russell Owen made changes -
            Description The following code can fail at getMaskedImage:
            {code}
                        try:
                            psfCandidate = algorithmsLib.makePsfCandidate(star, exposure)
                        except Exception as err:
                            self.log.warn("Failed to make a psfCandidate from star %d: %s" % (star.getId(), err))
                            continue
                            
                        # The setXXX methods are class static, but it's convenient to call them on
                        # an instance as we don't know Exposure's pixel type
                        # (and hence psfCandidate's exact type)
                        if psfCandidate.getWidth() == 0:
                            psfCandidate.setBorderWidth(self.config.borderWidth)
                            psfCandidate.setWidth(self.config.kernelSize + 2*self.config.borderWidth)
                            psfCandidate.setHeight(self.config.kernelSize + 2*self.config.borderWidth)

                        im = psfCandidate.getMaskedImage().getImage()
            {code}
            with an error such as:
            {code}
            Box2I(Point2I(-2,1120),Extent2I(41,41)) doesn't fit in image 2048x4176...
            {code}
            It is easy to wrap more of this code in a try/except block (and that is what we will do for now in starSelector.py) but it would be nice if the code was more robust and complained when the bad values were set.

            Even better, I want a standalone function that made a PSF candidate with all this extra code. It is used in many places (even after DM-5532 consolidated it in star selectors). In fact the function {{makePsfCandidate}} is never called without all the rest of this code, except in one or two tests.
            The following code can fail at getMaskedImage:
            {code}
                        try:
                            psfCandidate = algorithmsLib.makePsfCandidate(star, exposure)
                        except Exception as err:
                            self.log.warn("Failed to make a psfCandidate from star %d: %s" % (star.getId(), err))
                            continue
                            
                        # The setXXX methods are class static, but it's convenient to call them on
                        # an instance as we don't know Exposure's pixel type
                        # (and hence psfCandidate's exact type)
                        if psfCandidate.getWidth() == 0:
                            psfCandidate.setBorderWidth(self.config.borderWidth)
                            psfCandidate.setWidth(self.config.kernelSize + 2*self.config.borderWidth)
                            psfCandidate.setHeight(self.config.kernelSize + 2*self.config.borderWidth)

                        im = psfCandidate.getMaskedImage().getImage()
            {code}
            with an error such as:
            {code}
            Box2I(Point2I(-2,1120),Extent2I(41,41)) doesn't fit in image 2048x4176...
            {code}
            It is easy to wrap more of this code in a try/except block (and that is what we will do for now in starSelector.py) but it would be nice if the code was more robust and complained when the bad values were set, instead of later when the masked image was requested.
            krughoff Simon Krughoff made changes -
            Epic Link DM-3543 [ 19632 ] DM-5691 [ 23683 ]
            swinbank John Swinbank made changes -
            Team Data Release Production [ 10301 ] Alert Production [ 10300 ]
            krughoff Simon Krughoff made changes -
            Epic Link DM-5691 [ 23683 ] DM-7362 [ 26448 ]
            krughoff Simon Krughoff made changes -
            Epic Link DM-7362 [ 26448 ] DM-8472 [ 28104 ]
            krughoff Simon Krughoff made changes -
            Epic Link DM-8472 [ 28104 ] DM-9680 [ 30785 ]
            swinbank John Swinbank made changes -
            Epic Link DM-9680 [ 30785 ] DM-10068 [ 31628 ]
            swinbank John Swinbank made changes -
            Epic Link DM-10068 [ 31628 ] DM-11798 [ 34281 ]
            swinbank John Swinbank made changes -
            Epic Link DM-11798 [ 34281 ] DM-12728 [ 36327 ]
            Parejkoj John Parejko made changes -
            Link This issue relates to RFC-477 [ RFC-477 ]
            swinbank John Swinbank made changes -
            Epic Link DM-12728 [ 36327 ] DM-14447 [ 80385 ]
            swinbank John Swinbank made changes -
            Epic Link DM-14447 [ 80385 ] DM-16722 [ 235355 ]
            swinbank John Swinbank made changes -
            Epic Link DM-16722 [ 235355 ] DM-17887 [ 240317 ]
            Parejkoj John Parejko made changes -
            Link This issue relates to DM-15121 [ DM-15121 ]
            swinbank John Swinbank made changes -
            Link This issue relates to DM-19155 [ DM-19155 ]
            swinbank John Swinbank made changes -
            Epic Link DM-17887 [ 240317 ] DM-19979 [ 307530 ]
            swinbank John Swinbank made changes -
            Epic Link DM-19979 [ 307530 ] DM-21441 [ 423048 ]
            swinbank John Swinbank made changes -
            Epic Link DM-21441 [ 423048 ] DM-22484 [ 427311 ]
            swinbank John Swinbank made changes -
            Epic Link DM-22484 [ 427311 ] DM-24339 [ 433026 ]
            swinbank John Swinbank made changes -
            Epic Link DM-24339 [ 433026 ] DM-25139 [ 435257 ]
            swinbank John Swinbank made changes -
            Epic Link DM-25139 [ 435257 ] DM-26810 [ 439762 ]
            sullivan Ian Sullivan made changes -
            Epic Link DM-26810 [ 439762 ] DM-27906 [ 442554 ]
            sullivan Ian Sullivan made changes -
            Epic Link DM-27906 [ 442554 ] DM-29214 [ 459218 ]
            sullivan Ian Sullivan made changes -
            Epic Link DM-29214 [ 459218 ] DM-30436 [ 504824 ]
            sullivan Ian Sullivan made changes -
            Epic Link DM-30436 [ 504824 ] DM-30501 [ 510159 ]
            sullivan Ian Sullivan made changes -
            Epic Link DM-30501 [ 510159 ] DM-30502 [ 510160 ]
            sullivan Ian Sullivan made changes -
            Epic Link DM-30502 [ 510160 ] DM-30506 [ 510172 ]
            horvat Nikolina Horvat made changes -
            Epic Link DM-30506 [ 510172 ] DM-34931 [ 1598492 ]
            sullivan Ian Sullivan made changes -
            Epic Link DM-34931 [ 1598492 ] DM-36006 [ 1997396 ]
            sullivan Ian Sullivan made changes -
            Epic Link DM-36006 [ 1997396 ] DM-36522 [ 2254239 ]
            Parejkoj John Parejko made changes -
            Link This issue relates to DM-27547 [ DM-27547 ]
            sullivan Ian Sullivan made changes -
            Epic Link DM-36522 [ 2254239 ] DM-36523 [ 2254240 ]
            sullivan Ian Sullivan made changes -
            Epic Link DM-36523 [ 2254240 ] DM-36524 [ 2254243 ]
            sullivan Ian Sullivan made changes -
            Epic Link DM-36524 [ 2254243 ] DM-36525 [ 2254245 ]

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              rowen Russell Owen
              Watchers:
              Jim Bosch, John Parejko, Paul Price, Russell Owen
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:

                  Jenkins

                  No builds found.