Exemple #1
0
def make_white_image(inputfile, outputfile, verbose=False):
    t0 = time()
    if outputfile is None:
        outputfile = inputfile.replace('DATACUBE', 'IMAGE')
    if outputfile == inputfile:
        sys.exit('Input and output files are identical')

    print('Creating white light image {}'.format(outputfile))
    cube = Cube(inputfile, convert_float64=False)
    if verbose:
        cube.info()

    im = cube.mean(axis=0)
    im.write(outputfile, savemask='nan')
    if verbose:
        print('Execution time {:.3f} seconds.'.format(time() - t0))
import matplotlib.pyplot as plt
import astropy.units as u
from mpdaf.obj import deg2sexa
from astropy.wcs import WCS

# Load data
files_list = ['CGCG007.fits', 'UGC5205.fits']
files_path = Path('D:/Google drive/Astrophysics/Datos/MUSE - Amorin')
files_address = list(files_path / file for file in files_list)
cube = Cube(filename=str(files_address[0]))

# Cube shape (lambda, Y, X) // Header shape (1, 2, 3) = (RA---TAN, DEC--TAN, AWAV) = (X, Y, lambda) // QfitsView (X, Y)
cube_size = cube.shape

# Fits properties
cube.info()

# Fits header
hdr = cube.data_header

# Reconstruct wave:
cube.wave.info()
dw = hdr['CD3_3']
w_min = hdr['CRVAL3']
nPixels = hdr['NAXIS3']
w_max = w_min + dw * nPixels
wave = np.linspace(w_min, w_max, nPixels, endpoint=False)

# Redshift correction
z = 0.0046
wave = wave / (1 + z)