multicolorfits.to_grey_rgb#

multicolorfits.to_grey_rgb(datin, rescalefn='linear', scaletype='abs', min_max=[None, None], gamma=2.2, checkscale=False, dtype=None)[source]#

Stretch a 2D intensity array and expand it to a greyscale RGB cube in [0, 1].

This is the first step of the classic scripting pipeline before colorize_image() and combine_multicolor().

Examples

>>> grey = to_grey_rgb(data, rescalefn='asinh', min_max=[0., 1.2], gamma=2.2)
>>> grey.shape  
(ny, nx, 3)
Parameters:
  • datin (array) – Input 2D image data.

  • rescalefn (str) – Intensity stretch: 'linear', 'sqrt', 'squared', 'log', 'power', 'sinh', 'asinh', or signed-data 'symlog' / 'symmetric_log' (the latter requires pip install pysymlog).

  • scaletype (str) – 'abs' interprets min_max as data values; 'perc' as percentiles.

  • min_max (list) – [min, max] for the stretch. With scaletype='perc', use e.g. [1., 95.].

  • gamma (float) – Gamma applied after the stretch. Use 2.2 when combining colorized frames; use 1/2.2 only for legacy inverse workflows.

  • checkscale (bool) – If True, show a matplotlib comparison of input vs scaled preview.

  • dtype (numpy dtype or None) – Output dtype. Default preserves float64 behaviour. Pass numpy.float32 for a lower-memory interactive preview.

Returns:

array – Greyscale RGB image with shape (ny, nx, 3) and values in [0, 1].