mangadap.contrib.LambdaR_2D_forMaNGA module


The main goal of this script is to derive \(\lambda_R\) and \(V/\sigma\) radial profiles, given a set of coordinates \((x,y)\) and kinematic measurements (\(V\), \(\sigma\), but also associated flux, \(F\))

The standard formulae for \(\lambda_R\) comes from Emsellem et al. 2007, MNRAS 379, 401 and Emsellem et al. 2011, MNRAS 414, 888, while the formulae for \(V/\sigma\) done in the proper way with IFU come from Binney 2005, 363, 937.

\[\lambda_R = \frac{\sum F\ |V|}{\sum F\ (V^2 + \sigma^2)^{1/2}}\]


\[V / \sigma = \left( \frac{\sum F\ V^2}{\sum F\ \sigma^2} \right)^{1/2}\]

The main difference between \(\lambda_R\) and \(V/\sigma\) is that \(\lambda_R\) is providing a radius-biased view of the dynamical status and can be used as a proxy for apparent specific stellar angular momentum, while \(V/\sigma\) is flux-biased and more prone to changes due to small central structures. There is, however, a nice relation between the two (see the above- mentioned papers) which holds for regular kinematics.

Both quantities are derived within a given aperture (selected set of spaxels) and are therefore “cumulative” in the sense that they should include all spaxels within a certain “radius”. The advised selection is to follow the moment ellipticity of the system: the derivation of \(\lambda_R\) and \(V/\sigma\) thus require values for the ellipticity (Eps; \(\epsilon\)) and position angle (PA; \(\phi_0\)).

Source location:

Python2/3 compliance:

from __future__ import division
from __future__ import print_function
from __future__ import absolute_import

import sys
if sys.version > '3':
    long = int
    xrange = range


import numpy as np
from numpy import cos, sin, sum, sqrt
import scipy
from scipy import interpolate
import copy

Revision history:

version 1.1.1 - June 15, 2015: K. Westfall - inclusion in MaNGA DAP, minor modifications to docstrings, python 2/3 compliance.
version 1.1.0 - March 30, 2015: transformed for MaNGA usage
version 1.0.3 - August 20, 2014: added SigmaR
version 1.0.2 - August 19, 2014
version 1.0.1 - April 23, 2014
version 1.0.0 - August 12, 2011 : creation after 2006 module
class mangadap.contrib.LambdaR_2D_forMaNGA.Circle_Zone(params=None)[source]

Bases: mangadap.contrib.LambdaR_2D_forMaNGA.Selection_Zone

select(xin, yin)[source]

Define a selection within a circle

type = 'Circle'
mangadap.contrib.LambdaR_2D_forMaNGA.Derive_LR_VS_Profiles(X, Y, F, V, S, Rprofile=None, R_EpsPA=None, Eps=None, PA=None, maskDic=None, maskName=None, verbose=False, **kwargs)[source]

Compute the \(\lambda_R\) and \(V/\sigma\) parameters from a set of \((x,y)\) (positions) and \(V\), \(\sigma\) (stellar kinematics).

If an ellipticity profile is provided, it is used to select the points within growing apertures. Otherwise it uses a default ellipse value, constant over the full field.

Same with the position angle (in degrees), which can vary with radius or be constant.

Rprofile and R_EpsPA are the effective (Geometric) radius.


  • Documentation out of date. E.g., not all kwargs listed.
  • Convert result to a true class
  • raise exceptions instead of writing errors and returning
  • Y (X,) – Cartesian coordinates. Units can be arbitrary as \(\lambda_R\) and \(V/\sigma\) are dimensionless (but should be linear, so not RA, DEC) X, and Y should be associated with square spaxels but do not need to fill in a full rectangular grid. No default.
  • V, S (F,) – flux, stellar velocity and velocity dispersion measured at X, Y positions. Units are arbitrary as for X, Y (since the final result will be dimensionless) No default.
  • Rprofile (numpy.ndarray) – (Optional) Radius sampling imposed by the user. These are the radii where the profiles will be derived. Default to None, means that Rsampling will be automatically set up.
  • Eps, PA (R_EpsPA,) – ellipticity and Position Angle profiles, given as radii (R_EpsPA), ellipticity values (Eps) and position angle (degrees). If given (default to None), this profile will be used to derive the apertures.
  • maskDic – (Optional) ?
  • maskName – (Optional) ?
  • verbose (bool) – (Optional) Print some additional information if relevant.
  • Symmetrize (bool) – (via kwargs: default is True) to specify whether or not the fields should be symmetrized.
  • Re (float) – (via kwargs: default is 1) effective radius (in units of input X, Y)
  • Estimate_Vsys (bool) – (via kwargs: default is True) If True, estimate the systemic velocity (Systemic_Velocity is then overwritten). If False, value of Systemic_Velocity will be used.
  • Systemic_Velocity (float) – (via kwargs: default is 0.) Systemic Velocity to subtract from V.
  • Vaperture (float) – (via kwargs: default is 3.) Radius (in units of input X, Y) within which V will be summed to estimate the systemic velocity.
  • Maximum_Velocity (float) – (via kwargs: default is 400.) Threshold to select out stellar velocities.
  • Maximum_Dispersion (float) – (via kwargs: default is 500.) Threshold to select out stellar velocity dispersion.
  • Threshold_Cover (float) – (via kwargs: default is 1.25) Fraction of pixels which should be covered within an ellipse. Default to 1.25, meaning that if more than values for more than 20% of the pixels within the ellipse are missing, we stop the calculation (as it means that there are not enough points).
  • Threshold_Radius (float) – (via kwargs: default is 1.15) Same as Threshold_Cover but this time in terms of the ratio between the actual effective radius, and the effective radius of the corresponding ellipse.
  • Min_Radius (float) – (via kwargs: default is 1) Minimum radius to be considered in the profile.
  • Max_Radius (float) – (via kwargs: default is 50) Maximum radius to be considered in the profile.
  • N_Radius (int) – (via kwargs: default is 100) Number of points within the radius range.

