Plot statistics for a specified image section up the stack of an IR MultiAccum image. Sections from any of the SCI, ERR, DQ, image extensions can be plotted. A choice of mean, midpt (median), mode, standard deviation, minimum, and maximum statistics is available. The total number of samples is determined from the primary header keyword NSAMP and all samples (excluding the zeroth-read) are plotted. The SCI, ERR, DQ statistics are plotted as a function of sample time. The sample times are read from the SAMPTIME keyword in the SCI header for each readout.

SAMP and TIME are not generally populated until the FLT image stage. To plot the samptime vs sample, use wfc3tools.pstat and the “time” extension.

When specifying an image section, note the Python slicing rules are in play which means the valid data within the bounds of the start:stop values will be used for any computation.


>>> from wfc3tools import pstat
>>> time, counts = pstat('ibh719grq_ima.fits', col_slice=(100, 104), row_slice=(20, 25), units="counts")
>>> time
array([ 100.651947,   93.470573,   86.2892  ,   79.107826,   71.926453,
         64.745079,   57.563702,   50.382328,   43.200954,   36.019581,
         28.838205,   21.65683 ,   14.475455,    7.29408 ,    0.112705,
          0.      ])
>>> counts
array([210.93391217,   210.3575491 ,   187.08969378,   181.75601219,
       151.43222828,   138.52899031,   116.67495111,   109.19263377,
        86.42073624,    80.97576756,    70.44724733,    53.37688116,
        33.1249918 ,    12.25499919,    -4.88105808,     0.        ])


Note that the arrays are structured in SCI order, so the final exposure is the first element in the array.


The interface to this utility has been updated from previous versions and is not backwards compatible. Here is an example to illustrate the “original” syntax, the “original syntax corrected for row/column order”, and finally the “new” syntax which requires column and row sections to be specified as tuples.

Example: To plot the left edge of the detector
Original syntax: [y1:y2, x1:x2]
time, counts = pstat(‘ibohbfb9q_ima.fits[1:1014,100:300]’)
Original syntax, but correcting the row/column order: [x1:x2, y1:y2]
time, counts = pstat(‘ibohbfb9q_ima.fits[100:300,1:1014]’)
New syntax using tuples for col_slice and row_slice to specify the section:
time, counts = pstat(‘ibohbfb9q_ima.fits’, col_slice=(100,300), row_slice=(1,1014))
wfc3tools.pstat(filename, col_slice=None, row_slice=None, extname='sci', units='counts', stat='midpt', title=None, xlabel=None, ylabel=None, plot=True, overplot=False)[source]

A function to plot the statistics of one or more pixels up an IR ramp.



Input MultiAccum image filename. This should be either a _raw or _ima file, containing all the data from multiple readouts. Only the filename should be be specified (i.e., no image section or extension name).

col_slicetuple of ints, default = None

A tuple representing the columns to be included as part of the analysis. The default value of None indicates use of all columns.

row_slicetuple of ints, default = None

A tuple representing the rows to be included as part of the analysis. The default value of None indicates use of all rows.

extnamestr, default=”sci”

Extension name (EXTNAME keyword value) of data to plot. Allowed values are “sci”, “err”, and “dq”.

unitsstr, default=”counts”

Plot “sci” or “err” data in units of counts or countrate (“rate”). Input data can be in either unit; conversion will be performed automatically. Ignored when plotting “dq”, “samp”, or “time” data. Allowed values are “counts” and “rate”.

statstr, default=”midpt”

Type of statistic to compute. Allowed values are “mean”, “midpt”, “mode”, “stddev”, “min”, and “max”.

titlestr, default=None

Title for the plot. If left blank, the name of the input image, appended with the extname and image section, is used.

xlabelstr, default=None

Label for the X-axis of the plot. If left blank, a suitable default is generated.

ylabelstr, default=None

Label for the Y-axis of the plot. If left blank, a suitable default based on the plot units and the extname of the data is generated.

plotbool, default=True

If False, return data and do not plot.

overplotbool, default=False

If True, the results will be overplotted on the previous plot.



Array of x-axis values that will be plotted.


Array of y-axis values that will be plotted as specified by ‘units’.


Pixel values here are 0 based, not 1 based.


Using an image section to generate output in counts
>>> from wfc3tools import pstat
>>> time, counts = pstat(‘ibh719grq_ima.fits’, col_slice=(100, 104), row_slice=(20, 25), units=”counts”)
Using the entire image to generate output in countrate
>>> time, counts = pstat(‘ibh719grq_ima.fits’, col_slice=None, row_slice=None, units=”rate”)