SciELO - Scientific Electronic Library Online

 
vol.60 número1Radio Proper Motions of the Nearby Ultra-Cool Dwarf Binary VHS 1256-1257ABThe Calar Alto Legacy Integral Field Area Survey: Spatial Resolved Properties índice de autoresíndice de materiabúsqueda de artículos
Home Pagelista alfabética de revistas  

Servicios Personalizados

Revista

Articulo

Indicadores

Links relacionados

  • No hay artículos similaresSimilares en SciELO

Compartir


Revista mexicana de astronomía y astrofísica

versión On-line ISSN 3061-8649versión impresa ISSN 0185-1101

Rev. mex. astron. astrofis vol.60 no.1 Ciudad de México abr. 2024  Epub 18-Nov-2025

https://doi.org/10.22201/ia.01851101p.2024.60.01.03 

Articles

XookSuut: A Bayesian Tool for Modeling Circular and Non-Circular Flows on 2D Velocity Maps

C. López-Cobá1 

Lihwai Lin1 

Sebastián F. Sánchez2 

1 Institute of Astronomy & Astrophysics, Academia Sinica, 106, Taipei, Taiwan, (calopez@asiaa.sinica.edu.tw), (lihwailin@asiaa.sinica.edu.tw)

2 Instituto de Astronomía, Universidad Nacional Autónoma de México, Circuito Exterior, Ciudad Universitaria, Ciudad de México 04510, Mexico, (sfsanchez@astro.unam.mx)


ABSTRACT

We present XookSuut, a Python implementation of the DiskFit algorithm, optimized to perform robust Bayesian inference on parameters describing models of circular and noncircular rotation in galaxies. XookSuut surges as a Bayesian alternative for kinematic modeling of 2D velocity maps; it implements efficient sampling methods, specifically Markov Chain Monte Carlo (MCMC) and Nested Sampling (NS), to obtain the posteriors and marginalized distributions of kinematic models including circular motions, axisymmetric radial flows, bisymmetric flows, and harmonic decomposition of the LoS velocity. In this way, kinematic models are obtained by pure sampling methods, rather than standard minimization techniques based on the χ2. All together, XookSuut represents a sophisticated tool for deriving rotational curves and to explore the error distribution and covariance between parameters.

Key Words: galaxies: kinematics and dynamics; software: data analysis

RESUMEN

Presentamos XookSuut, una implementación en Python del algoritmo DiskFit, optimizado para realizar inferencia Bayesiana robusta sobre parámetros que describen modelos cinemáticos de rotación circular y no circular en galaxias. XookSuut es una alternativa Bayesiana para el modelado cinemático de mapas dos dimensionales; el código implementa métodos de muestreo eficientes, específicamente Markov Chain Monte Carlo y Nested Sampling, para obtener las distribuciones posteriores de modelos cinemáticos entre ellos: movimientos circulares, flujos axisimétricos, flujos bisimétricos y una descomposición en harmónicos del campo de velocidad. Así, los modelos cinemáticos son derivados por métodos de muestreo en vez de adoptar técnicas de minimización basadas en la χ2. XookSuut es ideal para derivar curvas de rotación y explorar la distribución de errores y covarianza entre parámetros.

1 Introduction

