lsst.cp.pipe  21.0.0-10-gcf60f90+6a14845494
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
lsst.cp.pipe.ptc.plotPtc.PlotPhotonTransferCurveTask Class Reference

Public Member Functions

def __init__ (self, datasetFilename, linearizerFileName=None, outDir='.', detNum=999, signalElectronsRelativeA=75000, plotNormalizedCovariancesNumberOfBins=10)
 
def runDataRef (self)
 
def run (self, filenameFull, datasetPtc, linearizer=None, log=None)
 
def covAstierMakeAllPlots (self, dataset, pdfPages, log=None)
 
def plotNormalizedCovariances (self, i, j, inputMu, covs, covsModel, covsWeights, covsNoB, covsModelNoB, covsWeightsNoB, pdfPages, offset=0.004, numberOfBins=10, plotData=True, topPlot=False, log=None)
 

Static Public Member Functions

def plotCovariances (mu, covs, covsModel, covsWeights, covsNoB, covsModelNoB, covsWeightsNoB, gainDict, noiseDict, aDict, bDict, pdfPages)
 
def plot_a_b (aDict, bDict, pdfPages, bRange=3)
 
def ab_vs_dist (aDict, bDict, pdfPages, bRange=4)
 
def plotAcoeffsSum (aDict, bDict, pdfPages)
 
def plotRelativeBiasACoeffs (aDict, aDictNoB, fullCovsModel, fullCovsModelNoB, signalElectrons, gainDict, pdfPages, maxr=None)
 
def findGroups (x, maxDiff)
 
def indexForBins (x, nBins)
 
def binData (x, y, binIndex, wy=None)
 

Public Attributes

 datasetFilename
 
 linearizerFileName
 
 detNum
 
 signalElectronsRelativeA
 
 plotNormalizedCovariancesNumberOfBins
 
 outDir
 

Detailed Description

A class to plot the dataset from MeasurePhotonTransferCurveTask.

Parameters
----------

datasetFileName : `str`
    datasetPtc (lsst.ip.isr.PhotonTransferCurveDataset) file
    name (fits).

linearizerFileName : `str`, optional
    linearizer (isr.linearize.Linearizer) file
    name (fits).

outDir : `str`, optional
    Path to the output directory where the final PDF will
    be placed.

detNum : `int`, optional
    Detector number.

signalElectronsRelativeA : `float`, optional
    Signal value for relative systematic bias between different
    methods of estimating a_ij (Fig. 15 of Astier+19).

plotNormalizedCovariancesNumberOfBins : `float`, optional
    Number of bins in `plotNormalizedCovariancesNumber` function
    (Fig. 8, 10., of Astier+19).

Notes
-----
The plotting code in this file is almost identical to the code in
`plotPtcGen2.py`. If further changes are implemented in this file,
`plotPtcGen2.py` needs to be updated accordingly, and vice versa.
The file `plotPtcGen2.py` helps with maintaining backwards
compatibility with gen2 as we transition to gen3; the code
duplication is meant to only last for few month from now
(Jan, 2021). At that point only this file, `plotPtc.py`, will
remain.

Definition at line 46 of file plotPtc.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.cp.pipe.ptc.plotPtc.PlotPhotonTransferCurveTask.__init__ (   self,
  datasetFilename,
  linearizerFileName = None,
  outDir = '.',
  detNum = 999,
  signalElectronsRelativeA = 75000,
  plotNormalizedCovariancesNumberOfBins = 10 
)

Definition at line 87 of file plotPtc.py.

Member Function Documentation

◆ ab_vs_dist()

def lsst.cp.pipe.ptc.plotPtc.PlotPhotonTransferCurveTask.ab_vs_dist (   aDict,
  bDict,
  pdfPages,
  bRange = 4 
)
static
Fig. 13 of Astier+19.

Values of a and b arrays fits, averaged over amplifiers, as a function of distance.

Parameters
----------
aDict : `dict`, [`numpy.array`]
    Dictionary keyed by amp names containing the fitted 'a' coefficients from the model
    in Eq. 20 of Astier+19 (if `ptcFitType` is `FULLCOVARIANCE`).

bDict : `dict`, [`numpy.array`]
    Dictionary keyed by amp names containing the fitted 'b' coefficients from the model
    in Eq. 20 of Astier+19 (if `ptcFitType` is `FULLCOVARIANCE`).

