在尝试堆叠三幅FITS图像时会得到非常蓝的图像,不确定为什么蓝色比其他图像穿透得更多,并且不确定如何单独调整
import numpy as np
from astropy.io import fits
from astropy.visualization import SqrtStretch
from astropy.visualization import ZScaleInterval
from astropy.visualization import make_lupton_rgb
from matplotlib import pyplot as plt
forCasting = np.float_()
r=fits.open('...Directory_to_file/Horsehead_Red.fts')[0].data
g=fits.open('...Directory_to_file/Horsehead_Green.fts')[0].data
b=fits.open('...Directory_to_file/Horsehead_Blue.fts')[0].data
r = np.array(r,forCasting)
g = np.array(g,forCasting)
b = np.array(b,forCasting)
stretch = SqrtStretch() + ZScaleInterval()
r = stretch(g)
g = stretch(b)
b = stretch(r)
plt.imshow(r, origin='lower')
plt.imshow(g, origin='lower')
plt.imshow(b, origin='lower')
lo_val, up_val = np.percentile(np.hstack((r.flatten(), g.flatten(), b.flatten())), (10, 80))
stretch_val = up_val - lo_val
rgb_default = make_lupton_rgb(r, g, b, minimum=lo_val, stretch=stretch_val, Q=0, filename="provafinale.png")
plt.imshow(rgb_default, origin='lower')
plt.show()