pyimcom.pictures.genpic
Tools to make a mosaic picture.
Functions
- resolve_bounds
Turn boundary list into tuple.
- get_config
Utility to get the configuration from a FITS file..
- cmapscale
Color mapping.
- make_picture_1band
Turns a single-band mosaic into an image file.
Functions
|
Turns bounds object into a tuple of ymin,ymax,xmin,xmax restricted to nblock x nblock region. |
|
Utility to get the configuration. |
|
Color mapping for making a display image. |
|
Writes a mosaic image from a set of IMCOM output files. |
Module Contents
- resolve_bounds(bounds, nblock)[source]
Turns bounds object into a tuple of ymin,ymax,xmin,xmax restricted to nblock x nblock region.
- Parameters:
bounds (list of int) – Length 4: [ymin,ymax,xmin,xmax]
nblock (int) – The mosaic size in blocks.
- Returns:
ymin (int) – Bottom side of mosaic (inclusive).
ymax (int) – Top side of mosaic (exclusive).
xmin (int) – Left side of mosaic (inclusive).
xmax (int) – Right side of mosaic (exclusive).
- get_config(fn1)[source]
Utility to get the configuration.
- Parameters:
fn1 (str) – File name.
- Returns:
The configuration used to generate fn1.
- Return type:
- cmapscale(inarray, srange, cmap=None, stretch='asinh')[source]
Color mapping for making a display image.
- Parameters:
inarray (np.array of float) – The array to be mapped. Shape (ny,nx).
srange ((float, float)) – The minimum and maximum values to be represented (values beyond this will saturate).
cmap (str or None, optional) – If string, uses that color scale; if None, makes a black and white image.
stretch (str, optional) – The stretch. Current options are ‘linear’ and ‘asinh’.
- Returns:
Either a grayscale 2D array shape = (ny,nx) if cmap is None; or an RGB 3D array shape = (ny,nx,3) if cmap is not None.
- Return type:
np.array of uint8
- make_picture_1band(fn, outfile, layer=0, bounds=None, binning=1, cmap=None, srange=(-8.0, 600.0), stretch='asinh')[source]
Writes a mosaic image from a set of IMCOM output files.
- Parameters:
fn (str) – File stem (without the _DD_DD.fits).
outfile (str) – Output file name.
layer (int, optional) – Which image layer to use (default is the Science layer).
bounds (list or None, optional) – Boundary of the output image. If a list, should be [ymin,ymax,xmin,xmax], to indicate the range xmin<=x<xmax, ymin<=y<ymax. If None (default), draws the whole mosaic.
binning (int, optional) – Binning relative to the FITS images. Larger binning reduces size of output image. The default is 1, corresponding to native resolution.
cmap (str or None, optional) – Color map (uses matplotlib names; None -> black & white).
srange ((float, float), optional) – Minimum and maximum of the color scale.
stretch (str, optional) – Stretch type (currently: ‘asinh’ or ‘linear’)
- Return type:
None