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

            There are no comments yet on this issue.

              People

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

                Dates

                Created:
                Updated: