Advertisement
Guest User

Untitled

a guest
Sep 28th, 2024
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.50 KB | None | 0 0
  1. import numpy as np
  2. from astropy.io import fits
  3. from auto_stretch.stretch import Stretch # https://github.com/LCOGT/auto_stretch/
  4. from PIL import Image
  5.  
  6. fits_img = fits.open("result_.fit")
  7. data = fits_img[0].data
  8.  
  9. stretched = Stretch().stretch(data)
  10.  
  11. stretched = np.transpose(stretched , (1, 2, 0))
  12. stretched = ((stretched - stretched.min()) / (stretched.max() - stretched.min()) * 255).astype(np.uint8)
  13.  
  14. pil_image = Image.fromarray(stretched)
  15. pil_image.save("result_stretched.tif", format="TIFF")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement