In : from mpdaf.obj import Cube In : from mpdaf.drs import PixTable
All of the examples in the MPDAF web pages are shown being typed into
an interactive IPython shell. This shell is the origin of the prompts
In : in the above example. The examples can also be entered
in other shells, such as the native Python shell.
Loading your first MUSE datacube¶
MUSE datacubes are generally loaded from FITS files. In these files the fluxes and variances are stored in separate FITS extensions. For example:
# data and variance arrays are read from DATA and STAT extensions of the file In : cube = Cube('obj/CUBE.fits') In : cube.info() [INFO] 1595 x 10 x 20 Cube (obj/CUBE.fits) [INFO] .data(1595 x 10 x 20) (1e-40 erg / (Angstrom cm2 s)), .var(1595 x 10 x 20) [INFO] center:(-30:00:00.4494,01:20:00.4376) size:(2.000",4.000") step:(0.200",0.200") rot:-0.0 deg frame:FK5 [INFO] wavelength: min:7300.00 max:9292.50 step:1.25 Angstrom
The listed dimensions of the cube, 1595 x 10 x 20, indicate that the cube has 1595 spectral pixels and 10 x 20 spatial pixels. The order in which these dimensions are listed, follows the indexing conventions used by Python to handle 3D arrays (see Spectrum, Image and Cube format for more information).
Let’s compute the reconstructed white-light image and display it. The white-light image is obtained by summing each spatial pixel of the cube along the wavelength axis. This converts the 3D cube into a 2D image.
In : ima = cube.sum(axis=0) In : type(ima) Out: mpdaf.obj.image.Image In : plt.figure()