# Interface for spectra, images and cubes (mpdaf.obj)¶

The mpdaf.obj package provides a way to load a MUSE cube created by the MUSE pipeline (i.e. a 3GB FITS data cube of approximately 300x300x3680 pixels) into a Python object that manages spatial world-coordinates, wavelength world coordinates, pixel variances and bad pixel information.

It is then relatively easy to extract smaller cubes, narrow-band images or spectra from the cube. The world coordinates, associated variances and bad-pixel masks are propagated into these extracted cubes, images, and spectra. Many useful operations like masking, interpolation, re-sampling, smoothing and profile fitting are also provided.

Contents:

## Reference/API¶

### mpdaf.obj Package¶

#### Functions¶

 UnitArray(array, old_unit, new_unit) UnitMaskedArray(mask_array, old_unit, new_unit) airtovac(airwl) Convert air wavelengths to vacuum wavelengths. Return the angular increments of pixels along the Y and X axes of an image array whose coordinates are described by a specified FITS CD matrix. bounding_box(form, center, radii, shape[, …]) Return Y-axis and X-axis slice objects that bound a rectangular image region that just encloses either an ellipse or a rectangle, where the rectangle has a specified center position, Y-axis and X-axis radii, and a given rotation angle relative to the image axes. cleanSignal(signal, noise, levels[, …]) Filter an input signal by using the 1 standard deviation noise estimate and wavelets epsilon is the iteration-stop parameter for extracting signal from the residual signal. Transform degrees to degrees:arcminutes:arcseconds strings. Transform degrees to hours:minutes:seconds strings. Transform equatorial coordinates from degrees to sexagesimal strings. Determine the reference frame and equinox in standard FITS WCS terms. Transform degrees:arcminutes:arcseconds strings to degrees. flux2mag(flux, err_flux, wave) Convert flux from erg.s-1.cm-2.A-1 to AB mag. gauss_image([shape, wcs, factor, gauss, …]) Create a new image from a 2D gaussian. get_plot_norm(data[, vmin, vmax, zscale, scale]) Transform hours:minutes:seconds strings to degrees. image_angle_from_cd(cd[, unit]) Return the rotation angle of the image. Test if x is a float number. Test if x is an int number. Test if x is a number. iter_ima(cube[, index]) An iterator over the images of successive spectral pixels in a Cube iter_spe(cube[, index]) An iterator over the spectra of successive image pixels in a Cube mag2flux(mag, wave) Convert flux from AB mag to erg.s-1.cm-2.A-1 mask_sources(image[, sigma, iterations, …]) Create a mask of sources, using photutils. moffat_image([shape, wcs, factor, moffat, …]) Create a new image from a 2D Moffat function. plot_rgb(images[, title, scale, vmin, vmax, …]) Plot the RGB composite image with axes labeled in pixels. Transform equatorial coordinates from sexagesimal strings to degrees. vactoair(vacwl) Calculate the approximate wavelength in air for vacuum wavelengths. wavelet_backTransform(coefficients) Transform from wavelet to real space. wavelet_transform(signal, levels) Transform a signal into wavelet space.

#### Classes¶

 Cube([filename, hdulist, data, mask, var, …]) This class manages Cube objects, which contain images at multiple wavelengths. CubeList(files[, scalelist, offsetlist]) Manages a list of cubes and handles the combination. CubeMosaic(files, output_wcs, **kwargs) Manages a list of cubes and handles the combination to make a mosaic. DataArray([filename, hdulist, data, mask, …]) Parent class for Cube, Image and Spectrum. FormatCoord(image, data) Alter mouse-over coordinates displayed by plt.show() Gauss1D(lpeak, peak, flux, fwhm, cont, …) This class stores 1D Gaussian parameters. Gauss2D(center, flux, fwhm, cont, rot, peak, …) This class stores 2D gaussian parameters. Image([filename, ext, wcs, data, var, unit, …]) Manage image, optionally including a variance and a bad pixel mask. Moffat2D(center, flux, fwhm, cont, n, rot, …) This class stores 2D moffat parameters. SpatialFrequencyLimits(fmax, rot) Allow to keep track of the spatial frequency limits of an image. Spectrum([filename, hdulist, data, mask, …]) Spectrum objects contain 1D arrays of numbers, optionally accompanied by corresponding variances. WCS([hdr, crpix, crval, cdelt, deg, rot, …]) The WCS class manages the world coordinates of the spatial axes of MPDAF images, using the pywcs package. WaveCoord([hdr, crpix, cdelt, crval, cunit, …]) WaveCoord class manages world coordinates in spectral direction.