-
Notifications
You must be signed in to change notification settings - Fork 0
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-43077: Convert all tasks to use CalibrateImageTask outputs #43
Open
parejkoj
wants to merge
3
commits into
main
Choose a base branch
from
tickets/DM-43077
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,54 +29,55 @@ | |
from lsst.utils import getPackageDir | ||
|
||
|
||
class TestCalibrateOutputs(lsst.utils.tests.TestCase): | ||
"""Test the output data products of calibrate task make sense | ||
class TestReprocessVisitImageOutputs(lsst.utils.tests.TestCase): | ||
"""Test the output data products of ReprocessVisitImageTask make sense. | ||
|
||
This is a regression test and not intended for scientific validation | ||
This is a regression test and not intended for scientific validation. | ||
""" | ||
|
||
def setUp(self): | ||
self.butler = Butler(os.path.join(getPackageDir("ci_imsim"), "DATA"), | ||
writeable=False, collections=["LSSTCam-imSim/runs/ci_imsim"]) | ||
self.dataId = {"detector": 55, "visit": 206039, "band": "y"} | ||
self.calexp = self.butler.get("calexp", self.dataId) | ||
self.src = self.butler.get("src", self.dataId) | ||
self.exposure = self.butler.get("pvi", self.dataId) | ||
self.catalog = self.butler.get("sources_footprints_detector", self.dataId) | ||
|
||
def testLocalPhotoCalibColumns(self): | ||
"""Check calexp's calibs are consistent with src's photocalib columns | ||
"""Check exposure's calibs are consistent with catalog's | ||
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. Check that |
||
photocalib columns. | ||
""" | ||
# Check that means are in the same ballpark | ||
calexpCalib = self.calexp.getPhotoCalib().getCalibrationMean() | ||
calexpCalibErr = self.calexp.getPhotoCalib().getCalibrationErr() | ||
srcCalib = np.mean(self.src['base_LocalPhotoCalib']) | ||
srcCalibErr = np.mean(self.src['base_LocalPhotoCalibErr']) | ||
exposureCalib = self.exposure.photoCalib.getCalibrationMean() | ||
exposureCalibErr = self.exposure.photoCalib.getCalibrationErr() | ||
catalogCalib = np.mean(self.catalog['base_LocalPhotoCalib']) | ||
catalogCalibErr = np.mean(self.catalog['base_LocalPhotoCalibErr']) | ||
|
||
self.assertAlmostEqual(calexpCalib, srcCalib, places=3) | ||
self.assertAlmostEqual(calexpCalibErr, srcCalibErr, places=3) | ||
self.assertAlmostEqual(exposureCalib, catalogCalib, places=3) | ||
self.assertAlmostEqual(exposureCalibErr, catalogCalibErr, places=3) | ||
|
||
# and that calibs evalutated at local positions match a few rows | ||
randomRows = [0, 8, 20] | ||
for rowNum in randomRows: | ||
record = self.src[rowNum] | ||
localEval = self.calexp.getPhotoCalib().getLocalCalibration(record.getCentroid()) | ||
record = self.catalog[rowNum] | ||
localEval = self.exposure.photoCalib.getLocalCalibration(record.getCentroid()) | ||
self.assertAlmostEqual(localEval, record['base_LocalPhotoCalib']) | ||
|
||
def testLocalWcsColumns(self): | ||
"""Check the calexp's wcs match local wcs columns in src | ||
"""Check the initial_pvi's wcs match local wcs columns in initial_stars | ||
""" | ||
# Check a few rows: | ||
randomRows = [1, 9, 21] | ||
for rowNum in randomRows: | ||
record = self.src[rowNum] | ||
record = self.catalog[rowNum] | ||
centroid = record.getCentroid() | ||
trueCdMatrix = np.radians(self.calexp.getWcs().getCdMatrix(centroid)) | ||
trueCdMatrix = np.radians(self.exposure.wcs.getCdMatrix(centroid)) | ||
|
||
self.assertAlmostEqual(record['base_LocalWcs_CDMatrix_1_1'], trueCdMatrix[0, 0]) | ||
self.assertAlmostEqual(record['base_LocalWcs_CDMatrix_2_1'], trueCdMatrix[1, 0]) | ||
self.assertAlmostEqual(record['base_LocalWcs_CDMatrix_1_2'], trueCdMatrix[0, 1]) | ||
self.assertAlmostEqual(record['base_LocalWcs_CDMatrix_2_2'], trueCdMatrix[1, 1]) | ||
self.assertAlmostEqual( | ||
self.calexp.getWcs().getPixelScale(centroid).asRadians(), | ||
self.exposure.wcs.getPixelScale(centroid).asRadians(), | ||
np.sqrt(np.fabs(record['base_LocalWcs_CDMatrix_1_1']*record['base_LocalWcs_CDMatrix_2_2'] | ||
- record['base_LocalWcs_CDMatrix_2_1']*record['base_LocalWcs_CDMatrix_1_2']))) | ||
|
||
|
Oops, something went wrong.
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.
Is this not implemented in the new task? I vaguely remember it didn't work right anyway and only the multiband one was really necessary (to limit Scarlet runtime, which might also be moot now).