The rotation pattern observed on two-dimensional velocity maps is the result of the gravitational potential and the mass distribution in a galaxy, together with environmental factors and projection effects [e.g., Rubin & Ford 1970; Binney 2008. In disk-like systems the rotation, or azimuthal velocity, is the dominant velocity component. When this velocity is plotted against the galactocentric distance it describes the rotational curve of a galaxy (e.g. Rubin & Ford 1970; Rubin et al. 1980).

Since early studies of the neutral hydrogen distribution in nearby galaxies, it was possible to obtain resolved velocity fields (e.g., Warner et al. 1973); these Hi velocity maps showed ordered kinematic patterns that, in most cases, could be described by pure circular rotation (e.g., Wright 1971; Begeman 1989; de Blok et al. 2008). Since then, many efforts have been done for recovering rotation curves of galaxies, not only with Hi data, but also with molecular and ionized gas observations. [Begeman(1987), Begeman(1989)] introduced a methodology to extract the rotational velocity curve from two-dimensional (2D) velocity maps based on the so-called tilted rings. This idea became the core of most of the algorithms focused on the determination of the rotation curves of galaxies, for instance the GIPSY task ROTCUR (e.g., Begeman 1987). The tilted ring model assumes that the observed velocity field can be described by pure circular motions with possible variations in the projection angles. From it, several algorithms have been developed to study the kinematic structures of galaxies. On one side are those who uses 3D data-cubes, for instance 3DBarolo (e.g., Di Teodoro & Fraternali 2015), TiRiFiC (e.g., Józsa et al. 2007), GalPak3D (e.g., Bouch´e et al. 2015), KinMSpy (Davis et al. 2013). In a second category are those which work on velocity fields, such as RESWRI (e.g., Schoenmakers 1999), DiskFit (e.g., Sellwood & Spekkens 2015), 2DBAT (e.g., Oh et al. 2018), and KINEMETRY (e.g., Krajnovi´c et al. 2006) among others.

3D algorithms have the advantages of extracting all the information from the datacubes. These methods model the entire datacubes, which allows them to correct for beam smearing effects and also to handle projection effects. However, the inclusion of datacubes usually involves the addition of extra parameters during the fitting process, which in most cases involves longer computing times depending on the dimensions of the datacube and the fitting routine. On the other hand, 2D algorithms work on the projected line of sight velocity (LOSV); for this reason they tend to be faster than 3D methods. If galaxies are not severely affected by spatial resolution effects, (i.e., the observational point spread function, PSF), both methods show consistent results for rotational velocities (e.g., Kamphuis et al. 2015).

Nevertheless, non-circular motions driven by structural components of galaxies (such as spiral arms, bars, bulge), or by angular momentum loss, are not included within the circular rotation assumption (e.g., Kormendy 1983; Lacey & Fall 1985; Wong et al. 2004); nor are those motions induced by internal processes (stellar winds, Hii regions, shocks, outflows). Altogether, and taking into account projection effects, the modeling of non-circular motions is a big challenge. Only a few algorithms take into account deviations of circular motions, among which are: TiRiFiC, ideal for modeling warped disks; DiskFit, suitable to model bar-like and radial flows; and KINEMETRY to model non-circular motions of any order through harmonic decomposition.

For deriving rotational curves, most algorithms adopt frequentist methods that minimize the residuals from a model function and the data, and those parameters that minimize the residuals are chosen for creating the kinematic model that better describes the data. This means that from a frequentist perspective, there is a single set of true parameters that describes the data. Conversely, Bayesian methods assume that model parameters are totally random variables, and each parameter has associated a probability density function. In this way solutions are based on the likelihood of a parameter given the data; that is, on the posterior distribution of the parameters.

These are two different perspectives to estimate the parameters from a model. Rotational curves are often described by several parameters, which makes it a high-dimensional problem, and therefore susceptible to find local solutions. Therefore, it is worth exploring methods that survey the parameter space of kinematic models to derive the best representation of the observed rotation patterns of disk galaxies.

In this paper we introduce XooSuut1(or XS for short). This is a Python tool that implements Bayesian methods for modeling circular and noncircular motions on 2D velocity maps. The name of this tool is a combination of two Mayan words: Xook which means “study” and Suut which means “rotation”.

This paper is organized as follows. In § 2 we describe the different kinematic models included in XookSuut. In § 3 we describe the algorithm, the fitting procedure, and the error estimations. In § 4 we show the performance of this code when it is applied on simulated velocity fields of galaxies with oval distortions, as well as on real velocity maps. In § 5 we discuss our results. Finally, in § 6 we present our conclusions.

2 Kinematic models

In this section we describe the kinematic models included in XookSuut. We start with the simplest model, which is the circular rotation model, then we add a radial term for modeling radial flows. A bisymmetric model is included for describing oval distortions (i.e., bar-driven flows); finally, XookSuut includes a more general harmonic decomposition of the line of sight velocity, for a total of three non-circular rotation models. For constructing these models, XookSuut assumes that galaxies are flat and circular systems and that they are viewed in projection, with a constant position angle (ϕdisk')2, fixed inclination (i), fixed kinematic center (x0,y0) and constant systemic velocity throughout the disk. The flat disk approximation represents the more suitable assumption whenever the spatial resolution of the data, i.e., the point spread function, dominates over the typical thickness of disks. With these assumptions, galaxies with strong warped disks are excluded. In addition, systems where the inclination or position angle varies as a function of the galactocentric distance are also excluded, since radial variations in these angles induce artificial non-circular motions when observed in projection, and such contributions to the line-of-sight velocities would be difficult to discern from true non-circular motions (e.g., Schoenmakers et al. 1997).

XookSuut adopts the methodology introduced by DiskFit (e.g., Sellwood & Spekkens 2015) diskfit for creating a two dimensional interpolated map of the referred kinematic models and described in the following sections.

2.1 Circular Model

The simplest model included in XookSuut is the circular rotation model, which is the most frequently adopted for describing the rotation of galaxies. It assumes no other movements than pure circular motions in the plane of the disk and describes the rotation curve of disk galaxies.

Assuming that particles follow circular orbits on the disk, the circular model is given by the projection of the velocity vector V along the line-of-sight direction:

Vcirc,model=Vsys+Vt(r)sinicosθ . (1)

V t is the circular rotation or azimuthal velocity and is a function of the galactocentric distance; Vsys is the systemic velocity and is assumed constant for all points in the galaxy. In this equation and in the following, r is the radius of a circle in the disk plane, which projects into an ellipse in the sky plane. The angle θ is the azimuthal angle relative to the disk major axis, and i is the disk inclination angle.

2.2 Radial Model

When radial motions are not negligible, the disk circular velocity is described by two components of the velocity vector: the tangential velocity (Vt) and the radial one (Vr). In this way, the model including radial velocities is described by the following expression:

Vrad,model=Vsys+sini(Vt(r)cosθ+Vr(r)sinθ). (2)

Comparing with equation 1, the only difference is the addition of the Vrsinθ term. This term accounts for axisymmetric radial flows (inflow or outflow) on the disk plane.

2.3 Bisymmetric Model

The bisymmetric model describes an oval distortion on the velocity field, such as that produced by stellar bars (e.g., Spekkens & Sellwood 2007; Sellwood & Spekkens 2015), or by a triaxial halo potential. In the presence of an oval distortion particles follow elliptical orbits elongated towards an angle that in general differs from that of the disk position angle (e.g., Spekkens & Sellwood 2007). This kinematic distortion shows a characteristic “S” shape in the projected velocity field that makes the minor and major axes not orthogonal (e.g., Kormendy 1983). Given that this pattern has been mostly observed in the velocity field of barred galaxies, we will refer to the origin of the oval distortion to stellar bars, although it is not necessarily the case, as mentioned before. The model that intends to describe this pattern is called bisymmetric model (e.g., Spekkens & Sellwood 2007) since most of the perturbation is kept in the second order of an harmonic decomposition on the disk plane. The bisymmetric model is described by following the expression:

Vbis,model=Vsys+sini(Vt(r)cosθ-V2,t(r)cos2θbarcosθ-V2,r(r)sin2θbarsinθ) . (3)

V2,t and V2,r are the nonaxisymmetric velocities induced by the oval distortion and represent, respectively, the tangential and radial deviations from V t , where the latter describes the disk circular rotation. The angular variable θbar is the location relative to the position angle of the bar ( ϕbar ), in this way3:

θbar=θ-ϕbar . (4)

Note that in this expression both angles are measured on the disk plane. If ϕbar represents the major (minor)-axis position angle of a bar, then both V2,t(r) and V2,r(r) have positive (negative) values. Unlike the disk position angle ϕdisk' , ϕbar is not a variable than can be easily recognized from the velocity field of barred galaxies; however, its projection on the sky plane is related to ϕdisk' and the disk inclination angle, as follows:

ϕbar'=ϕdisk'+arctan(tanϕbarcosi) , (5)

where ϕbar' is the position angle of the bar on the sky plane. Computationally, it is more practical to estimate ϕbar instead of ϕbar'. When the oval distortion is produced by a stellar bar, ϕbar' is expected to be aligned with the photometric position angle of the bar, while the radial profile of V2r(r) and V2t(r) should extend to the length of the bar.

2.4 Harmonic Decomposition

Similar to the photometric decomposition of galaxy images into light profiles via Fourier expansions, the line of sight (LoS) velocity field of a galaxy can be expressed as a sum of harmonic terms as follows:

Vhrm,model=Vsys +m=1M(cm(r)cosmθ+sm(r)sinmθ)sini , (6)

where c m and s m are the harmonic velocities, m is the harmonic number, and θ and r have the same meaning as before. For convenience we have taken the inclination angle out of the Fourier expansion; also note that the 0th order of the expansion c0(r) is assumed a constant equal to the systemic velocity. However, in addition to the expansion up to M = 1, where we recover the radial model, note that c1Vt and s1Vr; the expansion to higher orders does not offer a direct interpretation of c m and s m since these terms represent a mere decomposition of the LoS velocities, although it is possible to assign to these velocities a physical meaning. The harmonic number is closely related to perturbations of the gravitational potential; under the epicycle theory, such perturbations will induce the appearance of harmonic sectors in the LoS velocities in such a way that if the gravitational potential contains a perturbation of order m, the LoS velocities contain the m + 1 and m - 1 harmonic terms of the Fourier expansion (see Schoenmakers et al. 1997, for a detailed description). For instance, a bar-potential can be described by a 2nd order perturbation, which means that the LoS velocity field will contain the 1st and 3rd harmonic terms of equation 6 (e.g., Wong et al. 2004; Fathi et al. 2005). Similarly, this analysis can be extended for the case of spiral arms (e.g., van de Ven & Fathi 2010).

In XooSuut the harmonic model, (equation 6), can be expanded to any harmonic order, although, most of the non-circular motions induced by spiral arms or bars are captured by a third order expansion (e.g., Trachternach et al. 2008).

The harmonic model was first included in the GIPSY task RESWRI I (e.g., Schoenmakers 1999) RESWRI under the assumption of a thin disk. Afterwards the harmonic decomposition was generalized in KINEMETRY (e.g., Krajnovi´c et al. 2006) Kinemetry including not only disks but also triaxial structures. The major difference between RESWRI and XooSuut is the assumption of a flat disk. While RESWRI and KINEMETRY allow varying the disk position angle and inclination during the fitting analysis, XookSuut keeps these angles fixed to allow the residual velocities of a circular model to be adjusted with non-circular motions and not absorbed by the variations of these angles, as explained before. However, when large variations of ϕdisk' or i are present throughout the disk, XookSuut will fail in the interpretation of the harmonic velocities, even when the fit is successful.

3 The algorithm

XookSuut works on 2D velocity maps, such as those extracted from first moment maps from data-cubes. As others codes that rely on 2D maps for kinematic modelling, XookSuut assumes that the velocity recorded in each pixel is representative of the disk velocity. In this sense, there are a wide variety of methods for representing the velocity field of a galaxy, and many of these depend on the spectral resolution and the signal-to-noise of the data; going from simple first moment maps, to modeling Gaussian profiles in combination with Hermite polynomials to better reproduce the shape of the emission lines (see de Blok et al. 2008; Sellwood et al. 2021, for a revision of different methods).

For XookSuut to obtain confident estimations of the kinematic models, the data should not be strongly affected by the point-spread-function. The PSF contributes to increase the velocity dispersion of the emission-lines and consequently to underestimate the rotation velocities, particularly in the inner gradient of the rotation curve. In such a case, a 3D modeling of the datacubes should be a better approach (e.g., Di Teodoro et al. 2016). Under the previous assumptions the algorithm proceeds in the following way.

Let (xn,yn) be the position of a data point in the sky plane. The corresponding ellipse passing through this point, with center (x0, y0) and rotated by an angle ϕdisk' is described by:

xe=-(-xn-x0)sinϕdisk'+(yn-y0)cosϕdisk' , (7)

ye=-(xn-x0)cosϕdisk'-(yn-y0)sinϕdisk' . (8)

The radius of the circle on the disk plane passing through this point is then:

rn2=xe2+(yecosi)2. (9)

The azimuthal angle on the disk plane θ, is related to the sky coordinates as follows:

cosθ=-(-xn-x0)sinϕdisk'+(yn-y0)cosϕdisk'rn, (10)

sinθ=-(xn-x0)cosϕdisk'-(yn-y0)sinϕdisk'rncosi. (11)

Therefore, θ comprises both projection angles ϕdisk' and i, as well as the kinematic center, thus contributing with four more free variables in each kinematic model (although it is represented by a single variable for simplicity). Henceforth, we define “constant parameters” as those variables that do not change with radius; they are: ϕdisk', i, x0, y0, Vsys, ϕbar. We will also refer as “geometric parameters” to those variables that describe the orientation of the projected ellipse on the sky plane, namely ϕdisk', i, x0, y0.

3.1 χ2 Minimization Technique

As we will see in further sections, Bayesian methods like MCMC require to start sampling around the maximum a posteriori, or maximum likelihood, to generate new samples also known as chains; this requires necessarily to find those parameters that minimize the residuals from a given kinematic model and the data. Therefore, in the following we describe the method to solve for each of the different kinematic components of the models, and the constant parameters. The first part corresponds to the analysis adopted in DiskFit (e.g., Spekkens & Sellwood 2007; Sellwood & Spekkens 2015) with minimum changes.

A given set of initial conditions for the geometric parameters defines the projected disk with an elliptical shape on the sky plane. Ideally, the initial conditions for the gaseous disk geometry should be close to that of the stellar disk. This geometry will be the starting configuration for the minimization analysis; then, the field of view is divided into K concentric rings of fixed width that follow the same orientation as before. The maximum length of the ellipse semi-major axis can be easily set-up as described in Appendix A; this will create a 2D mask and only those pixels inside this maximum ellipse will be considered for the analysis. The geometry of this mask will be adapted in subsequent iterations until reaching the orientation that better describes the observed velocity field.

The algorithm will solve for each ring a set of velocities that will depend on the kinematic model considered, namely equations 1-3 or equation 6 . Thus, the number of different velocity components to derive will be K velocities in the circular model (Vt,K); 2K in the radial model (Vt,K, Vr,K); 3K in the bisymmetric model (Vt,K, V2r,K, V2t,K) and 2MK in the harmonic model (c1,K,...,cM,K,s1,K,...,sM,K).

The velocity map consists of a two-dimensional image of size nx×ny, with N observed data points Dn with individual errors σn. Let V be the set of velocities that describe the corresponding kinematic model (namely, V=Vt, V2,t,V2,r for the bisymmetric model and similarly for other models). Frequentist methods adopt the chi-square χ2, to derive from a model the set of parameters that describes the data. In this case, the reduced χr2 for the different kinematic models is given by:

χr2=1νn=1NDn-k=1KWk,nVkσn2. (12)

Here v is the total number of degrees of freedom (i.e., ν=N-Nvarys, and Nvarys is the number of parameters to estimate from the model ); Wk,n are a set of weights that depend on the pixel position, and will serve to define an interpolated model; and Vk is the set of velocities in the k-th ring that describes the considered kinematic model.

Each kinematic component from Vk would require different weights. For instance, for the circular model the weights adopt the following expression:

Wk,nt=sinicosθ*wk,n, (13)

where the super-index t makes reference to the circular rotation component. The radial model requires two different weights for the different kinematic components:

Wk,nt=sinicosθ*wk,n, (14)

Wk,nr=sinisinθ*wk,n. (15)

Similarly, the bisymmetric model would require three different weights:

Wk,nt=sinicosθ*wk,n, (16)

Wk,n2r=sinicosθcos2θbar*wk,n, (17)

Wk,n2t=sinisinθsin2θbar*wk,n. (18)

Finally, the harmonic decomposition model will have 2M weights given by:

Wk,nc=m=1Msinicosmθ*wk,n, (19)

Wk,ns=m=1Msinisinmθ*wk,n. (20)

Note that for M = 1 it reduces to the radial model.

The wk,n terms define the interpolation method to be performed between the K-rings. As in DiskFit, these weights adopt the form of a simple linear interpolation given by the usual expression:

wk,n=(rk+1-rnδrk), (21)

wk+1,n=(rn-rkδrk), (22)

where r k and r k+1 are the position of the k th and (k+1)th rings respectively, and δrk=rk+1-rk is the spacing between rings. As the first ring (k = 1) cannot be placed at the kinematic centre, XookSuut implements different strategies for assigning velocities to pixels down the first ring. Depending on the spatial resolution of the data or the signal-to-noise ratio (S/N), one may opt for one of the following extrapolation options.

The first method is to assume that velocities grow linearly from zero to the velocities derived in the first ring (V1). This implies that V0=0 at r = 0; therefore, the kinematic center does not rotate. In the second approach, the set of velocities and positions (V1,r1) and (V2,r2) are used to extrapolate velocities to pixels down r 1; in this way V00 at r = 0. The third option allows the user to fix the velocity at the origin to some value. Then V0 and V1 are linearly interpolated for sampling pixels down r 1.

As Vk is linear in equations 1-3 and equation 6, we can set the derivative with respect to Vj in equation 12, giving as result:

χr2Vj=2νn=1NDn-k=1KWk,nVkσnWj,nσn=0. (23)

Rearranging this expression we obtain:

k=1Kn=1NWk,nσnWj,nσnVk=n=1NWj,nσn2Dn. (24)

The minimization technique from equation 24 was first introduced by Barnes & Sellwood (2003), and subsequently incorporated into DiskFit (Sellwood & Spekkens 2015). Here, equation 24 is generalized for the harmonic decomposition model. The latter expression is a system of linear equations for the Vk unknowns; thus Vk values are solved arithmetically. As mentioned before, the number of velocity components Vk depends on the number of rings and the adopted kinematic model; therefore the dimensions of the matrix to solve will increase as more rings are included in the analysis, and as the kinematic model becomes more complex.

Given a set values for the constant parameters and K rings positioned at r k on the disk plane, we can solve for Vk in equation 24 by assigning uniform weighting factors (wk,n=1). This way we are obtaining a row-stacked velocities (r k vs. V k ). In essence the row-stacked velocities represent the average velocity of each ring; then, we use these velocities as initial conditions to perform an iteratively least squares analysis (LS) through equation 12, but now with the proper weighting factors (namely equations 13-19). Note that if the initial geometric parameters passed to the algorithm are close the true ones, then the arithmetic solutions to Vk should be close the true velocities. This can speedup the MCMC sampling as we will see in further sections.

The minimization procedure in equation 12 is performed by constructing a 2D model from the interpolation weights of equation 21. In each χ2 iteration a new set of velocities Vk' are obtained, together with a new set of constant parameters. The latter will define a new geometry for the mask, and new row-stacked velocities will be obtained for the next iteration. Multiple rounds of χ2 minimization will be performed up to some maximum iteration defined by the user, or until the difference in χ2 evaluations varies less that 10%. Commonly after three iterations the disk geometry becomes stable and simultaneously VK. Figure 1 summarizes all the fitting procedure in a flowchart.

Figure 1: Flowchart of the fitting procedure to derive the best kinematic model. 

Rings not proper sampled with data may give absurd values of Vk when solving equation 24. To avoid this problem, we define a covering factor to guarantee a minimum number of data per ring. If the covering factor is 1, it means that rings must be 100% occupied by data to estimate Vk, as described in Appendix A. In addition, isolated pixels in the image due to low S/N may not be desired during the analysis XookSuut allows to remove these pixels by excluding those with velocity errors greater than certain threshold defined by the user.

To perform the LS analysis in equation 12, XookSuut adopts the Levenberg-Marquardt (LM) algorithm included in the lmfit package (e.g. Newville et al. 2014). This algorithm has the advantage that it is fast, although it is widely known to be susceptible to getting trapped at a local minimum. Note that DiskFit adopts the Powell method since this method only performs evaluation of functions with no derivatives performed.

So far the algorithm adopts an LS method for deriving the best parameters defined by the kinematic models. In the following we use sampling methods to infer the posterior distributions of the parameters.

3.2 Bayesian Analysis

The novelty of XookSuut resides in the estimation of the posterior distribution of the non-circular motions and the model parameters. Given the high-dimension of the models, it is desired to perform a thorough analysis of the prior space to obtain the most likely solutions to the problem for each kinematic model regardless of its complexity. For this purpose we adopt Bayesian inference methods for sampling their posterior distributions. Other packages like 2DBAT and KinMSpy (i.e., Oh et al. 2018; Davis et al. 2013) also use Bayesian approaches for extracting rotational curves of galaxies. The difference is that KinMSpy is able to fit non-circular motions (radial and bisymmetric).

According to Bayes’ theorem, given a set of data D described by a model function M with parameters α=α1, α2, .., αn, the posterior distribution of α given D follows the expression:

p(α|D,M)=p(D|α,M)p(α)p(D,M) , (25)

where p(α|D,M) is the joint posterior distribution of the whole set of parameters; p(D|α,M) is the probability density of the data given the parameters and the assumed model; p(α) is the prior probability distribution of the parameters and p(D,M) is a normalization constant also know as marginal evidence or evidence. It is common to find equation 25 expressed in terms of the likelihood function L, as follows:

p(α|D,M)=L(α)p(α)Z , (26)

with the evidence defined as:

Z=ΩαL(α)p(α)dα , (27)

where the integral is computed over all the parameter space defined by the priors, Ωα. The evidence can be interpreted as the likelihood of the observed data under the model assumptions; in other words, it is the average of the likelihood over the priors.

The final goal of Bayesian inference is to obtain the posterior distribution p(α|D,M) of all parameters α describing the model function M. Multiple methods have been developed for this purpose. For instance, Markov-Chain Monte Carlo (MCMC) methods evaluate the unnormalized posterior distribution (i.e., p(α|D,M)L(α)p(α)), by generating samples or chains from the likelihood function. One of the main characteristics of Markov chains is that the position of a point in the chain depends only on the position of the previous step. Different algorithms with automating chain tunning have been developed to efficiently sample the posterior distribution. Among the most popular MCMC samplers are those who implement affine-invariant ensemble sampling and ensamble slice sampling (e.g., Foreman-Mackey et al. 2013; Karamanis et al. 2021).

Other methods, such as nested sampling (NS, Skilling 2006), are designed to compute the evidence by numerical integration of equation 27, which often makes them computationally more expensive than MCMC methods. This integral is performed from the priors space (or prior volume), and unlike MCMC, does not require an initialization point. Nevertheless, computing the evidence is crucial for model comparison as it represents the degree to which the data are in agreement with the model. Although the main goal of NS is to compute the evidence, the posterior distribution is obtained as a by-product; because of that, NS methods are becoming popular for the inference of parameters in astronomy (see Ashton et al. 2022, for a thorough description of the method).

One of the advantages of nested sampling with respect to MCMC methods is regarding the convergence criteria. There is no defined convergence criteria among MCMC algorithms, although some of them are based on the number of independent samples in the chains, the so-called integrated autocorrelation time (IAT); however this is often evaluated a posteriori. If the whole chain contains between 10-50 times the IAT, then it is a good indicator that chains are converging (Foreman-Mackey et al. 2013; Karamanis et al. 2021). In contrast, in nested sampling the stopping evaluation criterion is well defined, since sampling stops after the whole prior space has been integrated.

A detailed discussion of these two sampling methods is, however, beyond the scope of this paper. Following we show the implementation of MCMC and nested sampling methods for the parameter extraction of the kinematic models presented in Sec. 2.

3.2.1 Likelihood and Priors

Let α be all the parameters that describe any of the kinematic models. Then, the log posterior distribution of the parameters is given by:

lnp(α|D,M)=lnL(α)+lnp(α)-lnZ. (28)

The likelihood function is a key term in Bayesian inference, since it will define the shape of the posterior distributions. The most common distribution for the likelihood is Gaussian, but other distributions like Cauchy, T-student, or the absolute value of the residuals are also adopted in the literature (e.g., Di Teodoro & Fraternali 2015; Bouché et al. 2015; Oh et al. 2018). XookSuut adopts the Gaussian distribution as the main likelihood function, although the Cauchy distribution is also included (see Appendix B). The individual likelihood for each data point Dn with error σn is expressed as:

L(αn)=(2πσn)-1/2 exp-(Dn-Mn)22σn2 , (29)

and the joint likelihood for the data set is the product of individual likelihoods, in this way

L=(2π)-N/2n=1Nσnexp-n=1N(Dn-Mn)22σn2. (30)

It is easy to recognize from this expression that the summation is the χ2 from Eq 12, with Mn being the kinematic model function, Vmodel. In this way the log posterior distribution of the parameters is expressed as:

lnpαD,Vmodel=-12n=1N(Dn-k=1KWk,nVk)2σn2-lnσn-N2ln(2π)+lnp(α)-lnZ , (31)

with N being the number of data points, or pixels, to be considered in the model. We can redefine σ to include the intrinsic dispersion of the data, which we assume constant for all pixels; namely, σn2=σn2+σint2.

The priors are the constrain of our model function and enclose all we know about the data. Uniform or non-informative priors give the same probability to any point within the considered boundaries. This allows the likelihood function to survey the prior space without any preferred direction. XookSuut adopts either uniform or truncated Gaussians (TG), with values shown in Table 1. TG priors are of the form TG(μ,σ,μmin,μmax), with μ and σ being the mean and standard deviation of the Gaussian, and μmin and μmax represent the lower and upper boundaries, respectively. The mean values can be chosen arbitrary, although good values are those that maximize the likelihood function (i.e., equation 12). In most cases, choosing uniform or TG priors does not affect the posterior distributions. The difference resides in the computational cost needed to explore the prior space; narrow distributions like TG are sampled more efficiently than uniform distributions.

TABLE 1 Type of priors adopted in XookSuut  

Parameter Uniform prior Truncated Gaussiansa
ϕdisk 0 if -2π<ϕdisk<2π TG(ϕ^disk, 15, 45)
i 0 if 30 < i < 75 TG(i^,10° ,30,75)
ϕbar 0 if -π<ϕbar<π TG(ϕ^bar,20, ϕ^bar45)
x 0 0 if 0<x0<nx TG(x0^,2,x0^10)
y 0 0 if 0<y0<ny TG(y0^,2,y0^10 )
V sys 0 TG(V^sys,50 km s-1 )
Vk 0 if -400<Vk<400 TG(V^k,150 km s-1 ,-250,250)
lnσint2 0 if -10<lnσint2<10 TG(0.1,1,-10,10)

a Values with hat represent LS results. V k refers to any of the different radial dependent velocities.

In order to infer the posterior distribution of the parameters, XookSuut adopts two well known Python packages for Bayesian analysis; these are the emcee package EMCEE, and DYNESTY (e.g., Foreman-Mackey et al. 2013). EMCEE is a Python implementation of the affine-invariant method for MCMC with automatic chain tuning; while dynesty is a Python implementation of dynamic nested sampling methods. MCMC and NS are two robust sampling techniques to derive posterior distributions in high dimensional likelihood functions, such as the kinematic models described before. Both packages have been extensively applied in astronomy for making Bayesian inference, with particular implementations in cosmology. For a detailed description of these codes we suggest reading their corresponding documentation. Both packages require a set of configurations whose purpose is to guarantee convergence of the sampling procedure. XookSuut is optimized to pass a configuration file to set up EMCEE and DYNESTY. The main setups in these codes are the length of the join-chains and the discarding fraction (burning period) in the case of MCMC, and the integration limit for NS. For both packages, XookSuut adapts the likelihood functions and priors to make it compatible with MCMC or NS methods.

As mentioned before, MCMC samplers like EMCEE sample from the likelihood; therefore the chains need to be initialized at some position, for which XookSuut chooses a random region around the maximum likelihood. For MCMC samplers the joint posterior distribution is estimated up to a normalization constant, here adopted equal to 1 (or zero in ln). For running dynesty XookSuut transform the priors from Table into a unit cube, in such a way that all parameters vary from 0 to 1 and they are re-scaled at the end of the sampling process.

Finally, representative values of the parameters are taken as the 50% percentile of the marginalized distributions. The uncertainty in the parameters is addressed in the following section.

Although emcee makes use of frequentist methods for starting the sampling process, this could be suppressed if relatively good initial positions of the disk geometry are given. On the other hand, dynesty does not require at all the LS initialization as the numerical integration is performed over the prior space.

3.2.2 Error Estimation

The true uncertainty in rotational velocities is known to be underestimated with standard least squares minimization techniques and even with MCMC methods (e.g., de Blok et al. 2008; Oh et al. 2018). Errors estimated with these methods are usually of the order of the turbulence of the ISM (a few km s-1 ) and do not represent the systematic errors. Some works adopt the mean dispersion per ring as a measure of the uncertainty in the rotation curve. However, when non-circular components are added to the model, this assumption is no longer valid since each ring may contain multiple kinematic components.

XookSuut provides different error estimates for the derived parameters. The Levenberg-Marquardt least-squares minimization automatically computes errors from the covariance matrix; these represent statistical errors and may be used for a quick analysis. However, the power of Bayesian inference relies on the estimation of posterior distributions, from which we can obtain uncertainties of the parameters. XookSuut adopts the marginalized distributions to quote the uncertainties in each parameter, including the velocities. These uncertainties are in general smaller than simple Monte-Carlo errors since marginalized distributions are not expected to contain unstable (burn-in) chains. This necessarily requires dropping an important fraction of the total samples during a run, which is customized within XookSuut. Therefore, it is common to report 2σ credible intervals in Bayesian analysis. In fact, finding “large” uncertainties in MCMC methods would be an indication that chains are not fully converging; either because a large fraction of samples are being rejected, or chains are surveying complicated likelihood functions, often multi-modal distributions, for which NS would be a better solution.

Additionally, XookSuut also implements a bootstrap analysis for error estimation. Our procedure differs from the one described by [Sellwood S chez(2010)], as explained below. The residuals from the best 2D interpolated model are used to generate new samples. Instead of shuffling residuals at random locations on the disk, K rings of width δr are constructed with projection angles given by the best values. Then, residuals in each ring are chosen to resample the best 2D model in the same ring locations. In this way any residual pattern associated to a bar or spiral arms remains around the same galactocentric distance but not in the same pixel location. The new re-sampled velocity map is used in a least squares analysis for deriving a new set of velocities and constant parameters. This procedure is performed iteratively; finally the root mean square deviation is taken as 1σ error; however, for consistence with the Bayesian methods, we report 2σ errors throughout the paper.

In general, we find that the estimated uncertainties of the parameters increase in the following order: Bayesian methods > bootstraps > LS, with computational cost increasing in the same direction.

4 Testing XookSuut

We now proceed to evaluate XookSuut in a series of simulated velocity maps and real velocity fields.

4.1 Toy Model Example

As an example of its use, we run XookSuut on a simulated velocity map. This is the velocity field of a galaxy at 31.4 Mpc with a 32 optical radius. We model a velocity field with an oval distortion described by equation 3. For the rotation curve we adopt the parameterization from Bertola et al. (1991).. The non-circular motions were modeled using the Gamma probability density function; Gamma(2,3.5) for describing the V2,t component and Gamma(2,3) for V2,r. The constant parameters were set to ϕdisk'=77, ϕbar=35, i=55, x0=76.5, y0=75.2 and Vsys=2142 km s-1 . The field of view (FoV) is defined as 64×74 and the pixel scale was set to 0.5. Finally we convolved the image for decreasing its spatial resolution. We simulate a circular PSF with a 2D Gaussian function with a 1 full width at half maximum (FWHM). We perturb the velocity profiles by adding Gaussian noise centered at zero and with a standard deviation of 5 km s-1 .

We started XookSuut by assigning random values to each of the constant parameters, except for ϕbar which is initialized around its maximum (i.e., ϕbar=45). We set the initial and last ring exploration at 2.5 and 40 respectively; we also estimate the radial velocities each 2.5. A LS analysis was performed with 3 round iterations before starting the MCMC run. For comparison with Bayesian methods we adopt 1000 bootstraps during the LS analysis. For MCMC sampling, we run a total of 4000 iterations with 60 different chains, which represent twice the number of free variables for this case. We discarded 50% of the joint chain, for a total of 120k posterior samples on each parameter. The IAT for this run resulted in 127 which is superior to 50.

On the other hand, nested sampling only requires the prior information, for which we adopted the uniform priors from Table 1. No initial LS was performed for this case. We stopped the sampling procedure only when the remaining evidence to be integrated was 0.1.

We test all the different kinematic models, i.e., circular, radial, bisymmetric models and we arbitrarily expand the harmonic series up to M = 3. MCMC and NS derive the posterior distribution for each variable of the kinematic model; thus, we can take advantage of corner plots to represent their marginalized distributions and explore possible correlations between parameters. The median values and 2σ errors for each parameter are shown in Table 2, while in Figure 2 we show the marginalized posteriors; for simplicity we only show the constant parameters for the bisymmetric model, although note this should be a 30×30 dimensions plot.

TABLE 2 Best fit parameters for the toy model example  

Model Method    ϕdisk' Δi Δx0 Δy0 ΔVsys  Δ    ϕbar RMS BIC
(°) (°) (pix) (pix) (km s-1 ) (°) (km s-1)
circular LM -1.1 ± 0.1 -0.4 ± 0.1 0.0 ± 0.0 0.1 ± 0.0 -0.0 ± 0.2 8.5 4.5
MCMC -1.1 ± 0.1 -0.1 ± 0.3 0.0 ± 0.1 0.1 ± 0.1 -0.0 ± 0.2 9.3 4.5
NS -1.1 ± 0.1 -0.1 ± 0.3 0.0 ± 0.1 0.1 ± 0.1 -0.0 ± 0.2 9.3 4.5
radial LM -0.1 ± 0.1 -0.2 ± 0.2 0.0 ± 0.0 0.1 ± 0.0 0.0 ± 0.2 9.3 4.4
MCMC -0.1 ± 0.1 0.1 ± 0.3 0.0 ± 0.1 0.1 ± 0.1 -0.0 ± 0.2 8.5 4.4
NS -0.1 ± 0.1 0.0 ± 0.3 0.0 ± 0.1 0.1 ± 0.1 -0.0 ± 0.2 8.5 4.4
bisymmetric LM 0.0 ± 0.1 0.1 ± 0.2 0.0 ± 0.0 0.1 ± 0.0 -0.0 ± 0.2 3.8 ± 8.0 8.5 4.4
MCMC 0.0 ± 0.2 0.1 ± 0.3 0.0 ± 0.1 0.1 ± 0.1 -0.0 ± 0.2 3.7 ± 7.8 8.5 4.4
NS 0.0 ± 0.2 0.1 ± 0.3 0.0 ± 0.1 0.1 ± 0.1 -0.0 ± 0.2 3.6 ± 8.2 8.5 4.4
harmonic LM -0.1 ± 0.1 -0.0 ± 0.3 0.0 ± 0.0 0.1 ± 0.0 -0.0 ± 0.2 8.5 4.4
MCMC -0.1 ± 0.1 0.0 ± 0.3 0.0 ± 0.1 0.1 ± 0.1 -0.0 ± 0.2 8.5 4.4
NS -0.1 ± 0.1 0.0 ± 0.3 0.0 ± 0.1 0.1 ± 0.1 -0.0 ± 0.2 8.5 4.4

Δαrecovered-αtrue.

Fig. 2 Marginalized distributions of the parameters describing the bisymmetric model for our toy model described in § 4.1. This corner plot shows only the parameters describing the disk geometry. Contours enclose 68% and 95% of the data. Histograms of individual distributions are shown on top, together with the median values and 2σ credible intervals for each parameter. The orange straight lines represent the true values. As observed, all parameters but y0, are recovered within the ±1σ region. The color figure can be viewed online.  

MCMC and nested sampling methods converge to the same solutions found by the LS method; this represents a great success for Bayesian methods to derive kinematic parameters from an input velocity map given the large dimension of the likelihood function. We note that the input parameters are recovered in the bisymmetric model, which is not the case for the circular, radial and harmonic, as expected; this is better appreciated in the corner plot from Figure 2. MCMC and nested sampling recover the input parameters within the 1σ credible interval, except for y0 which lies within 2σ; among the constant parameters, the position angle of the oval distortion shows the largest uncertainty. From Table 2, we notice that the uncertainties derived with Bayesian methods and bootstraps are of the same order.

The different velocities, Vt(r), V2,r(r) and V2,t(r), are also recovered within the 2σ errors as observed from the rightmost panel of Figure 3. For consistence, in Appendix C we include the results using DiskFit; we notice that the XookSuut results are in total agreement with those obtained with DiskFit.

Fig. 3 XookSuut results for the toy model example, for the bisymmetric model case. Figures from left to right: simulated velocity field; best two dimensional interpolated model from MCMC; residual map (input minus output). Overlaid on these maps are iso-velocity contours starting at 0 km s-1 with steps of ±50 km s-1 . The fourth column shows the radial variation of the different kinematic components included in the model. Here the input velocities are shown with discontinuous lines while continuous lines represent the velocities derived by XookSuut using MCMC (green), nested sampling (blue) and LM + bootstrap (red). The shadowed regions represent 2σ errors. The color figure can be viewed online. 

Table 2 also shows the root mean square (RMS) for each kinematic model; models including non-circular rotation show a RMS value around 8.5 km s-1 . This leads to the question of which model is the preferred one for describing a particular velocity field. In a statistical sense, when comparing different models one should choose the one with fewer parameters, since more variables in a model often reduce further the RMS, which does not necessarily provide the best physical interpretation of the data. Statistical tests such as the Bayesian information criterion (BIC) penalizes over the variables from the model; BIC is defined in terms of the likelihood (or the chi-square) as, BIC=-2lnLα^+Nvarysln(N), where α^ represents the parameters that maximize the likelihood function and N is the number of data; thus, the model with the lowest BIC should be preferred. Additionally, the evidence Z computed from NS, is a measure of the agreement of the data with the priors; in this way large (small) Z values are more (less) compatible with the priors.

However, when there is little information about the data, or only the data itself, it is difficult to select a model description of the data based on any information other than statistical tests. Regardless of the statistical method adopted, it is important to have a physical motivation for accepting or rejecting a model; otherwise, erroneous interpretations of the velocity field could arise.

For the toy model example, Table 2 shows that non-circular models have similar BIC values. Even when the harmonic decomposition model seems to perform a good fitting based on the residuals, the physical interpretation of the m = 2 components are meaningless for this example. Thus in a real scenario the radial and bisymmetric model should be compared. The Bayesian evidence for the radial and bisymmetric models results in lnZ=-36136 and - 36135, respectively. In a statistically sense both solutions are equally probable; in other words, the data are insufficient for making an informed judgment. This is not surprising given the simplicity of our velocity field model.

4.2 Simulations

We carried out a set of 1000 simulations with different inclination angles ranging from 30<i<70, disk position angle 0<ϕdisk'<360, and to avoid degeneracy, the bar position angle varies from 5<ϕbar<85; velocity profiles and kinematic center have the same values as in the toy example. We also adopt the same sampling configurations as before. We notice that sometimes XookSuut detects the minor-axis bar position angle instead of the major one; in such cases, ϕbar is found 90° away from the minor axis. This result is also a totally acceptable model since the difference resides only in the sign of the bisymmetric components, V2,r and V2,t, which for these cases both have negative values. XookSuut computes the projected major axis position angle of the bar via equation 5, while the projected minor axis position angle is computed by shifting ϕbar by 90°.

In Figure 4 we show the results of the analysis in corner plots; the derived values are shown relative to the true ones, namely Δα=αrecovered-αtrue; for the radial dependent velocities, we subtract the velocity profile of each component from the derived velocities. These results show that the median values of Δα lie around zero for all parameters describing the bisymmetric model; furthermore, the scatter of the differences is contained within the average value of the 2σ credible interval for each parameter. Results from this analysis demonstrate that MCMC and NS methods are able to recover the true parameters of our simulated velocity maps, even when each model is described by +30 free variables.

Fig. 4 XookSuut results for the bisymmetric model on 1000 synthetic velocity maps with oval distortions. Values are reported with respect their true value, namely Δα=αrecovered-αtrue, where α is any of the parameters considered in this example. Straight orange lines represent the true values (i.e., Δα=0). Blue and lime colors show the results for NS and MCMC methods, respectively. The inner and outer density contours contain 68% and 95% of the data, respectively. The upper histograms represent the 1D distributions of the parameters on the x-axis, while the size of the error bars represents the average value of the 2σ credible interval for each parameter. Note that all parameters are recovered within the reported error bars. Values on-top the histograms represent the 50% percentile of Δα, together with the ±2σ dispersion. The color figure can be viewed online. 

The final accuracy of the recovered parameters would depend on the details of data themselves (resolution, S/N , spatial coverage etc.). Therefore, ad-hoc simulations are encouraged.

4.3 NGC 7321

We proceed to evaluate XookSuut over the velocity field of a galaxy hosting a stellar bar. For this purpose we adopt the galaxy NGC 7321 observed as part of the CALIFA galaxy survey (e.g., Sánchez et al. 2012). This object has been previously analyzed by Holmes et al. (2015) using DiskFit. The Hα velocity field of this object represents a good example of a galaxy with a strong kinematic distortion, most probably caused by the stellar bar. Holmes et al. (2015) found the bisymmetric model as the best model for reproducing the inner distortion observed in this object; they found best fit values and 1σ errors for the constant parameters given by ϕdisk' = 12±1, i=46±2, Vsys = 7123±3 km s-1 and a bar position angle oriented at ϕbar =47±6. We implemented XookSuut on the Hα velocity map taken from the CALIFA data products (e.g., Sánchez et al. 2016). We adopted the same ring configurations as before, excluding pixels from the error map with values larger than 25 km s-1 ; we proceed to explore the non-circular motions up to r = 18, and set the maximum radius for the circular velocities up to 40; this leads to a total of 36 free variables that will be estimated with Bayesian inference. We adopt 3 rounds of iterations for the LS method, and also compute the errors on the parameters with 1000 bootstraps. For MCMC, we adopt 5000 steps and drop half of the total samples to let the joint chain stabilize. For NS we stop the sampling when the remaining evidence to be integrated is 0.1.

Figure 5 shows the marginalized distributions of the constant parameters. From the 1D histograms we obtain ϕdisk' = 11±0, i=46±1, Vsys = 7123±1 km s-1 and ϕbar =46±6; additionally we compute the intrinsic scatter of the data as 16 km s -1 . Table 3 shows a summary of these results. As can be read from this table, the constant parameters derived by XookSuut are in concordance with those previously reported by Holmeset al. (2015), although our uncertainties are smaller when comparing the errors at 2σ, probably due to differences in methods. The bottom figure shows the best model and residual map obtained from nested sampling. The kinematic distortion observed in the central region is well reproduced with the bisymmetric model. The bisymmetric motions, i.e., the bar-like flows, are oriented at 46±8 on the sky plane. The rightmost panel shows the radial profile of the different velocity components derived from NS, MCMC and LS+bootstrap methods. Again, the uncertainties reported from NS and MCMC are of similar magnitude, and these are larger than those obtained with bootstrap methods.

Fig. 5 XookSuut results for NGC 7321 for the bisymmetric model. Top figure shows the marginalized distribution for the constant parameters with MCMC methods in green colors and NS in blue. As in Figure 2, the quoted values on top the histograms represent the median and 2σ errors obtained from the posterior distributions. Bottom figure shows from left to right the Hα velocity map; the two-dimensional model from NS; the residual map; and the radial profile of the different velocities. Shadow regions represent the 2σ credible intervals obtained from each method (bootstrap in red colors). The color figure can be viewed online. 

TABLE 3 XookSuut bisymmetric results for NGC 7321  

Method ϕdisk' i x0 y 0 Vsys ϕbar
(°) (°) (pixels) (pixels) (km s-1 ) (°)
LS+bootstraps 11 ± 1 46 ± 1 35.5 ± 0.0 33.6 ± 0.0 7123 ± 1 46 ± 4
NS 11 ± 0 46 ± 1 35.5 ± 0.1 33.6 ± 0.1 7123 ± 1 46 ± 6
MCMC 11 ± 0 46 ± 1 35.5 ± 0.1 33.6 ± 0.1 7123 ± 1 46 ± 7
DiskFit* 12 ± 1 46 ± 1 ... ... 7123 ± 3 47 ± 6

*Results from Holmes et al. (2015). Errors in Holmes et al. (2015) represent 1σ, so a factor of 2 should be considered for comparison.

In Appendix D we show the implementation of XookSuut on other data with different instrumental configurations.

5 Discussion

Our simulations and toy example show that sampling methods are able to produce results similar to those obtained with frequentist methods based on the χ2 minimization. The widely used Levenberg-Marquardt algorithm is able to obtain solutions to the kinematic models in a fast way, although errors from the covariance matrix are always small. On the other hand, our resampling implementation produces larger uncertainties compared with the covariance matrix. We notice that the magnitude of the errors increases with the number of bootstrap iterations; however, increasing the number of bootstrap samples increases the total execution time, since at each iteration a new LS analysis is performed.

Bayesian methods, i.e., MCMC and NS, provide the largest uncertainties on the parameters compared to the two other techniques. The major disadvantage is the computational cost needed to sample the posterior distributions. For the toy model example presented, the execution times on an 8 core machine are 1 hour for LM+1k bootstraps, 1 hour for MCMC with 4k steps and 2.5 hours with NS.

If Bayesian methods and LS+bootstrap provide similar solutions for the parameters, then in principle one could choose either of the two methods to quote the uncertainties. However, the most interesting cases are when Bayesian methods differ from the frequentist ones. XookSuut has the advantage that both bootstrap and Bayesian methods can be executed in parallel. This can drastically reduce the execution times depending on the number of CPUs available during the running.

6 Conclusions

We have presented a tool for the kinematic study of circular and non-circular motions of galaxies with resolved velocity maps. This tool named XookSuut (or XS for short), is an adaptation of the DiskFit algorithm, designed to perform Bayesian inference on parameters describing circular rotation, radial flows, bisymmetric motions and an arbitrary harmonic decomposition of the LoS velocities. XookSuut implements robust Bayesian sampling methods to obtain the posterior distribution of the kinematic parameters. In this way, the “best-fit” values, and their uncertainties are obtained from the marginalized distributions, unlike frequentist methods where best values are obtained at a single point from the likelihood function. XookSuut adopts Markov Chain Monte Carlo methods and dynamic nested sampling to sample the posterior distributions. In particular, XookSuut makes use of the emcee and dynesty packages developed to perform Bayesian inference.

XookSuut is a free access code written in Python language. The details about running the code, as well as the required inputs and the outputs are described in Appendix A.

XookSuut is suitable to use on velocity maps not strongly affected by spatial resolution effects, i.e., when the PSF FWHM is smaller than the size of structural components of disk galaxies, such as stellar bars. In addition, disk inclination should range from 30° < i < 70°. The fundamental assumption of the code is that galaxies are flat systems observed in projection on the sky with a constant inclination angle, constant disk position angle and fixed kinematic center. This makes XookSuut suitable for studying the kinematics of galaxies within dynamical equilibrium, but not for highly perturbed disks.

Applying XookSuut over a set of simulated maps with oval distortions we showed that Bayesian methods are able to recover the input parameters despite the high dimension of the likelihood function. True parameters are recovered within 1σ credible interval, with the position angle of the oval distortion being the parameter with the larger scatter. We tested XookSuut over a well known galaxy with an oval distortion in the velocity field, NGC 7321, and found results similar to those obtained with DiskFit.

Regarding the uncertainty of the parameters, Bayesian methods provide the largest uncertainties compared with resampling methods like bootstrap. However, the computational cost for sampling the joint posterior distribution is in general more expensive than, for instance 1k bootstraps. Fortunately, a fraction of time can be saved when these methods are run in parallel.

We also tested XookSuut on velocity maps from different galaxy surveys. Despite the instrumental differences in these data, XookSuut is able to build kinematic models of circular and non-circular motions.

Finally, XookSuut is ideal for running on individual objects, or in galaxy samples since it is easy to systematize for use in large data sets. XookSuut is a free access code available at the following link https://github.com/CarlosCoba/XookSuut-code.

Acknowledgements

We thank K. Spekkens, J. A. Sellwood, and anonymous peer reviewers for providing helpful suggestions to improve this manuscript.

C. L. C. thanks support from the IAA of Academia Sinica. L. L. thank supports from the Academia Sinica under the Career Development Award CDA107-M03, the Ministry of Science & Technology of Taiwan under the grant MOST 108-2628-M-001-001-MY3, and National Science and Technology Council under the grant NSTC 111-2112-M-001-044.

References

Allen, J. T., Croom, S. M., Konstantopoulos, I. S., et al. 2015, MNRAS, 446, 1567, https://doi.org/10.1093/mnras/stu2057 [ Links ]

Ashton, G., Bernstein, N., Buchner, J., et al. 2022, NRvMP, 2, 39, https://doi.org/10.1038/s43586-022-00121-x [ Links ]

Bacon, R., Accardo, M., Adjali, L., et al. 2010, SPIE7735, 773508, https://doi.org/10.1117/12.856027 [ Links ]

Barnes, E. I. & Sellwood, J. A. 2003, AJ, 125, 1164, https://doi.org/10.1086/346142 [ Links ]

Begeman, K. G. 1987, HI rotation curves of spiral galaxies, PhD Thesis, Kapteyn Institute, University of Groningen. [ Links ]

_______, 1989, A&A, 223, 47 [ Links ]

Bertola, F., Bettoni, D., Danziger, J., et al. 1991, ApJ, 373, 369, https://doi.org/10.1086/170058 [ Links ]

Binney, J. 2008, Galactic Dynamics: Second Edition (Princeton, NJ: PUP) [ Links ]

Bouché, N., Carfantan, H., Schroetter, I., Michel-Dansac, L., & Contini, T. 2015, AJ, 150, 92, https://doi.org/10.1088/0004-6256/150/3/92 [ Links ]

Bundy, K., Bershady, M. A., Law, D. R., et al. 2015, ApJ, 798, 7, https://doi.org/10.1088/0004-637X/798/1/7 [ Links ]

Davis, T. A., Alatalo, K., Bureau, M., et al. 2013, MNRAS, 429, 534, https://doi.org/10.1093/mnras/sts353 [ Links ]

de Blok, W. J. G., Walter, F., Brinks, E., et al. 2008, AJ, 136, 2648, https://doi.org/10.1088/0004-6256/136/6/2648 [ Links ]

Di Teodoro, E. M. & Fraternali, F. 2015, MNRAS, 451, 3021, https://doi.org/10.1093/mnras/stv1213 [ Links ]

Di Teodoro, E. M., Fraternali, F., & Miller, S. H. 2016, A&A, 594, 77, https://doi.org/10.1051/0004-6361/201628315 [ Links ]

Fathi, K., van de Ven, G., Peletier, R. F., et al. 2005, MNRAS, 364, 773, https://doi.org/10.1111/j.1365-2966.2005.09648.x [ Links ]

Foreman-Mackey, D., Hogg, D. W., Lang, D., & Goodman, J. 2013, PASP, 125, 306, https://doi.org/10.1086/670067 [ Links ]

Holmes, L., Spekkens, K., Sánchez, S. F., et al. 2015, MNRAS, 451, 4397, https://doi.org/10.1093/mnras/stv1254 [ Links ]

Józsa, G. I. G., Kenn, F., Klein, U., & Oosterloo, T. A. 2007, A&A, 468, 731, https://doi.org/10.1051/0004-6361:20066164 [ Links ]

Kamphuis, P., Józsa, G. I. G., Oh, S.-H., et al. 2015, MNRAS, 452, 3139, https://doi.org/10.1093/mnras/stv1480 [ Links ]

Karamanis, M., Beutler, F., & Peacock, J. A. 2021, MNRAS, 508, 3589, https://doi.org/10.1093/mnras/stab2867 [ Links ]

Kormendy, J. 1983, ApJ, 275, 529, https://doi.org/10.1086/161552 [ Links ]

Krajnovi´c, D., Cappellari, M., de Zeeuw, P. T., & Copin, Y. 2006, MNRAS, 366, 787, https://doi.org/10.1111/j.1365-2966.2005.09902.x [ Links ]

Lacey, C. G. & Fall, S. M. 1985, ApJ, 290, 154, https://doi.org/10.1086/162970 [ Links ]

López-Cobá, C., Sánchez, S. F., Anderson, J. P., et al. 2020, AJ, 159, 167, https://doi.org/10.3847/1538-3881/ab7848 [ Links ]

Newville, M., Stensitzki, T., Allen, D. B., & Ingargiola, A. 2014, Zenodo, https://doi.org/10.5281/zenodo.11813 [ Links ]

Oh, S.-H., Staveley-Smith, L., Spekkens, K., Kamphuis, P., & Koribalski, B. S. 2018, MNRAS, 473, 3256, https://doi.org/10.1093/mnras/stx2304 [ Links ]

Rubin, V. C., Ford, W. K., J., & Thonnard, N. 1980, ApJ , 238, 471, https://doi.org/10.1086/158003 [ Links ]

Rubin, V. C. & Ford, W. Kent, J. 1970, ApJ , 159, 379, https://doi.org/10.1086/150317 [ Links ]

Sánchez, S. F., Kennicutt, R. C., Gil de Paz, A., et al. 2012, A&A, 538, 8, https://doi.org/10.1051/0004-6361/201117353 [ Links ]

Sánchez, S. F., Pérez, E., Sánchez-Blázquez, P., et al. 2016, RMxAA, 52, 21 [ Links ]

Schoenmakers, R. H. M. 1999, Asymmetries in spiral galaxies, PhD Thesis, University of Groningen, Netherlands [ Links ]

Schoenmakers, R. H. M., Franx, M., & de Zeeuw, P. T. 1997, MNRAS, 292, 349, https://doi.org/10.1093/mnras/292.2.349 [ Links ]

Sellwood, J. A. & Sánchez, R. Z. 2010, MNRAS , 404, 1733, https://doi.org/10.1111/j.1365-2966.2010.16430.x [ Links ]

Sellwood, J. A. & Spekkens, K. 2015, arXiv:1509.07120, https://doi.org/10.48550/arXiv.1509.07120 [ Links ]

Sellwood, J. A., Spekkens, K., & Eckel, C. S. 2021, MNRAS , 502, 3843, https://doi.org/10.1093/mnras/stab009 [ Links ]

Skilling, J. 2006, Bayesian Analysis, 1, 833, https://doi.org/10.1214/06-BA127 [ Links ]

Speagle, J. S. 2020, MNRAS , 493, 3132, https://doi.org/10.1093/mnras/staa278 [ Links ]

Spekkens, K. & Sellwood, J. A. 2007, ApJ , 664, 204, https://doi.org/10.1086/518471 [ Links ]

Trachternach, C., de Blok, W. J. G., Walter, F., Brinks, E., & Kennicutt, R. C., J. 2008, AJ, 136, 2720, https://doi.org/10.1088/0004-6256/136/6/2720 [ Links ]

van de Ven, G. & Fathi, K. 2010, ApJ , 723, 767, https://doi.org/10.1088/0004-637X/723/1/767 [ Links ]

Walcher, C. J., Wisotzki, L., Bekeraité, S., et al. 2014, A&A , 569, 1, https://doi.org/10.1051/0004-6361/201424198 [ Links ]

Warner, P. J., Wright, M. C. H., & Baldwin, J. E. 1973, MNRAS , 163, 163, https://doi.org/10.1093/mnras/163.2.163 [ Links ]

Wong, T., Blitz, L., & Bosma, A. 2004, ApJ , 605, 183, https://doi.org/10.1086/382215 [ Links ]

Wright, M. C. H. 1971, ApJ , 166, 455, https://doi.org/10.1086/150975 [ Links ]

2Angles measured in the sky plane are marked with a prime symbol (´), otherwise they are measured in the galaxy plane. The disk position angle is measured from the north to east for the receding side of the galaxy.

3Note that the problem becomes degenerate when the bar position angle is aligned to the galaxy major axis. When ϕbar=0°, the terms cos2(θ-ϕbar)cosθ and sin2(θ-ϕbar)sinθ can be expressed as 12(cosθ+cos3θ ) and 12(cosθ-cos3θ), respectively. A similar relation occurs when the bar is oriented along the minor axis, ϕbar=90° .

APPENDIX A. RUNNING XOOKSUUT

XookSuut is designed to run directly from the command line by passing a number of parameters whose purpose is to guide the user through a successful fit.

After a successful installation and typing XookSuut on a terminal the code will display the entrance required for starting the analysis. The meaning of each parameter is described in Table 4, while the output files are described in Table 5.

TABLE 4 XookSuut input parameters  

Input Type Description
name str Name of the object.
vel_map.fits fits Fits file containing the 2D velocity map in km s-1 .
error_map.fits fits Fits file containing the 2D error map in km s-1 .
SN float Pixels in the error map above this value are excluded.
Pixel_scale float Pixel scale of the image ( / pixel).
PA float Kinematic position angle guess (°).
INC float Disk inclination guess (°).
X0 float X-coordinate of the kinematic centre (pix).
Y0 float Y-coordinate of the kinematic centre (pix).
VSYS float Initial guess for the systemic velocity in km s-1 . If no
argument is passed, it will take the weighted mean value
within a 5” aperture centered in (X0, Y0).
vary_PA bool Whether ϕdisk' varies in the fit or not.
vary_INC bool Whether i varies in the fit or not.
vary_X0 bool Whether x0 varies in the fit or not.
vary_Y0 bool Whether y0 varies in the fit or not.
vary_VSYS bool Whether Vsys varies in the fit or not.
ring_space float Spacing between rings in arcsec. The user may want to use
FWHM spatial resolution.
delta float The width of the ring is defined as 2delta. The user may
want to use 0.5 ring_space if independent rings are desired.
Rstart,Rfinal float Starting and initial position of the rings on disk plane. (arcsec)
cover float Fraction of pixels in a ring needed to compute the row
stacked velocities. If 1 the ring area must be 100% sampled.
kin_model str Choose between: “circular”, “radial” flows, “bisymmetric”
(oval distortion) or “hrm_M”, where M is the harmonic number.
fit_method str Minimization technique used in the least-squares analysis.
Options are “Powell” or “LM” (Levenberg-Marquardt).
N_it float Number of round iterations for the least-squares analysis.
Rbar_min,max float Minimum and maximum radius for modeling the non-circular
flows. If only one value is passed, it will be considered as the
maximum radius to fit.
config_file file Configuration file to access high configuration settings
including the Bayesian sampling methods, bootstrap errors,
and other general model configurations. See the documentation
for a detailed description of this file.
prefix str Extra string passed to the object’s name. This prevents
overwriting the outputs in case multiple analyses of the
same object are performed.

TABLE 5 XookSuut data products  

Output Description
name.model.vlos_model.fits.gz Two dimensional representation of the
adopted kinematic model (equations 1,2,3 or 6).
name.model.chisq.fits.gz Fits file containing the chi-square map defined
as (obs-model)2 /error2.
name.model.chain.fits.gz Fits file containing the marginalized samples
(i.e., the joint chain), explored in the Bayesian analysis.
name.model.2D_Vmodel.fits.gz Two dimensional representation of each velocity
component from the model.
name.model.marginal_dist.fits.gz Fits file containing the 50 percentile distribution for each
parameter, together with the ±1σ and ±2σ credible intervals.
name.model.residual.fits.gz Map containing the residuals of the model, i.e., obs - model.
name.model.2D_R.fits.gz Deprojected distance map in arcsec, obtained from the best
fit disk geometry.
name.model.1D_model.fits.gz Values for the best fit parameters together with the 2σ errors.
name.model.2D_theta.fits.gz Two dimensional representation of the azimuthal angle θ.

B. CAUCHY DISTRIBUTION

Although a Gaussian distribution is mostly assumed for the likelihood function, there is no restriction to use other distributions. In fact, multiple algorithms adopt arbitrary parameterization of the residual function (e.g., Di Teodoro & Fraternali 2015). In addition to a Gaussian distribution, XookSuut also includes the Cauchy distribution in the likelihood function. It assumes a unique form of the errors parameterized with γ. The Cauchy log-posterior distribution for our models adopts the following form:

lnp(α|D,Vmodel)=-Nlnπγ-n=1Nln1+Dn-k=1KWk,nVk2γ2+lnp(α)-lnZ. (B32)

An example using the Cauchy distribution is shown in Figure 6. As noted, there can be differences in the results depending on the election of the likelihood function. There is no a general rule on when to use the Cauchy distribution; often, it is used when the data contain many outliers.

Fig. 6 Results for Gaussian and Cauchy likelihood functions for the circular model of NGC 7321. In this example we used nested sampling for the Bayesian analysis. We found the width of the Cauchy distribution at γ=7.6±0.3 km s-1 . The color figure can be viewed online.  

C. DiskFit RESULTS

Figure 7 shows the results of the bisymmetric model using DiskFit applied on the simulated velocity map described in Section 4.1; 1000 bootstraps were adopted in DiskFit to quote the uncertainties of the parameters. The median values estimated with Bayesian methods and LM+bootstraps are in concordance with those obtained with DiskFit. In addition, the uncertainties of the velocities reported by DiskFit are comparable to or lower than those obtained with Bayesian methods. This figure shows that XookSuut produces results similar to DiskFit.

Fig. 7 Results of the fitting analysis using DiskFit for the simulated velocity map described in Sec 4.1. Black empty circles and error bars show velocities and uncertainties derived by DiskFit; 1000 bootstraps were adopted in DiskFit for this purpose. Colored lines represent results from XookSuut using LM+bootstrap in red, MCMC in green and NS in blue. Results for the constant parameters using DiskFit are the following, ϕdisk'=77.02±0.13, i=55.06±0.48, (x0, y0)=(77.51±0.09, 76.26±0.09) pixels, Vsys=2141.98±0.20 km s-1 and ϕbar=39.47±15.60, χ2=72.5. In all cases error bars represent 2σ errors. The color figure can be viewed online. 

D. IMPLEMENTATION ON DATA WITH DIFFERENT CONFIGURATIONS

We apply XookSuut to a sample of galaxies observed with different instrumental configurations and different redshifts. We obtain Hα velocity maps from different integral field spectroscopy (IFS) galaxy surveys, namely MaNGA (e.g., Bundy et al. 2015) AMUSING++ (e.g., López-Cobá et al. 2020) AMUSING++, SAMI (e.g., Allen et al. 2015); these objects correspond to manga-9894-6104, IC 1320 and SAMI511867, respectively. These objects were chosen for showing rich emission in Hα . The velocity maps were obtained from the public dataproducts.

For each galaxy we run circular, radial, bisymmetric and harmonic decomposition models up to M = 3. However we only report the model with the lowest BIC value. The initial position angle and inclination angles were adopted from those reported in Hyperleda or by our own previous analysis (e.g., Walcher et al. 2014; López-Cobá et al. 2020). The coordinates of the kinematic center were set by eye from the velocity maps. When available we used the error maps to exclude pixels with large uncertainties (namely > 25 km s-1 ). The width of the rings was set to the size of the PSF for each dataset (ranging from1 - 2.5). For these objects we only adopt NS methods. To speed up the analysis we adopted truncated Gaussian priors, for which we performed an LS analysis to set the mean values of the Gaussian priors.

The best fit models are shown in Figure 8, while results of the constant parameters are shown in Table 6 for each object. Figure 3 shows the observed velocity, the best model from NS methods, the residual maps and the radial profiles of the different kinematic components for each considered model. Each row in this figure represents the outputs for a different galaxy.

Fig. 8 Implementation of XookSuut on different velocity maps. Each set of panels, from top to bottom, corresponds to a different galaxy taken from different IFS galaxy surveys (i.e., MaNGA, SAMI and AMUSING++ from top to bottom). In each row, from left to right: (i) the Hα velocity field; (ii) best two-dimensional model from NS; (iii) residual map of the fitting; (iv) radial variation of the different velocities in the considered model. Shadow regions in this plot represent the 1σ credible interval obtained from NS. Note that each map has different instrumental configurations and FoVs. Iso-velocity contours spaced by ±50 km s-1 are overlayed on each velocity map. The color figure can be viewed online. 

TABLE 6 XookSuut applied to different data with different instrumental configurations  

Object Survey Model ϕdisk'(°) i(°) x0(pixels) y0(pixels) Vsys (km s-1)
9894-6104 MaNGA Eq 1 296 ± 0 35 ± 1 27.2 ± 0.1 26.7 ± 0.1 10696 ± 1
511867 SAMI Eq 2 206.0 ± 2 46 ± 1 24.9 ± 0.1 24.5 ± 0.2 16493 ± 1
IC 1320 AMUSING++ Eq 6 85 ± 0 57 ± 3 165.4 ± 0.1 168.7 ± 0.0 4950 ± 0

The manga-9894-6104 galaxy is well described by the circular model. It shows a symmetric velocity field with orthogonal major and minor axes. The circular model describes well the observed velocities and produces small residuals of the order of ±10 km s-1 . The rotation curve is flat within the FoV, with Vmax248 km s-1 .

The velocity field of SAMI511867 shows a slight twist along the minor axis, which is well reproduced by the radial flow model. Significant contributions of radial motions of the order of 40 km s-1 are observed across the SAMI FoV. However, because of its small FoV , large PSF 2'' and the physical spatial resolution (FWHM 2 kpc), parameters derived in Table 6 could be affected by these effects.

Finally, IC 1320 is part of the AMUSING+ + galaxy compilation. This object was observed with the modern instrument MUSE (e.g., Bacon et al. 2010). The IFU of this instrument has the smallest spaxel size (0.2) and the best spatial resolution (seeing limited) of the data analyzed here; as a consequence, IC 1320 shows a velocity field rich in details. Among the different kinematic models, the harmonic model showed the lowest BIC value The c 1 component, which is a proxy of the circular rotation, is mostly flat across its optical extension with vmax200 km s-1 . Non-circular terms are dominant within the inner 10. The c 3 and s 3 coefficients may indicate the presence of stream flows associated with spiral arms or a stellar bar.

Received: February 07, 2022; Accepted: September 20, 2023

Creative Commons License This is an open-access article distributed under the terms of the Creative Commons Attribution License