CubeList

class mpdaf.obj.CubeList(files, scalelist=None, offsetlist=None)[source]

Bases: object

Manages a list of cubes and handles the combination.

To run the combination, all the cubes must have the same dimensions and be on the same WCS grid. A global flux offset and scale can be given for each cube: (data + offset) * scale.

Parameters:
fileslist of str

List of cubes FITS filenames.

scalelist: list of float, optional

List of scales to be applied to each cube.

offsetlist: list of float, optional

List of offsets to be applied to each cube.

Attributes:
fileslist of str

List of cubes FITS filenames.

nfilesint

Number of files.

flux_scaleslist of double

List of flux scales corrections.

flux_offsetslist of double

List of flux offsets corrections.

shapetuple

Lengths of data in Z and Y and X (python notation (nz,ny,nx)).

wcsmpdaf.obj.WCS

World coordinates.

wavempdaf.obj.WaveCoord

Wavelength coordinates

unitstr

Possible data unit type. None by default.

Attributes Summary

checkers

Methods Summary

check_compatibility()

Checks if all cubes are compatible.

check_dim()

Checks if all cubes have same dimensions.

check_wcs()

Checks if all cubes have same world coordinates.

combine([nmax, nclip, nstop, var, mad, header])

Combines cubes in a single data cube using sigma clipped mean.

info([verbose])

Print information.

median([header])

Combines cubes in a single data cube using median.

pycombine([nmax, nclip, var, nstop, nl, ...])

Combines cubes in a single data cube using sigma clipped mean.

pymedian([header])

save_combined_cube(data[, var, method, ...])

Attributes Documentation

checkers = ('check_dim', 'check_wcs')

Methods Documentation

check_compatibility()[source]

Checks if all cubes are compatible.

check_dim()[source]

Checks if all cubes have same dimensions.

check_wcs()[source]

Checks if all cubes have same world coordinates.

combine(nmax=2, nclip=5.0, nstop=2, var='propagate', mad=False, header=None)[source]

Combines cubes in a single data cube using sigma clipped mean.

Parameters:
nmaxint

Maximum number of clipping iterations.

nclipfloat or tuple of float

Number of sigma at which to clip. Single clipping parameter or lower / upper clipping parameters.

nstopint

If the number of not rejected pixels is less than this number, the clipping iterations stop.

var{‘propagate’, ‘stat_mean’, ‘stat_one’}
  • propagate: the variance is the sum of the variances of the N individual exposures divided by N**2.

  • stat_mean: the variance of each combined pixel is computed as the variance derived from the comparison of the N individual exposures divided N-1.

  • stat_one: the variance of each combined pixel is computed as the variance derived from the comparison of the N individual exposures.

madbool

Use MAD (median absolute deviation) statistics for sigma-clipping.

Returns:
cubeCube

The merged cube.

expmap: mpdaf.obj.Cube

Exposure map data cube which counts the number of exposures used for the combination of each pixel.

statpix: astropy.table.Table

Table that gives the number of NaN pixels and rejected pixels per exposures (columns are FILENAME, NPIX_NAN and NPIX_REJECTED).

info(verbose=False)[source]

Print information.

median(header=None)[source]

Combines cubes in a single data cube using median.

Returns:
outCube, mpdaf.obj.Cube, Table

cube, expmap, statpix

  • cube will contain the merged cube

  • expmap will contain an exposure map data cube which counts the number of exposures used for the combination of each pixel.

  • statpix is a table that will give the number of Nan pixels pixels per exposures (columns are FILENAME and NPIX_NAN)

pycombine(nmax=2, nclip=5.0, var='propagate', nstop=2, nl=None, header=None, mad=False)[source]

Combines cubes in a single data cube using sigma clipped mean.

This is less optimized but more flexible version, compared to CubeList.combine. It is useful mostly for CubeMosaic, where we need to shift the individual cubes into the output one.

Parameters:
nmaxint

Maximum number of clipping iterations.

nclipfloat or tuple of float

Number of sigma at which to clip. Single clipping parameter or lower / upper clipping parameters.

nstopint

If the number of not rejected pixels is less than this number, the clipping iterations stop.

var{‘propagate’, ‘stat_mean’, ‘stat_one’}
  • propagate: the variance is the sum of the variances of the N individual exposures divided by N**2.

  • stat_mean: the variance of each combined pixel is computed as the variance derived from the comparison of the N individual exposures divided N-1.

  • stat_one: the variance of each combined pixel is computed as the variance derived from the comparison of the N individual exposures.

madbool

Use MAD (median absolute deviation) statistics for sigma-clipping.

Returns:
cubeCube

The merged cube.

expmap: mpdaf.obj.Cube

Exposure map data cube which counts the number of exposures used for the combination of each pixel.

statpix: astropy.table.Table

Table that gives the number of NaN pixels and rejected pixels per exposures (columns are FILENAME, NPIX_NAN and NPIX_REJECTED).

rejmap: Cube

Cube which contains the number of rejected values for each pixel.

pymedian(header=None)[source]
save_combined_cube(data, var=None, method='', keywords=None, expnb=None, unit=None, header=None)[source]