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.

axis_increments_from_cd(cd)

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.

deg2dms(x)

Transform degrees to degrees:arcminutes:arcseconds strings.

deg2hms(x)

Transform degrees to hours:minutes:seconds strings.

deg2sexa(x)

Transform equatorial coordinates from degrees to sexagesimal strings.

determine_refframe(phdr)

Determine the reference frame and equinox in standard FITS WCS terms.

dms2deg(x)

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])

hms2deg(x)

Transform hours:minutes:seconds strings to degrees.

image_angle_from_cd(cd[, unit])

Return the rotation angle of the image.

is_float(x)

Test if x is a float number.

is_int(x)

Test if x is an int number.

is_number(x)

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.

sexa2deg(x)

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 one 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.

Spectrum1D_MPDAF([flux, spectral_axis, wcs, ...])

This class is inherited from the specutils.Spectrum1D class.

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.

Class Inheritance Diagram

digraph inheritance59ab8d6cdc { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ArithmeticMixin" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; "Cube" [URL="api/mpdaf.obj.Cube.html#mpdaf.obj.Cube",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="This class manages Cube objects, which contain images at multiple"]; "ArithmeticMixin" -> "Cube" [arrowsize=0.5,style="setlinewidth(0.5)"]; "DataArray" -> "Cube" [arrowsize=0.5,style="setlinewidth(0.5)"]; "CubeList" [URL="api/mpdaf.obj.CubeList.html#mpdaf.obj.CubeList",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Manages a list of cubes and handles the combination."]; "CubeMosaic" [URL="api/mpdaf.obj.CubeMosaic.html#mpdaf.obj.CubeMosaic",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Manages a list of cubes and handles the combination to make a mosaic."]; "CubeList" -> "CubeMosaic" [arrowsize=0.5,style="setlinewidth(0.5)"]; "DataArray" [URL="api/mpdaf.obj.DataArray.html#mpdaf.obj.DataArray",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Parent class for `~mpdaf.obj.Cube`, `~mpdaf.obj.Image` and"]; "FormatCoord" [URL="api/mpdaf.obj.FormatCoord.html#mpdaf.obj.FormatCoord",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Alter mouse-over coordinates displayed by plt.show()"]; "Gauss1D" [URL="api/mpdaf.obj.Gauss1D.html#mpdaf.obj.Gauss1D",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="This class stores 1D Gaussian parameters."]; "Gauss2D" [URL="api/mpdaf.obj.Gauss2D.html#mpdaf.obj.Gauss2D",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="This class stores 2D gaussian parameters."]; "Image" [URL="api/mpdaf.obj.Image.html#mpdaf.obj.Image",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Manage image, optionally including a variance and a bad pixel mask."]; "ArithmeticMixin" -> "Image" [arrowsize=0.5,style="setlinewidth(0.5)"]; "DataArray" -> "Image" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Moffat2D" [URL="api/mpdaf.obj.Moffat2D.html#mpdaf.obj.Moffat2D",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="This class stores 2D moffat parameters."]; "NDArithmeticMixin" [URL="https://docs.astropy.org/en/stable/api/astropy.nddata.NDArithmeticMixin.html#astropy.nddata.NDArithmeticMixin",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Mixin class to add arithmetic to an NDData object."]; "NDCube" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Class representing N-D data described by a single array and set of WCS transformations."]; "NDCubeBase" -> "NDCube" [arrowsize=0.5,style="setlinewidth(0.5)"]; "NDCubeABC" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; "NDDataBase" -> "NDCubeABC" [arrowsize=0.5,style="setlinewidth(0.5)"]; "NDCubeBase" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Class representing N-D data described by a single array and set of WCS transformations."]; "NDCubeABC" -> "NDCubeBase" [arrowsize=0.5,style="setlinewidth(0.5)"]; "NDData" -> "NDCubeBase" [arrowsize=0.5,style="setlinewidth(0.5)"]; "NDCubeSlicingMixin" -> "NDCubeBase" [arrowsize=0.5,style="setlinewidth(0.5)"]; "NDCubeSlicingMixin" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Mixin to provide slicing on objects using the `NDData`"]; "NDSlicingMixin" -> "NDCubeSlicingMixin" [arrowsize=0.5,style="setlinewidth(0.5)"]; "NDData" [URL="https://docs.astropy.org/en/stable/api/astropy.nddata.NDData.html#astropy.nddata.NDData",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A container for `numpy.ndarray`-based datasets, using the"]; "NDDataBase" -> "NDData" [arrowsize=0.5,style="setlinewidth(0.5)"]; "NDDataBase" [URL="https://docs.astropy.org/en/stable/api/astropy.nddata.NDDataBase.html#astropy.nddata.NDDataBase",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Base metaclass that defines the interface for N-dimensional datasets"]; "NDIOMixin" [URL="https://docs.astropy.org/en/stable/api/astropy.nddata.NDIOMixin.html#astropy.nddata.NDIOMixin",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Mixin class to connect NDData to the astropy input/output registry."]; "NDSlicingMixin" [URL="https://docs.astropy.org/en/stable/api/astropy.nddata.NDSlicingMixin.html#astropy.nddata.NDSlicingMixin",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Mixin to provide slicing on objects using the `NDData`"]; "OneDSpectrumMixin" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; "SpatialFrequencyLimits" [URL="api/mpdaf.obj.SpatialFrequencyLimits.html#mpdaf.obj.SpatialFrequencyLimits",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Allow one to keep track of the spatial frequency limits of an image."]; "Spectrum" [URL="api/mpdaf.obj.Spectrum.html#mpdaf.obj.Spectrum",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Spectrum objects contain 1D arrays of numbers, optionally"]; "ArithmeticMixin" -> "Spectrum" [arrowsize=0.5,style="setlinewidth(0.5)"]; "DataArray" -> "Spectrum" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Spectrum1D" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Spectrum container for 1D spectral data."]; "OneDSpectrumMixin" -> "Spectrum1D" [arrowsize=0.5,style="setlinewidth(0.5)"]; "NDCube" -> "Spectrum1D" [arrowsize=0.5,style="setlinewidth(0.5)"]; "NDIOMixin" -> "Spectrum1D" [arrowsize=0.5,style="setlinewidth(0.5)"]; "NDArithmeticMixin" -> "Spectrum1D" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Spectrum1D_MPDAF" [URL="api/mpdaf.obj.Spectrum1D_MPDAF.html#mpdaf.obj.Spectrum1D_MPDAF",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="This class is inherited from the `specutils.Spectrum1D` class. It lets the user to easily do the relationship between `Spectrum` object from mpdaf, and `Spectrum1D` objects from specutils."]; "Spectrum1D" -> "Spectrum1D_MPDAF" [arrowsize=0.5,style="setlinewidth(0.5)"]; "WCS" [URL="api/mpdaf.obj.WCS.html#mpdaf.obj.WCS",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="The WCS class manages the world coordinates of the spatial axes of"]; "WaveCoord" [URL="api/mpdaf.obj.WaveCoord.html#mpdaf.obj.WaveCoord",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="WaveCoord class manages world coordinates in spectral direction."]; }