Coverage for bin/check_astrometry.py : 70%
Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
|
#!/Users/square/j/ws/release/tarball/ad013b8585/build/python/miniconda3-4.7.10/envs/lsst-scipipe-4d7b902/bin/python # noqa
# LSST Data Management System # Copyright 2008-2016 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, # see <https://www.lsstcorp.org/LegalNotices/>.
"""Load data from specific visit+field pairs. Match with reference.
@param repo The repository. This is generally the directory on disk that contains the repository and mapper. @param visits 'runs' in SDSS nomenclature. List. @param fields Field within a camcol. List. @param ref The run of the reference image set. Scalar. @param ref_field The field of the reference image set. Scalar. @param camcol Camera column to use. List. @param filter Name of the filter. Scalar
Return a pipeBase.Struct with mag, dist, and number of matches.
Notes: {visit, filter, field, camcol} are sufficient to unique specfiy a data ID for the Butler in the obs_sdss camera mapping. """
"base_PsfFlux_flag_edge"]
# setup butler
# retrieve the schema of the source catalog and extend it in order # to add a field to record the camcol number
# create the new extented source catalog
# create temporary catalog # fill in the camcol information in numpy mode in order to be efficient # append the temporary catalog to the extended source catalog
else: srcVis.extend(butler.get('src', dataid, immediate=True), False)
# cleanup the reference sources in order to keep only decent star-like objects
# retrieve the camcol corresponding to the reference source # retrieve the calibration object associated to the camcol # compute magnitude
mag=mag, dist=dist, match=matchNum )
"""Plot angular distance between matched sources from different exposures."""
# Defer importing of matplotlib until we need it. import matplotlib.pylab as plt
plt.rcParams['axes.linewidth'] = 2 plt.rcParams['mathtext.default'] = 'regular'
fig, ax = plt.subplots(ncols=2, nrows=3, figsize=(18, 22)) ax[0][0].hist(dist, bins=80) ax[0][1].scatter(mag, dist, s=10, color='b') ax[0][0].set_xlim([0., 900.]) ax[0][0].set_xlabel("Distance in mas", fontsize=20) ax[0][0].tick_params(labelsize=20) ax[0][0].set_title("Median : %.1f mas" % (np.median(dist)), fontsize=20, x=0.6, y=0.88) ax[0][1].set_xlabel("Magnitude", fontsize=20) ax[0][1].set_ylabel("Distance in mas", fontsize=20) ax[0][1].set_ylim([0., 900.]) ax[0][1].tick_params(labelsize=20) ax[0][1].set_title("Number of matches : %d" % match, fontsize=20)
ax[1][0].hist(dist, bins=150) ax[1][0].set_xlim([0., 400.]) ax[1][1].scatter(mag, dist, s=10, color='b') ax[1][1].set_ylim([0., 400.]) ax[1][0].set_xlabel("Distance in mas", fontsize=20) ax[1][1].set_xlabel("Magnitude", fontsize=20) ax[1][1].set_ylabel("Distance in mas", fontsize=20) ax[1][0].tick_params(labelsize=20) ax[1][1].tick_params(labelsize=20)
idxs = np.where(np.asarray(mag) < good_mag_limit)
ax[2][0].hist(np.asarray(dist)[idxs], bins=100) ax[2][0].set_xlabel("Distance in mas - mag < %.1f" % good_mag_limit, fontsize=20) ax[2][0].set_xlim([0, 200]) ax[2][0].set_title("Median (mag < %.1f) : %.1f mas" % (good_mag_limit, np.median(np.asarray(dist)[idxs])), fontsize=20, x=0.6, y=0.88) ax[2][1].scatter(np.asarray(mag)[idxs], np.asarray(dist)[idxs], s=10, color='b') ax[2][1].set_xlabel("Magnitude", fontsize=20) ax[2][1].set_ylabel("Distance in mas - mag < %.1f" % good_mag_limit, fontsize=20) ax[2][1].set_ylim([0., 200.]) ax[2][0].tick_params(labelsize=20) ax[2][1].tick_params(labelsize=20)
plt.suptitle("Astrometry Check", fontsize=30) plotPath = os.path.join("astrometry_sdss.png") plt.savefig(plotPath, format="png")
good_mag_limit=19.5, medianRef=100, matchRef=500): """Print out the astrometric scatter for all stars, and for good stars.
@param medianRef Median reference astrometric scatter in arcseconds. @param matchRef Should match at least matchRef stars.
Return a boolean indicating whether the astrometric scatter was less than the supplied reference, and the astrometric scatter (RMS, arcsec) for all good stars.
Notes: The scatter and match defaults are appropriate to SDSS are stored here. For SDSS, stars with mag < 19.5 should be completely well measured. """
np.median(dist), "mas")
print("Median astrometric scatter %.1f mas is larger than reference : %.1f mas " % (astromScatter, medianRef)) passed = False else: print("Number of matched sources %d is too small (should be > %d)" % (match, matchRef)) passed = False
"""Main executable.
Returns True if the test passed, False otherwise. """
# Limit depends on filter
plotAstrometry(mag, dist, match)
# List of SDSS runs to be considered
# Reference visit (the other visits will be compared to this one
# List of camcol to be considered (source calalogs will be concateneted)
print("""Usage: check_astrometry repo where repo is the path to a repository containing the output of processCcd """) sys.exit(1)
print("Could not find repo %r" % (repo,)) sys.exit(1)
else: sys.exit(1) |