-
Notifications
You must be signed in to change notification settings - Fork 4
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-16490: Update computeCcdOffsets() to use makeSkyWcs #17
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
# See COPYRIGHT file at the top of the source tree. | ||
# | ||
# This file is part of fgcmcal. | ||
# | ||
# Developed for the LSST Data Management System. | ||
# This product includes software developed by the LSST Project | ||
# (https://www.lsst.org). | ||
# See the COPYRIGHT file at the top-level directory of this distribution | ||
# for details of code ownership. | ||
# | ||
# 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 GNU General Public License | ||
# along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
"""Test the fgcmcal computeCcdOffsets code with testdata_jointcal. | ||
""" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. extra line? |
||
|
||
import unittest | ||
import os | ||
|
||
import lsst.utils | ||
import lsst.daf.persistence as dafPersist | ||
|
||
import lsst.fgcmcal as fgcmcal | ||
|
||
|
||
class FgcmCcdOffsetsTest(lsst.utils.tests.TestCase): | ||
@classmethod | ||
def setUpClass(cls): | ||
try: | ||
cls.dataDir = lsst.utils.getPackageDir('testdata_jointcal') | ||
except lsst.pex.exceptions.NotFoundError: | ||
raise unittest.SkipTest("testdata_jointcal not setup") | ||
|
||
def test_fgcmCcdOffsetsHsc(self): | ||
""" | ||
Test computation of ccd offsets for HSC. | ||
""" | ||
|
||
lsst.log.setLevel("HscMapper", lsst.log.FATAL) | ||
|
||
butler = dafPersist.Butler(os.path.join(self.dataDir, 'hsc')) | ||
|
||
visit = 903986 | ||
ccd = 16 | ||
|
||
visitInfo = butler.get('calexp_visitInfo', visit=visit, ccd=ccd) | ||
rotAngle = visitInfo.getBoresightRotAngle().asDegrees() | ||
|
||
camera = butler.get('camera') | ||
|
||
ccdOffsets = fgcmcal.utilities.computeCcdOffsets(camera, rotAngle) | ||
|
||
# Spot check relative orientations of some of the ccds | ||
# This is based on | ||
# https://subarutelescope.org/Observing/Instruments/HSC/CCDPosition_20170212.png | ||
# The goal here is to check that North is Up, South is Down, | ||
# East is Left, and West is Right. | ||
self.assertLess(ccdOffsets['DELTA_RA'][15], ccdOffsets['DELTA_RA'][10]) | ||
self.assertLess(ccdOffsets['DELTA_RA'][95], ccdOffsets['DELTA_RA'][90]) | ||
self.assertGreater(ccdOffsets['DELTA_RA'][46], 0.0) | ||
|
||
self.assertLess(ccdOffsets['DELTA_DEC'][15], ccdOffsets['DELTA_DEC'][95]) | ||
self.assertLess(ccdOffsets['DELTA_DEC'][10], ccdOffsets['DELTA_DEC'][90]) | ||
self.assertGreater(ccdOffsets['DELTA_DEC'][97], 0.0) | ||
|
||
# Check the sizes | ||
# The projected size of the ccds varies with radius over the large | ||
# HSC field-of-view. Empirically, the x size is between 0.07 and 0.10 deg | ||
# and the y size is between 0.17 and 0.20 deg for the non-rotated CCDs. | ||
# This test checks that the orientations of the CCDs are as expected for | ||
# rotated/non-rotated CCDs (relative size of RA/DEC), and that the size | ||
# is roughly correct. Because these values are only used for visualization | ||
# in the fgcm code, this does not need to be perfect. | ||
|
||
rotatedCcds = [100, 101, 102, 103] | ||
|
||
for i, ccd in enumerate(ccdOffsets['CCDNUM']): | ||
if ccd in rotatedCcds: | ||
self.assertLess(ccdOffsets['RA_SIZE'][i], ccdOffsets['DEC_SIZE'][i]) | ||
self.assertGreater(ccdOffsets['DEC_SIZE'][i], 0.17) | ||
self.assertLess(ccdOffsets['DEC_SIZE'][i], 0.20) | ||
self.assertGreater(ccdOffsets['RA_SIZE'][i], 0.07) | ||
self.assertLess(ccdOffsets['RA_SIZE'][i], 0.10) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where did these sizes come from, and what are the units here? Why the |
||
else: | ||
self.assertGreater(ccdOffsets['RA_SIZE'][i], ccdOffsets['DEC_SIZE'][i]) | ||
self.assertGreater(ccdOffsets['RA_SIZE'][i], 0.17) | ||
self.assertLess(ccdOffsets['RA_SIZE'][i], 0.20) | ||
self.assertGreater(ccdOffsets['DEC_SIZE'][i], 0.07) | ||
self.assertLess(ccdOffsets['DEC_SIZE'][i], 0.10) | ||
|
||
|
||
class TestMemory(lsst.utils.tests.MemoryTestCase): | ||
pass | ||
|
||
|
||
def setup_module(module): | ||
lsst.utils.tests.init() | ||
|
||
|
||
if __name__ == "__main__": | ||
lsst.utils.tests.init() | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good TODO.