pdfPages: `matplotlib.backends.backend_pdf.PdfPages`
    PDF file where the plots will be saved.

bRange : `int`
    Maximum lag for b arrays.

Definition at line 606 of file plotPtc.py.

◆ binData()

def lsst.cp.pipe.ptc.plotPtc.PlotPhotonTransferCurveTask.binData (   x,
  y,
  binIndex,
  wy = None 
)
static
Bin data (usually for display purposes).

Patrameters
-----------
x: `numpy.array`
    Data to bin.

y: `numpy.array`
    Data to bin.

binIdex: `list`
    Bin number of each datum.

wy: `numpy.array`
    Inverse rms of each datum to use when averaging (the actual weight is wy**2).

Returns:
-------

xbin: `numpy.array`
    Binned data in x.

ybin: `numpy.array`
    Binned data in y.

wybin: `numpy.array`
    Binned weights in y, computed from wy's in each bin.

sybin: `numpy.array`
    Uncertainty on the bin average, considering actual scatter, and ignoring weights.

Definition at line 1107 of file plotPtc.py.

◆ covAstierMakeAllPlots()

def lsst.cp.pipe.ptc.plotPtc.PlotPhotonTransferCurveTask.covAstierMakeAllPlots (   self,
  dataset,
  pdfPages,
  log = None 
)
Make plots for MeasurePhotonTransferCurve task when doCovariancesAstier=True.

This function call other functions that mostly reproduce the plots in Astier+19.
Most of the code is ported from Pierre Astier's repository https://github.com/PierreAstier/bfptc

Parameters
----------
dataset : `lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset`
    The dataset containing the necessary information to produce the plots.

pdfPages: `matplotlib.backends.backend_pdf.PdfPages`
    PDF file where the plots will be saved.

log : `lsst.log.Log`, optional
    Logger to handle messages

Definition at line 136 of file plotPtc.py.

◆ findGroups()

def lsst.cp.pipe.ptc.plotPtc.PlotPhotonTransferCurveTask.findGroups (   x,
  maxDiff 
)
static
Group data into bins, with at most maxDiff distance between bins.

Parameters
----------
x: `list`
    Data to bin.

maxDiff: `int`
    Maximum distance between bins.

Returns
-------
index: `list`
    Bin indices.

Definition at line 1049 of file plotPtc.py.

◆ indexForBins()

def lsst.cp.pipe.ptc.plotPtc.PlotPhotonTransferCurveTask.indexForBins (   x,
  nBins 
)
static
Builds an index with regular binning. The result can be fed into binData.

Parameters
----------
x: `numpy.array`
    Data to bin.
nBins: `int`
    Number of bin.

Returns
-------
np.digitize(x, bins): `numpy.array`
    Bin indices.

Definition at line 1087 of file plotPtc.py.

◆ plot_a_b()

def lsst.cp.pipe.ptc.plotPtc.PlotPhotonTransferCurveTask.plot_a_b (   aDict,
  bDict,
  pdfPages,
  bRange = 3 
)
static
Fig. 12 of Astier+19

Color display of a and b arrays fits, averaged over channels.

Parameters
----------
aDict : `dict`, [`numpy.array`]
    Dictionary keyed by amp names containing the fitted 'a' coefficients from the model
    in Eq. 20 of Astier+19 (if `ptcFitType` is `FULLCOVARIANCE`).

bDict : `dict`, [`numpy.array`]
    Dictionary keyed by amp names containing the fitted 'b' coefficients from the model
    in Eq. 20 of Astier+19 (if `ptcFitType` is `FULLCOVARIANCE`).

pdfPages: `matplotlib.backends.backend_pdf.PdfPages`
    PDF file where the plots will be saved.

bRange : `int`
    Maximum lag for b arrays.

Definition at line 553 of file plotPtc.py.

◆ plotAcoeffsSum()

def lsst.cp.pipe.ptc.plotPtc.PlotPhotonTransferCurveTask.plotAcoeffsSum (   aDict,
  bDict,
  pdfPages 
)
static
Fig. 14. of Astier+19

Cumulative sum of a_ij as a function of maximum separation. This plot displays the average over
channels.

