mangadap.proc.spatialbinning module

Binning!

Revision history

01 Apr 2016: Implementation begun by K. Westfall (KBW)
22 May 2018: (KBW) Import vorbin package version of voronoi_2d_binning

License

Copyright © 2019, SDSS-IV/MaNGA Pipeline Group


class mangadap.proc.spatialbinning.GlobalBinning[source]

Bases: mangadap.proc.spatialbinning.SpatialBinning

Class that performs the global binning.

static bin_index(x, y, par=None)[source]
class mangadap.proc.spatialbinning.RadialBinning(par=None)[source]

Bases: mangadap.proc.spatialbinning.SpatialBinning

Class that performs the radial binning.

_r_start_step(r)[source]

Bin starting radii are:

rs = self.par['radii'][0]
re = self.par['radii'][1]
nr = int(self.par['radii'][2])
starting_radii = numpy.logspace(numpy.log10(rs), numpy.log10(re), num=nr,
                                endpoint=False) if self.par['log_step'] else                              numpy.linspace(rs, re, num=nr, endpoint=False)

For ending radii, just swap rs and re above

bin_area()[source]

Return the nominal area for each elliptical bin.

bin_index(x, y, par=None)[source]

Bin the data and return the indices of the bins.

class mangadap.proc.spatialbinning.RadialBinningPar(center=None, pa=None, ell=None, radius_scale=None, radii=None, log_step=None)[source]

Bases: mangadap.par.parset.KeywordParSet

Class with parameters used by the radial binning algorithm. See mangadap.par.parset.ParSet for attributes.

The defined parameters are:

Key Type Options Default Description
center ndarray, list A two-element array defining the center to use in the definition of the elliptical bins. This is defined as a sky-right offset in arcseconds from the nominal center of the object.
pa int, float Sets the position angle, defined from N through E of the major axis of the isophotal ellipse used to define the elliptical bins.
ell int, float Sets the ellipticity (1-b/a) of the isophotal ellipse use to define the elliptical bins.
radius_scale int, float Defines a scale factor to use when defining the radial bins. For example, you might want to scale to the a certain number of effective radii or physical scale in kpc. For no scale, use 1.0.
radii ndarray, list A three-element array defining the starting and ending radius for the bin edges and the number of bins to create. If the starting radius is -1, the inner-most radius is set to 0 when not using log bins or 0.1 arcsec when using logarithmically spaced bins. If the ending radius is -1, the outer-most radius is set by the spaxel at the largest radius.
log_step bool A flag that the radial bins should be a geometric series.
fromheader(hdr)[source]

Copy the information from the header.

hdr (astropy.io.fits.Header): Header object to write to.

toheader(hdr)[source]

Copy some of the parameters to a header.

Parameters:hdr (astropy.io.fits.Header) – Header object to write to.
Returns:Edited header object
Return type:astropy.io.fits.Header
Raises:TypeError – Raised if input is not an astropy.io.fits.Header object.
class mangadap.proc.spatialbinning.SpatialBinning(bintype, par=None)[source]

Bases: object

Base class for spatially binning data.

class mangadap.proc.spatialbinning.SquareBinning(par=None)[source]

Bases: mangadap.proc.spatialbinning.SpatialBinning

Class to perform binning of full cube in square apertures Length of aperture side is given in arcsec with binsz

bin_index(x, y, par=None)[source]

Bin the data and return the indices of the bins.

class mangadap.proc.spatialbinning.SquareBinningPar(binsz=None)[source]

Bases: mangadap.par.parset.KeywordParSet

Class with parameters used by the square binning algorithm. See mangadap.par.parset.ParSet for attributes.

The defined parameters are:

Key Type Options Default Description
binsz float Desired bin size in arcsec
fromheader(hdr)[source]

Copy the information from the header.

hdr (astropy.io.fits.Header): Header object to write to.

toheader(hdr)[source]

Copy some of the parameters to a header.

Parameters:hdr (astropy.io.fits.Header) – Header object to write to.
Returns:Edited header object
Return type:astropy.io.fits.Header
Raises:TypeError – Raised if input is not an astropy.io.fits.Header object.
class mangadap.proc.spatialbinning.VoronoiBinning(par=None)[source]

Bases: mangadap.proc.spatialbinning.SpatialBinning

Class that wraps the contributed voronoi binning code.

bin_index(x, y, par=None)[source]
sn_calculation_calibrate_noise(index, signal, noise)[source]

Calculate the S/N using a calibration of the S/N following:

\[N_{\rm calib} = N_{\rm nominal} (1 + \alpha\ \log N_{\rm bin})\]

where \(N_{\rm bin}\) is the number of binned spaxels and \(\alpha\) is an empirically derived constant used to adjust the noise for the affects of covariance.

sn_calculation_covariance_matrix(index, signal, noise)[source]

Calculate the S/N using a full covariance matrix.

sn_calculation_no_covariance(index, signal, noise)[source]

S/N calculation built to match the requirements of mangadap.contrib.voronoi_2d_binning().

This calculation is identical to the one provided directly by the code.

class mangadap.proc.spatialbinning.VoronoiBinningPar(target_snr=None, signal=None, noise=None, covar=None)[source]

Bases: mangadap.par.parset.KeywordParSet

Class with parameters used by the Voronoi binning algorithm.

See mangadap.par.parset.ParSet for attributes. See vorbin for the main algorithm.

The defined parameters are:

Key Type Options Default Description
target_snr int, float The target S/N for each bin.
signal ndarray, list The array of signal measurements for each on-sky position to bin.
noise ndarray, list The array of noise measurements for each on-sky position to bin. If not provided, covar must be provided and be a full covariance matrix.
covar float, ndarray, Covariance, spmatrix Covariance matrix or calibration normalization. For the latter, the value is used to renormalize using \(n_{\rm calib} = n_{\rm nominal} (1 + \alpha\ \log\ N_{\rm bin})\), where \(N_{\rm bin}\) is the number of binned spaxels and \(\alpha\) is the value provided.
fromheader(hdr)[source]

Copy the information from the header.

hdr (astropy.io.fits.Header): Header object to write to.

toheader(hdr)[source]

Copy some of the parameters to a header.

Parameters:hdr (astropy.io.fits.Header) – Header object to write to.
Returns:Edited header object
Return type:astropy.io.fits.Header
Raises:TypeError – Raised if input is not an astropy.io.fits.Header object.