# makePsfCandidate needs to be easier and safer to use

XMLWordPrintable

#### Details

• Type: Story
• Status: To Do
• Resolution: Unresolved
• Fix Version/s: None
• Component/s:
• Labels:
• Team:

#### 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.

#### Activity

There are no comments yet on this issue.

#### People

Assignee:
Unassigned
Reporter:
Russell Owen
Watchers:
Jim Bosch, Paul Price, Russell Owen