Parameters
----------
aDict : `dict`, [`numpy.array`]
    Dictionary keyed by amp names containing the fitted 'a' coefficients from the model
    in Eq. 20 of Astier+19 (if `ptcFitType` is `FULLCOVARIANCE`).

bDict : `dict`, [`numpy.array`]
    Dictionary keyed by amp names containing the fitted 'b' coefficients from the model
    in Eq. 20 of Astier+19 (if `ptcFitType` is `FULLCOVARIANCE`).

pdfPages: `matplotlib.backends.backend_pdf.PdfPages`
    PDF file where the plots will be saved.

Definition at line 689 of file plotPtc.py.

◆ plotCovariances()

def lsst.cp.pipe.ptc.plotPtc.PlotPhotonTransferCurveTask.plotCovariances (   mu,
  covs,
  covsModel,
  covsWeights,
  covsNoB,
  covsModelNoB,
  covsWeightsNoB,
  gainDict,
  noiseDict,
  aDict,
  bDict,
  pdfPages 
)
static
Plot covariances and models: Cov00, Cov10, Cov01.

Figs. 6 and 7 of Astier+19

Parameters
----------
mu : `dict`, [`str`, `list`]
    Dictionary keyed by amp name with mean signal values.

covs : `dict`, [`str`, `list`]
    Dictionary keyed by amp names containing a list of measued covariances per mean flux.

covsModel : `dict`, [`str`, `list`]
    Dictionary keyed by amp names containinging covariances model (Eq. 20 of Astier+19) per mean flux.

covsWeights : `dict`, [`str`, `list`]
    Dictionary keyed by amp names containinging sqrt. of covariances weights.

covsNoB : `dict`, [`str`, `list`]
    Dictionary keyed by amp names containing a list of measued covariances per mean flux ('b'=0 in
    Astier+19).

covsModelNoB : `dict`, [`str`, `list`]
    Dictionary keyed by amp names containing covariances model (with 'b'=0 in Eq. 20 of Astier+19)
    per mean flux.

covsWeightsNoB : `dict`, [`str`, `list`]
    Dictionary keyed by amp names containing sqrt. of covariances weights ('b' = 0 in Eq. 20 of
    Astier+19).

gainDict : `dict`, [`str`, `float`]
    Dictionary keyed by amp names containing the gains in e-/ADU.

noiseDict : `dict`, [`str`, `float`]
    Dictionary keyed by amp names containing the rms redout noise in e-.

aDict : `dict`, [`str`, `numpy.array`]
    Dictionary keyed by amp names containing 'a' coefficients (Eq. 20 of Astier+19).

bDict : `dict`, [`str`, `numpy.array`]
    Dictionary keyed by amp names containing 'b' coefficients (Eq. 20 of Astier+19).

pdfPages: `matplotlib.backends.backend_pdf.PdfPages`
    PDF file where the plots will be saved.

Definition at line 192 of file plotPtc.py.

◆ plotNormalizedCovariances()

def lsst.cp.pipe.ptc.plotPtc.PlotPhotonTransferCurveTask.plotNormalizedCovariances (   self,
  i,
  j,
  inputMu,
  covs,
  covsModel,
  covsWeights,
  covsNoB,
  covsModelNoB,
  covsWeightsNoB,
  pdfPages,
  offset = 0.004,
  numberOfBins = 10,
  plotData = True,
  topPlot = False,
  log = None 
)
Plot C_ij/mu vs mu.

Figs. 8, 10, and 11 of Astier+19

Parameters
----------
i : `int`
    Covariane lag

j : `int`
    Covariance lag

inputMu : `dict`, [`str`, `list`]
    Dictionary keyed by amp name with mean signal values.

covs : `dict`, [`str`, `list`]
    Dictionary keyed by amp names containing a list of measued covariances per mean flux.

covsModel : `dict`, [`str`, `list`]
    Dictionary keyed by amp names containinging covariances model (Eq. 20 of Astier+19) per mean flux.

covsWeights : `dict`, [`str`, `list`]
    Dictionary keyed by amp names containinging sqrt. of covariances weights.

covsNoB : `dict`, [`str`, `list`]
    Dictionary keyed by amp names containing a list of measued covariances per mean flux ('b'=0 in
    Astier+19).

covsModelNoB : `dict`, [`str`, `list`]
    Dictionary keyed by amp names containing covariances model (with 'b'=0 in Eq. 20 of Astier+19)
    per mean flux.

