pypeit.core.plot module
Convenience functions for plotting.
- pypeit.core.plot.zsc_compute_sigma(flat, badpix)[source]
Compute the rms deviation from the mean of a flattened array. Ignore rejected pixels
- Parameters:
flat (numpy.ndarray) – Image to compute sigma from
badpix (numpy.ndarray) – bad pixel mask; 1=bad, 0=good
- Returns:
ngoodpixels (int) – Number of good pixels
mean (float) – Mean of the good pixels
sigma (float) – RMS of the good pixels
- pypeit.core.plot.zsc_fit_line(samples, npix, krej, ngrow, maxiter)[source]
zscale fit line
- Parameters:
samples (numpy.ndarray) – 1-d array of samples to analyze
npix (int) – Number of pixels in the samples array
krej (float) – Rejection factor
ngrow (int) – Number of pixels to grow around the rejected pixels
maxiter (int) – Maximum number of iterations to perform
- Returns:
ngoodpix (int) – Number of good pixels
zstart (float) – zscale parameter
zslope (float) – zscale parameter
- pypeit.core.plot.zsc_sample(image, maxpix, bpmask=None, zmask=None)[source]
Figure out which pixels to use for the zscale algorithm Returns the 1-d array samples
Don’t worry about the bad pixel mask or zmask for the moment Sample in a square grid, and return the first maxpix in the sample
- Parameters:
image (numpy.ndarray) – Image to scale
- Returns:
samples – 1-d array of samples
- Return type:
- pypeit.core.plot.zscale(image, nsamples=1000, contrast=0.25, bpmask=None, zmask=None)[source]
Implement IRAF zscale algorithm nsamples=1000 and contrast=0.25 are the IRAF display task defaults bpmask and zmask not implemented yet image is a 2-d np array returns (z1, z2)
- Parameters:
image (numpy.ndarray) – Image to scale
nsamples (int, optional) – Number of samples to use in the calculation. Passed to zsc_sample.
contrast (float, optional) – Desired contrast.
bpmask (numpy.ndarray, optional) – Pixel mask for bad pixels. Not implemented yet.
zmask (numpy.ndarray, optional) – Not implemented yet.
- Returns:
z1 (float) – zscale parameter
z2 (float) – zscale parameter