Coverage for python/lsst/validate/drp/plot.py : 95%

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
# 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/>. as analytic models of photometric and astrometric repeatability. """
'plotAstrometryErrorModel', 'plotAstromErrModelFit', 'plotPhotErrModelFit', 'plotPhotometryErrorModel', 'plotPA1', 'plotAMx']
# Plotting defaults # plt.rcParams['figure.titlesize'] = 30
'iqr': 'green', 'rms': 'red'}
"""Return a filename for writing to.
Return prefix_formatStr.format(kwargs) if prefix is not empty, otherwise just return formatStr.format(kwargs). """ else:
"""Plot an axis line with a white shadow for better contrast.
Parameters ---------- axMethod : `matplotlib.pyplot.axhline` or `matplotlib.pyplot.axvline` A horizontal or vertical axis line plotting function. x : float Axis coordinate **kwargs : Keyword arguments for `~matplotlib.pyplot.axhline` or `~matplotlib.pyplot.axvline`. """
shadowArgs['linewidth'] += 1 else:
"""Plot angular distance between matched sources from different exposures.
Creates a file containing the plot with a filename beginning with `outputPrefix`.
Parameters ---------- dataset : `lsst.verify.Blob` Blob with the multi-visit photometry model. photomModel : `lsst.verify.Blob` A `Blob` containing the analytic photometry model. outputPrefix : str, optional Prefix to use for filename of plot file. Will also be used in plot titles. E.g., ``outputPrefix='Cfht_output_r_'`` will result in a file named ``'Cfht_output_r_check_astrometry.png'``. """
histtype='stepfilled', orientation='horizontal') histtype='stepfilled', orientation='horizontal')
ax[0].axhline, dist_median.value, color=color['all'], label="Median RMS: {v.value:.1f} {v.unit:latex}".format(v=dist_median)) ax[0].axhline, bright_dist_median.value, color=color['bright'], label="SNR > {snr:.0f}\nMedian RMS: {v.value:.1f} {v.unit:latex}".format( snr=astromModel['brightSnr'].quantity.value, v=bright_dist_median))
s=10, color=color['all'], label='All') color=color['bright'], label='SNR > {0:.0f}'.format(astromModel['brightSnr'].quantity.value)) 'Matches:', '{nBright:d} high SNR,', '{nAll:d} total']) nAll=numMatched), transform=ax[1].transAxes, ha='left', va='baseline')
ax=ax[1])
color='red', linewidth=4, linestyle='dashed') ax[0].axhline, dist_median.value, color=color['all']) ax[0].axhline, bright_dist_median.value, color=color['bright'])
# Using title rather than suptitle because I can't get the top padding fontsize=30)
color='red', ax=None, verbose=True): """Plot model of photometric error from LSST Overview paper http://arxiv.org/abs/0805.2366v4
Astrometric Errors error = C * theta / SNR
Parameters ---------- snr : list or numpy.array S/N of photometric measurements dist : list or numpy.array Separation from reference [mas] model : `lsst.verify.Blob` A `Blob` holding the analytic astrometric model. """ ax = plt.figure() xlim = [10, 30] else:
theta=model['theta'].quantity, sigmaSys=model['sigmaSys'].quantity, C=model['C'].quantity) color=color, linewidth=2, label='Model')
r'$C = {C:.2g}$', r'$\theta$ = {theta:.4g}', r'$\sigma_\mathrm{{sys}}$ = {sigmaSys.value:.2g} {sigmaSys.unit:latex}']) C=model['C'].quantity, theta=model['theta'].quantity, sigmaSys=model['sigmaSys'].quantity) transform=ax.transAxes, va='baseline', ha='left', color=color) # Set the x limits back to their original values.
verbose=True): """Plot model of photometric error from LSST Overview paper (Eq. 4 & 5)
Parameters ---------- mag : list or numpy.array Magnitude mmag_err : list or numpy.array Magnitude uncertainty or variation in *mmag*. photomModel : `lsst.verify.Blob` A `Blob` holding the parameters to display. ax : matplotlib.Axis, optional The Axis object to plot to. verbose : bool, optional Produce extra output to STDOUT """
ax = plt.figure() xlim = [10, 30] else:
sigmaSys=photomModel['sigmaSys'].quantity.to(u.mag).value, gamma=photomModel['gamma'].quantity.value, m5=photomModel['m5'].quantity.to(u.mag).value) color=color, linewidth=2, label='Model')
r'$\sigma_\mathrm{{sys}}$ = {sigmaSysMmag:.4f} mmag', r'$\gamma = {gamma:.4f}$', r'$m_5 =$ {m5:.4f}']) gamma=photomModel['gamma'].quantity.value, m5=photomModel['m5'].quantity.value) transform=ax.transAxes, ha='left', va='top')
filterName='', outputPrefix=''): """Plot photometric RMS for matched sources.
Parameters ---------- dataset : `lsst.verify.Blob` A `Blob` with the multi-visit photometry model. photomModel : `lsst.verify.Blob` A `Blob` hlding the analytic photometry model parameters. filterName : str, optional Name of the observed filter to use on axis labels. outputPrefix : str, optional Prefix to use for filename of plot file. Will also be used in plot titles. E.g., ``outputPrefix='Cfht_output_r_'`` will result in a file named ``'Cfht_output_r_check_photometry.png'``. """
bins=100, range=(0, 500), color=color['all'], histtype='stepfilled', orientation='horizontal') bins=100, range=(0, 500), color=color['bright'], histtype='stepfilled', orientation='horizontal') ax[0][0].axhline, mmagrms_median.value, color=color['all'], label="Median RMS: {v:.1f}".format(v=mmagrms_median)) ax[0][0].axhline, bright_mmagrms_median.value, color=color['bright'], label="SNR > {snr:.0f}\nMedian RMS: {v:.1f}".format( snr=photomModel['brightSnr'].quantity.value, v=bright_mmagrms_median))
magrms=dataset['magrms'], mmagrms=mmagRms)) s=10, color=color['all'], label='All') s=10, color=color['bright'], label='{label} > {value:.0f}'.format( label=photomModel['brightSnr'].label, value=photomModel['brightSnr'].quantity.value)) unit=mag.unit)) unit=mmagRmsHighSnr.unit)) ax[0][1].axhline, mmagrms_median.value, color=color['all']) ax[0][1].axhline, bright_mmagrms_median.value, color=color['bright']) 'Matches:', '{nBright:d} high SNR,', '{nAll:d} total']) nAll=numMatched), transform=ax[0][1].transAxes, ha='left', va='top')
s=10, color=color['all'], label=None) s=10, color=color['bright'], label=None) linestyle='--', color='black', linewidth=2) label=dataset['magrms'].label, unit=mmagRms.unit)) unit=mmagErr.unit))
snr=photomModel['brightSnr'].quantity.value, snrMag=brightSnrMag.to(u.mmag)) color='red', linewidth=4, linestyle='dashed', label=label)
color=color['all'], label=None) mmagErrHighSnr, s=10, color=color['bright'], label=None) name=filterName, unit=mag.unit)) unit=mmagErr.unit)) color='red', linewidth=4, linestyle='dashed', label=None)
magerr[w].to(u.mmag).value, photomModel, ax=ax[1][1])
fontsize=30)
"""Plot the results of calculating the LSST SRC requirement PA1.
Creates a file containing the plot with a filename beginning with `outputPrefix`.
Parameters ---------- pa1 : `lsst.verify.Measurement` A `Measurement` of the PA1 `Metric`. outputPrefix : `str`, optional Prefix to use for filename of plot file. Will also be used in plot titles. E.g., outputPrefix='Cfht_output_r_' will result in a file named ``'Cfht_output_r_AM1_D_5_arcmin_17.0-21.5.png'`` for an ``AMx.name=='AM1'`` and ``AMx.magRange==[17, 21.5]``. """
magDiff[0], s=10, color=color['bright'], linewidth=0) # index 0 because we show only the first sample from multiple trials
orientation='horizontal', histtype='stepfilled', normed=True, color=color['bright'])
marker='', linestyle='-', linewidth=3, color=color['rms'], label=labelTemplate.format(label='RMS', q=rms[0])) marker='', linestyle='-', linewidth=3, color=color['iqr'], label=labelTemplate.format(label='IQR', q=iqr[0]))
"""Plot a histogram of the RMS in relative distance between pairs of stars.
Creates a file containing the plot with a filename beginning with `outputPrefix`.
Parameters ---------- job : `lsst.verify.Job` `~lsst.verify.Job` providing access to metrics, specs and measurements amx : `lsst.verify.Measurement` afx : `lsst.verify.Measurement` filterName : `str` amxSpecName : `str`, optional Name of the AMx specification to reference in the plot. Default: ``'design'``. outputPrefix : `str`, optional Prefix to use for filename of plot file. Will also be used in plot titles. E.g., ``outputPrefix='Cfht_output_r_'`` will result in a file named ``'Cfht_output_r_AM1_D_5_arcmin_17.0-21.5.png'`` for an ``AMx.name=='AM1'`` and ``AMx.magRange==[17, 21.5]``. """
'Mag: [{magBright:.1f}-{magFaint:.1f}]' histtype='stepfilled', label=histLabelTemplate.format( inner=annulus[0], outer=annulus[1], magBright=magRange[0], magFaint=magRange[1])) amx=amx, specname=amxSpecName, amxSpec=amxSpec) label=amxSpecLabel)
else: amxStatus = 'failed' label=amxLabel)
else: afxStatus = 'failed' '{afx.datum.label} measured: {afx.quantity:.1f}% ({status})' afx=afx, afxSpec=afxSpec, status=afxStatus) 0, 1, linewidth=2, color='green', label=afxLabel)
metric=amx.datum.label, D=amx.extras['D'].quantity) '{rmsDistMas.label} ({unit})'.format( rmsDistMas=amx.extras['rmsDistMas'], unit=amx.extras['rmsDistMas'].quantity.unit._repr_latex_()))
'{magBright.value}_{magFaint.value}_{magFaint.unit}.{ext}' pathFormat, metric=amx.datum.label, D=int(amx.extras['D'].quantity.value), Dunits=amx.extras['D'].quantity.unit, magBright=magRange[0], magFaint=magRange[1], ext=ext)
"""Plot TEx correlation function measurements and thresholds.
Parameters ---------- job : `lsst.verify.Job` `Job` providing access to metrics, specs, and measurements tex : `lsst.verify.Measurement The ellipticity residual correlation `Measurement` object filterName : str Name of the filter of the images texSpecName : str Level of requirement to compare against. Must be a into the metrics specified in the tex Measurement object Typically one of 'design', 'minimum', 'stretch' outputPrefix : str, optional Prefix to use for filename of plot file.
Effects ------- Saves an output plot file to that starts with specified outputPrefix.
""" # Plot correlation vs. radius
# Overlay requirements level tex=tex, texSpec=texSpec.threshold, specname=texSpecName) label=texSpecLabel)
# Overlay measured KPM whether it passed or failed. else:
label=texLabel)
{metric} Residual PSF Ellipticity Correlation {bin_range_operator:s} {D.value:.1f}{D.unit:latex} """ bin_range_operator=bin_range_operator, D=D) '{radius.label} ({unit})'.format( radius=tex.extras['radius'], unit=radius.unit._repr_latex_()))
pathFormat, metric=tex.datum.label, D=int(D.value), Dunits=D.unit, ext=ext)
|