covsWeightsNoB : `dict`, [`str`, `list`]
    Dictionary keyed by amp names containing sqrt. of covariances weights ('b' = 0 in Eq. 20 of
    Astier+19).

expIdMask : `dict`, [`str`, `list`]
    Dictionary keyed by amp names containing the masked exposure pairs.

pdfPages: `matplotlib.backends.backend_pdf.PdfPages`
    PDF file where the plots will be saved.

offset : `float`, optional
    Constant offset factor to plot covariances in same panel (so they don't overlap).

numberOfBins : `int`, optional
    Number of bins for top and bottom plot.

plotData : `bool`, optional
    Plot the data points?

topPlot : `bool`, optional
    Plot the top plot with the covariances, and the bottom plot with the model residuals?

log : `lsst.log.Log`, optional
    Logger to handle messages.

Definition at line 402 of file plotPtc.py.

◆ plotRelativeBiasACoeffs()

def lsst.cp.pipe.ptc.plotPtc.PlotPhotonTransferCurveTask.plotRelativeBiasACoeffs (   aDict,
  aDictNoB,
  fullCovsModel,
  fullCovsModelNoB,
  signalElectrons,
  gainDict,
  pdfPages,
  maxr = None 
)
static
Fig. 15 in Astier+19.

Illustrates systematic bias from estimating 'a'
coefficients from the slope of correlations as opposed to the
full model in Astier+19.

Parameters
----------
aDict: `dict`
    Dictionary of 'a' matrices (Eq. 20, Astier+19), with amp names as keys.

aDictNoB: `dict`
    Dictionary of 'a' matrices ('b'= 0 in Eq. 20, Astier+19), with amp names as keys.

fullCovsModel : `dict`, [`str`, `list`]
    Dictionary keyed by amp names containing covariances model per mean flux.

fullCovsModelNoB : `dict`, [`str`, `list`]
    Dictionary keyed by amp names containing covariances model (with 'b'=0 in Eq. 20 of
    Astier+19) per mean flux.

signalElectrons : `float`
    Signal at which to evaluate the a_ij coefficients.

pdfPages: `matplotlib.backends.backend_pdf.PdfPages`
    PDF file where the plots will be saved.

gainDict : `dict`, [`str`, `float`]
    Dicgionary keyed by amp names with the gains in e-/ADU.

maxr : `int`, optional
    Maximum lag.

Definition at line 739 of file plotPtc.py.

◆ run()

def lsst.cp.pipe.ptc.plotPtc.PlotPhotonTransferCurveTask.run (   self,
  filenameFull,
  datasetPtc,
  linearizer = None,
  log = None 
)
Make the plots for the PTC task

Definition at line 120 of file plotPtc.py.

◆ runDataRef()

def lsst.cp.pipe.ptc.plotPtc.PlotPhotonTransferCurveTask.runDataRef (   self)
Run the Photon Transfer Curve (PTC) plotting measurement task.

Definition at line 97 of file plotPtc.py.

Member Data Documentation

◆ datasetFilename

lsst.cp.pipe.ptc.plotPtc.PlotPhotonTransferCurveTask.datasetFilename

Definition at line 90 of file plotPtc.py.

◆ detNum

lsst.cp.pipe.ptc.plotPtc.PlotPhotonTransferCurveTask.detNum

Definition at line 92 of file plotPtc.py.

◆ linearizerFileName

lsst.cp.pipe.ptc.plotPtc.PlotPhotonTransferCurveTask.linearizerFileName

Definition at line 91 of file plotPtc.py.

◆ outDir

lsst.cp.pipe.ptc.plotPtc.PlotPhotonTransferCurveTask.outDir

Definition at line 95 of file plotPtc.py.

◆ plotNormalizedCovariancesNumberOfBins

lsst.cp.pipe.ptc.plotPtc.PlotPhotonTransferCurveTask.plotNormalizedCovariancesNumberOfBins

Definition at line 94 of file plotPtc.py.

◆ signalElectronsRelativeA

lsst.cp.pipe.ptc.plotPtc.PlotPhotonTransferCurveTask.signalElectronsRelativeA

Definition at line 93 of file plotPtc.py.


The documentation for this class was generated from the following file: