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
Review for DM-2674: Make meas_mosaic work on LSST. #1
Merged
Conversation
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
* Export LSST_LIBRARY_PATH. * Rewrite shebang lines on files in bin.src.
LSST does not persist an icMatchFull equivalent, so we need to construct this on the fly based on the source and match records.
If MosaicTask runs with doSolveWcs=False, it does not write a new Wcs. It should still be possible to apply the flux correction in this case.
This is required by the LSST implementation of PerTractCcdDataIdContainer.
If MosaicTask runs with doSolveFlux=False, it does not write a new flux correction. It should still be possible to apply the new Wcs in this case.
This is necessary following the merger of DM-4683.
The new (post-DM-4692) ProcessCcdTask uses the src catalog to perform astrometry and photometry (as opposed to icSrc). It also no longer saves icMatch, or attaches positional information to icSrcs. Here, we switch to using src in meas_mosaic.
This is in response to DM-4036, DM-5879 and DM-6095. Includes: Migration to std::shared_ptr, including: - boost::shared_ptr -> std::shared_ptr - boost::weak_ptr -> std::weak_ptr - boost::static_pointer_cast -> std::static_pointer_cast - boost::dynamic_pointer_cast -> std::dynamic_pointer_cast - boost::const_pointer_cast -> std::const_pointer_cast - boost::reinterpret_pointer_cast -> std::reinterpret_pointer_cast - boost::enamble_shared_from_this -> std::enable_shared_from_this - boost pointer related includes -> standard library memory Replace boost::math. Replace boost::ref.
This is useful for debugging.
Also adds the appropriate fluxSigma key and field from which meas_mosaic extracts it. This error has been propogated according to the colorterm correction.
- Add labels and column headers. - Tweak diagnostic plots to include handling of CCD subsets, and labels and column headers.
If the detector has nQuarter%4 != 0 (i.e. it is rotated w.r.t the focal plane coordinate system), the (x, y) pixel values of the centroid slot for the source catalogs need to be rotated such that pixel (0, 0) corresponds to the LLC (i.e. the coordinate system expected by meas_mosaic).
For the oddly rotated CCDs, the width and height values must be swapped when setting the bounding box for the spacial cell search. They also need to be swapped when drawing the CCD outlines on the diagnostic focal plane plots.
calexp_md = dataRef.get('calexp_md', immediate=True) | ||
# Check if we are looking at HSC stack outputs | ||
hscRun = mosaicUtils.checkHscStack(calexp_md) | ||
# Set the aliap map for the source catalog |
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.
alias
The HSC team is currently using a fork of the main LSST stack. Many developements have occurred on this fork for the purpose of HSC SSP data release production runs. What is currently the "HSC stack" will eventually become obsolete, once all new development that happened there is ported over to the LSST stack and validated. For this validation, it is useful to be able to directly LSST vs. HSC stack runs when using the exact same inputs. This is implemented here by including accommodations required to parse HSC stack produced outputs, namely a mapper between the different source schemas. See the readSrc() function in SourceReader class in MosaicTask.py along with the config/hsc/Mosaic.py file in obs_subaru for an example of how to apply this mapper. The mapper itself is in config/hsc/srcSchemaMap.py in obs_subaru. Note that these inputs will already be in the coordinate system that meas_mosaic expects (i.e. all CCDs have LLC pixel (0, 0) w.r.t the focal plane coordinate system), so no accommodations need to be made in that respect.
Certain objects are not good candidates for inclusion in the mosaic fit. Here we add optional selection criteria as config parameters to exclude objects based on values in the schema. The following lists the config parameters. If they are set to any valid key name, the behavior indicated is followed: extendednessForStarSelection: only include point-like sources saturatedForStarSelection: do not include saturated sources (unless includeSaturated is True) psfStarForStarSelection: only include objects used in the PSF determination *unless* extendednessForStarSelection, in which case include all point-like sources calibStarForStarSelection: only include objects detected as calibration sources parentForStarSelection: do not include objects with parents nChildForStarSelection: do not include objects with children To exclude any given criterion, set its corresponding config value to an invalid value (e.g. None).
The matrix solvers will be operating on non-invertible matrices when input is sparse (e.g. operating on a limited number of inputs). Use full pivoting when using Eigen for a more robust solution. N.B. This may not be the optimal solution. Will revisit if it is deemed necessary.
HSC is using Eigen, so while we are comparing between stacks, keep this consistent by disabling MKL on LSST stack for now.
These include the various diagnostic plotting and data output functions, functions accommodating HSC stack run analysis, and those used to rotate catalog pixel coordinate to accommodate the coordinate system expected by meas_mosaic (i.e. the LLC of any CCD as placed in the focal plane is pixel 0, 0).
Updates the application of the results to a catalog. Since meas_mosaic's solution is based on a coordinate system where a given detector's origin (pixel 0, 0) is associated with its LLC w.r.t. to the focal plane. LSST always associates the detector origin with the electronics, thus if the detector was rotated when inserted into the focal plane (nQuarter%4 != 0), the centroids must be rotated to the meas_mosaic coordinate system before applying the corrections. Note that if working with catalogs produced by the HSC stack (hscRun is not None), the pixels are already in the correct coordinate system, so no rotations are necessary.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.