A class that contains the results of the computation.

May return None if errors occur.

Return type:


mangadap.contrib.LambdaR_2D_forMaNGA.Get_CornersArray(X, Y, binstep)[source]

Return corners given a set of X and Y and a fixed binstep.

class mangadap.contrib.LambdaR_2D_forMaNGA.Rectangle_Zone(params=None)[source]

Bases: mangadap.contrib.LambdaR_2D_forMaNGA.Selection_Zone

select(xin, yin)[source]

Define a selection within a rectangle It can be rotated by an angle theta (in degrees)

type = 'Rectangle'
mangadap.contrib.LambdaR_2D_forMaNGA.Rotate_Corners(X1, X2, Y1, Y2, PA)[source]

Rotate corners of a grid and return all corners Using a PA in degrees

class mangadap.contrib.LambdaR_2D_forMaNGA.Selection_Zone(params=None)[source]

Bases: object

Parent class for Rectangle_Zone and Circle_Zone

mangadap.contrib.LambdaR_2D_forMaNGA.SymmetrizeField(X, Y, Z, odd=1, maskDic=None, maskName=None)[source]

Symmetrize a field. Only works when spaxels are located around a central spaxel.

  • X (numpy.ndarray) – x coordinates
  • Y (numpy.ndarray) – y coordinates
  • Z (numpy.ndarray) – input values
  • odd (bool) – (Optional) True if it is odd w.r.t. centre (X=0,Y=0). False if even.
  • maskName (maskDic,) – (Optional) Dictionary and name of masks

The symmetrized array (symmetrized Z values)

Return type:


mangadap.contrib.LambdaR_2D_forMaNGA.XY_toSemiMajor(X, Y, Eps)[source]

Transform X, Y into Semi-Major axis radii using a given ellipticity Input are:

X : array of X coordinate Y : array of Y coordinate Eps: float value for the ellipticity.
mangadap.contrib.LambdaR_2D_forMaNGA.check_cross_pixel(rpixels, rlimit)[source]

Check whether the ellipse is going THROUGH the pixel or not. Return an array of True (intersecting) or False (Not intersecting).

mangadap.contrib.LambdaR_2D_forMaNGA.derive_unbinned_field(xnodes, ynodes, data, xunb=None, yunb=None, mask_array=None)[source]

Provide an array of the same shape as the input xunb, and yunb with the values derived from the Voronoi binned data

  • xnodes (numpy.array) – arrays of Voronoi bin x positions
  • ynodes (numpy.array) – arrays of Voronoi bin y positions
  • data (numpy.array) – values for each node
  • xunb (numpy.array) – x coordinates of the unbinned data if not provided (default) they will be guessed from the nodes
  • yunb (numpy.array) – y coordinates of the unbinned data if not provided (default) they will be guessed from the nodes
  • mask_array (numpy.ndarray) – array with the same shape than xunb providing mask values for positions to ignore

(xunb, yunb, unbinned_data) arrays with the same

shape as xunb,

Return type:


mangadap.contrib.LambdaR_2D_forMaNGA.dist2(x1, y1, x2, y2, scale=1.0)[source]
mangadap.contrib.LambdaR_2D_forMaNGA.find_centereven(X, Y, Z, Radius=3.0, sel0=True)[source]

Find the central value for an even sided field.

  • X (numpy.ndarray) – x coordinates
  • Y (numpy.ndarray) – y coordinates
  • Z (numpy.ndarray) – values
  • Radius (float) – (Optional) Radius within which to derive the central value.
  • sel0 (bool) – (Optional) ?

The minimum and maximum value.

Return type:


mangadap.contrib.LambdaR_2D_forMaNGA.find_centerodd(X, Y, Z, Radius=3.0)[source]

Find central value for an odd sided field.

  • X (numpy.ndarray) – x coordinates
  • Y (numpy.ndarray) – y coordinates
  • Z (numpy.ndarray) – values
  • Radius (float) – (Optional) Radius within which to derive the central value.

The central value and some amplitude value (range about

that value?).

Return type:


mangadap.contrib.LambdaR_2D_forMaNGA.guess_regular_grid(xnodes, ynodes, pixelsize=None)[source]

Return a regular grid guessed on an irregular one (Voronoi).

  • xnodes (numpy.array) – arrays of Voronoi bin x positions
  • ynodes (numpy.array) – arrays of Voronoi bin y positions

(xunb, yunb) regular grid for x and y (unbinned)

Return type:


mangadap.contrib.LambdaR_2D_forMaNGA.interp_value_fromR(R=None, val=None, radius=None)[source]

Interpolation of a profile at a certain radius. Check if the radius is really within the given input range

If radius out of range, return the closest (in radius) value. This is thus different from the option of bounds_error of scipy.interpolate.interp1d which is used here.

  • R (numpy.ndarray) – (Optional) Input radii
  • val (numpy.ndarray) – (Optional) Input values. Should have the same size as R.
  • radius (float) – (Optional) Radius at which to interpolate

Value interpolated from the input data.

Return type:


mangadap.contrib.LambdaR_2D_forMaNGA.rotPA(X, Y, PA)[source]

Rotation of X and Y PA in degrees

mangadap.contrib.LambdaR_2D_forMaNGA.select_spaxels(maskDic, maskName, X, Y)[source]