Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-14102 Use new makePsfCandidatesTask in test #27

Merged
merged 2 commits into from
May 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 0 additions & 2 deletions bin.src/psfex.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/usr/bin/env python
from __future__ import absolute_import, division, print_function
from builtins import range
import argparse
import os
import sys
Expand Down
1 change: 0 additions & 1 deletion config/psfex.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import absolute_import, division, print_function
import sys
from lsst.meas.extensions.psfex import PsfExStarSelectorTask

Expand Down
1 change: 0 additions & 1 deletion python/lsst/meas/extensions/psfex/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

"""lsst.meas.extensions.psfex
"""
from __future__ import absolute_import, division, print_function
from .version import *
from .field import *
from .prefs import *
Expand Down
11 changes: 2 additions & 9 deletions python/lsst/meas/extensions/psfex/psfex.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
#!/usr/bin/env python
from __future__ import absolute_import, division, print_function
from builtins import zip
from builtins import input
from builtins import str
from builtins import range
from builtins import object
import os
import re
import sys
Expand Down Expand Up @@ -367,10 +360,10 @@ def select_candidates(set, prefs, frmin, frmax,
try:
_dataType
except NameError:
class _SExtractor(object):
class _SExtractor():
pass

class _LSST(object):
class _LSST():
pass

_dataTypes = dict(LSST=_LSST,
Expand Down
2 changes: 0 additions & 2 deletions python/lsst/meas/extensions/psfex/psfexPsfDeterminer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import, division, print_function
from builtins import range
#
# LSST Data Management System
# Copyright 2008-2015 AURA/LSST.
Expand Down
6 changes: 1 addition & 5 deletions python/lsst/meas/extensions/psfex/psfexStarSelector.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
from __future__ import absolute_import, division, print_function
from builtins import zip
from builtins import input
from builtins import object
#
# LSST Data Management System
# Copyright 2008, 2009, 2010 LSST Corporation.
Expand Down Expand Up @@ -118,7 +114,7 @@ def setDefaults(self):
]


class EventHandler(object):
class EventHandler():
"""A class to handle key strokes with matplotlib displays"""

def __init__(self, axes, xs, ys, x, y, frames=[0]):
Expand Down
3 changes: 0 additions & 3 deletions python/lsst/meas/extensions/psfex/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
from __future__ import absolute_import, division, print_function
from builtins import input
from builtins import range
import re
import numpy as np
import pyfits
Expand Down
19 changes: 8 additions & 11 deletions tests/testPsfexPsf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python
#
# LSST Data Management System
#
Expand All @@ -21,9 +20,6 @@
# the GNU General Public License along with this program. If not,
# see <https://www.lsstcorp.org/LegalNotices/>.
#
from __future__ import absolute_import, division, print_function
from builtins import zip
from builtins import range
import math
import numpy as np
import unittest
Expand Down Expand Up @@ -217,7 +213,9 @@ def setupDeterminer(self, exposure):
]
starSelectorConfig.widthStdAllowed = 0.5 # Set to match when the tolerance of the test was set

starSelector = starSelectorClass(schema=self.schema, config=starSelectorConfig)
self.starSelector = starSelectorClass(schema=self.schema, config=starSelectorConfig)

self.makePsfCandidates = measAlg.MakePsfCandidatesTask()

psfDeterminerClass = measAlg.psfDeterminerRegistry["psfex"]
psfDeterminerConfig = psfDeterminerClass.ConfigClass()
Expand All @@ -226,9 +224,7 @@ def setupDeterminer(self, exposure):
psfDeterminerConfig.sizeCellY = height//3
psfDeterminerConfig.spatialOrder = 1

psfDeterminer = psfDeterminerClass(psfDeterminerConfig)

return starSelector, psfDeterminer
self.psfDeterminer = psfDeterminerClass(psfDeterminerConfig)

def subtractStars(self, exposure, catalog, chi_lim=-1):
"""Subtract the exposure's PSF from all the sources in catalog"""
Expand Down Expand Up @@ -265,11 +261,12 @@ def subtractStars(self, exposure, catalog, chi_lim=-1):
def testPsfexDeterminer(self):
"""Test the (Psfex) psfDeterminer on subImages"""

starSelector, psfDeterminer = self.setupDeterminer(self.exposure)
self.setupDeterminer(self.exposure)
metadata = dafBase.PropertyList()

psfCandidateList = starSelector.run(self.exposure, self.catalog).psfCandidates
psf, cellSet = psfDeterminer.determinePsf(self.exposure, psfCandidateList, metadata)
stars = self.starSelector.run(self.exposure, self.catalog)
psfCandidateList = self.makePsfCandidates.run(stars.starCat, exposure=self.exposure).psfCandidates
psf, cellSet = self.psfDeterminer.determinePsf(self.exposure, psfCandidateList, metadata)
self.exposure.setPsf(psf)

# Test how well we can subtract the PSF model
Expand Down