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-5922: Rework camera geometry to use the replacement for XYTransform #89

Merged
merged 4 commits into from
Sep 2, 2017
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
11 changes: 6 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ policy/tempfile*.tmp
python/lsst/meas/algorithms/version.py
tests/.tests
tests/data/psf*.*
tests/testPsfAttributes
tests/testSizeMagnitudeStarSelector
tests/testPsfCaching
tests/testImagePsf
tests/testWarpedPsf
tests/test_psfAttributes
tests/test_sizeMagnitudeStarSelector
tests/test_psfCaching
tests/test_imagePsf
tests/test_warpedPsf
ups/*.cfgc
python/lsst/meas/algorithms/version.py
.cache
13 changes: 7 additions & 6 deletions python/lsst/meas/algorithms/astrometrySourceSelector.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#
#
# LSST Data Management System
#
# Copyright 2008-2017 AURA/LSST.
#
#
# This product includes software developed by the
# LSST Project (http://www.lsst.org/).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the LSST License Statement and
# the GNU General Public License along with this program. If not,
#
# You should have received a copy of the LSST License Statement and
# 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
Expand Down Expand Up @@ -204,4 +204,5 @@ def _isGood(self, source):
and not source.get(self.interpolatedCenterKey) \
and not source.get(self.edgeKey)


sourceSelectorRegistry.register("astrometry", AstrometrySourceSelectorTask)
12 changes: 6 additions & 6 deletions python/lsst/meas/algorithms/coaddPsf/coaddPsfContinued.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#
#
# LSST Data Management System
#
# Copyright 2008-2017 AURA/LSST.
#
#
# This product includes software developed by the
# LSST Project (http://www.lsst.org/).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the LSST License Statement and
# the GNU General Public License along with this program. If not,
#
# You should have received a copy of the LSST License Statement and
# the GNU General Public License along with this program. If not,
# see <https://www.lsstcorp.org/LegalNotices/>.
#
from __future__ import absolute_import
Expand Down
12 changes: 6 additions & 6 deletions python/lsst/meas/algorithms/defects.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#
#
# LSST Data Management System
#
# Copyright 2008-2017 AURA/LSST.
#
#
# This product includes software developed by the
# LSST Project (http://www.lsst.org/).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the LSST License Statement and
# the GNU General Public License along with this program. If not,
#
# You should have received a copy of the LSST License Statement and
# the GNU General Public License along with this program. If not,
# see <https://www.lsstcorp.org/LegalNotices/>.
#
"""Support for image defects"""
Expand Down
20 changes: 10 additions & 10 deletions python/lsst/meas/algorithms/detection.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#
#
# LSST Data Management System
#
# Copyright 2008-2017 AURA/LSST.
#
#
# This product includes software developed by the
# LSST Project (http://www.lsst.org/).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the LSST License Statement and
# the GNU General Public License along with this program. If not,
#
# You should have received a copy of the LSST License Statement and
# the GNU General Public License along with this program. If not,
# see <https://www.lsstcorp.org/LegalNotices/>.
#
__all__ = ("SourceDetectionConfig", "SourceDetectionTask", "addExposures")
Expand Down Expand Up @@ -46,7 +46,7 @@ class SourceDetectionConfig(pexConfig.Config):
)
nSigmaToGrow = pexConfig.Field(
doc="Grow detections by nSigmaToGrow * sigma; if 0 then do not grow",
dtype=float, default=2.4, # 2.4 pixels/sigma is roughly one pixel/FWHM
dtype=float, default=2.4, # 2.4 pixels/sigma is roughly one pixel/FWHM
)
returnOriginalFootprints = pexConfig.Field(
doc="Grow detections to set the image mask bits, but return the original (not-grown) footprints",
Expand Down Expand Up @@ -276,7 +276,7 @@ def run(self, table, exposure, doSmooth=True, sigma=None, clearMask=True):
fpSets = self.detectFootprints(exposure=exposure, doSmooth=doSmooth, sigma=sigma,
clearMask=clearMask)
sources = afwTable.SourceCatalog(table)
table.preallocate(fpSets.numPos + fpSets.numNeg) # not required, but nice
table.preallocate(fpSets.numPos + fpSets.numNeg) # not required, but nice
if fpSets.negative:
fpSets.negative.makeSources(sources)
if self.negativeFlagKey:
Expand Down Expand Up @@ -357,7 +357,7 @@ def detectFootprints(self, exposure, doSmooth=True, sigma=None, clearMask=True):
# smooth using a Gaussian (which is separate, hence fast) of width sigma
# make a SingleGaussian (separable) kernel with the 'sigma'
psf = exposure.getPsf()
kWidth = (int(sigma * 7 + 0.5) // 2) * 2 + 1 # make sure it is odd
kWidth = (int(sigma * 7 + 0.5) // 2) * 2 + 1 # make sure it is odd
self.metadata.set("smoothingKernelWidth", kWidth)
gaussFunc = afwMath.GaussianFunction1D(sigma)
gaussKernel = afwMath.SeparableKernel(kWidth, kWidth, gaussFunc, gaussFunc)
Expand Down Expand Up @@ -452,7 +452,7 @@ def detectFootprints(self, exposure, doSmooth=True, sigma=None, clearMask=True):
fpSets.negative = None
else:
self.log.info("Detected %d negative sources to %g %s",
fpSets.numNeg, self.config.thresholdValue,
fpSets.numNeg, self.config.thresholdValue,
("DN" if self.config.thresholdType == "value" else "sigma"))

if display:
Expand Down
12 changes: 6 additions & 6 deletions python/lsst/meas/algorithms/findCosmicRaysConfig.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#
#
# LSST Data Management System
#
# Copyright 2008-2017 AURA/LSST.
#
#
# This product includes software developed by the
# LSST Project (http://www.lsst.org/).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the LSST License Statement and
# the GNU General Public License along with this program. If not,
#
# You should have received a copy of the LSST License Statement and
# the GNU General Public License along with this program. If not,
# see <https://www.lsstcorp.org/LegalNotices/>.
#
import lsst.pex.config as pexConfig
Expand Down
15 changes: 8 additions & 7 deletions python/lsst/meas/algorithms/flaggedStarSelector.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#
#
# LSST Data Management System
#
# Copyright 2008-2017 AURA/LSST.
#
#
# This product includes software developed by the
# LSST Project (http://www.lsst.org/).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the LSST License Statement and
# the GNU General Public License along with this program. If not,
#
# You should have received a copy of the LSST License Statement and
# the GNU General Public License along with this program. If not,
# see <https://www.lsstcorp.org/LegalNotices/>.
#
__all__ = ("FlaggedStarSelectorConfig", "FlaggedStarSelectorTask")
Expand Down Expand Up @@ -45,7 +45,7 @@ class FlaggedStarSelectorTask(BaseStarSelectorTask):
stars used to determine the PSF.
"""

usesMatches = False # This selector does not require a match to an external catalog
usesMatches = False # This selector does not require a match to an external catalog
ConfigClass = FlaggedStarSelectorConfig

def __init__(self, schema, **kwds):
Expand All @@ -59,4 +59,5 @@ def selectStars(self, exposure, sourceCat, matches=None):
starCat.append(record)
return lsst.pipe.base.Struct(starCat=starCat)


starSelectorRegistry.register("flagged", FlaggedStarSelectorTask)
18 changes: 9 additions & 9 deletions python/lsst/meas/algorithms/gaussianPsfFactory.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#
#
# LSST Data Management System
#
# Copyright 2008-2017 AURA/LSST.
#
#
# This product includes software developed by the
# LSST Project (http://www.lsst.org/).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the LSST License Statement and
# the GNU General Public License along with this program. If not,
#
# You should have received a copy of the LSST License Statement and
# the GNU General Public License along with this program. If not,
# see <https://www.lsstcorp.org/LegalNotices/>.
#
from __future__ import absolute_import, division
Expand Down Expand Up @@ -53,8 +53,8 @@ class GaussianPsfFactory(Config):
check=isPositive,
)
sizeFactor = Field(
doc="Kernel size as a factor of fwhm (dimensionless); "
+ "size = sizeFactor * fwhm; ignored if size is not None",
doc = "Kernel size as a factor of fwhm (dimensionless); " +
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't think the spaces should be there for keyword args?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I don't think the space needs to be there at all does it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe spaces around = for keyword arguments are:

  • encouraged for keyword arguments that are on their own line
  • discouraged for other cases

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked, and @r-owen is correct according to the style guide. This makes me sad; I don't think whitespace around = should be affected at all by how we split lines. But I also don't have the energy to RFC a change.

"size = sizeFactor * fwhm; ignored if size is not None",
dtype=float,
optional=False,
default=3.0,
Expand Down Expand Up @@ -119,7 +119,7 @@ def computeSizeAndSigma(self, fwhm=None):
if self.size is not None:
size = self.size
else:
desSize = (int(self.sizeFactor * fwhm) // 2) * 2 + 1 # make result odd
desSize = (int(self.sizeFactor * fwhm) // 2) * 2 + 1 # make result odd
if self.minSize and self.minSize > desSize:
size = self.minSize
elif self.maxSize and self.maxSize < desSize:
Expand Down
30 changes: 15 additions & 15 deletions python/lsst/meas/algorithms/htmIndexer.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#
#
# LSST Data Management System
#
# Copyright 2008-2017 AURA/LSST.
#
#
# This product includes software developed by the
# LSST Project (http://www.lsst.org/).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the LSST License Statement and
# the GNU General Public License along with this program. If not,
#
# You should have received a copy of the LSST License Statement and
# 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
Expand Down Expand Up @@ -62,12 +62,12 @@ def index_points(self, ra_list, dec_list):

@staticmethod
def make_data_id(pixel_id, dataset_name):
"""!Make a data id. Meant to be overridden.
@param[in] pixel_id An identifier for the pixel in question.
@param[in] dataset_name Name of the dataset to use.
@param[out] dataId (dictionary)
"""
if pixel_id is None:
# NoneType doesn't format, so make dummy pixel
pixel_id = 0
return {'pixel_id': pixel_id, 'name':dataset_name}
"""!Make a data id. Meant to be overridden.
@param[in] pixel_id An identifier for the pixel in question.
@param[in] dataset_name Name of the dataset to use.
@param[out] dataId (dictionary)
"""
if pixel_id is None:
# NoneType doesn't format, so make dummy pixel
pixel_id = 0
return {'pixel_id': pixel_id, 'name': dataset_name}