{ "info": { "author": "Michele Cappellari", "author_email": "michele.cappellari@physics.ox.ac.uk", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "**pPXF: Full Spectrum Fitting of Galactic and Stellar Spectra**\n\n.. image:: http://www-astro.physics.ox.ac.uk/~mxc/software/ppxf.png\n.. image:: https://img.shields.io/pypi/v/ppxf.svg\n :target: https://pypi.org/project/ppxf/\n.. image:: https://img.shields.io/badge/arXiv-1607.08538-orange.svg\n :target: https://arxiv.org/abs/1607.08538\n.. image:: https://img.shields.io/badge/DOI-10.1093/mnras/stw3020-green.svg\n :target: https://doi.org/10.1093/mnras/stw3020\n\nThis ``pPXF`` package contains a Python implementation of the Penalized\nPiXel-Fitting (``pPXF``) method to fit the stellar and gas kinematics,\nas well as the stellar population of galaxies. The method was originally\ndescribed in `Cappellari & Emsellem (2004)\n`_\nand was significantly upgraded in `Cappellari (2017)\n`_.\n\n.. contents:: :depth: 1\n\nAttribution\n-----------\n\nIf you use this software for your research, please cite at least\n`Cappellari (2017) `_.\nThe BibTeX entry for the paper is::\n\n @ARTICLE{Cappellari2017,\n author = {{Cappellari}, M.},\n title = \"{Improving the full spectrum fitting method:\n accurate convolution with Gauss-Hermite functions}\",\n journal = {MNRAS},\n eprint = {1607.08538},\n year = 2017,\n volume = 466,\n pages = {798-811},\n doi = {10.1093/mnras/stw3020}\n }\n\nInstallation\n------------\n\ninstall with::\n\n pip install ppxf\n\nWithout write access to the global ``site-packages`` directory, use::\n\n pip install --user ppxf\n\nUsage Examples\n--------------\n\nTo learn how to use the main program ``pPXF`` run the example programs in the\n``ppxf/examples`` directory, within the main package installation folder inside\n``site-packages``, and read the detailed documentation in the file ``ppxf.py``\nor as PDF from ``_.\n\npPXF Purpose\n------------\n\nExtract galaxy stellar kinematics ``(V, sigma, h3, h4, h5, h6,...)``\nor the stellar population and gas emission by fitting a template\nto an observed spectrum in pixel space, using the Penalized PiXel-Fitting\n(``pPXF``) method originally described in\n\n`Cappellari & Emsellem (2004)\n`_\n\nand significantly upgraded in\n\n`Cappellari (2017)\n`_\n\nThe following key optional features are also available:\n\n1) An optimal template, positive linear combination of different input\n templates, can be fitted together with the kinematics.\n2) One can enforce smoothness on the template weights during the fit. This\n is useful to attach a physical meaning to the weights e.g. in terms of\n the star formation history of a galaxy.\n3) One can fit multiple kinematic components for both the stars and the gas\n emission lines. Both the stellar and gas LOSVD can be penalized and can\n be described by a general Gauss-Hermite series.\n4) Any parameter of the LOSVD (e.g. sigma) for any kinematic component can\n either be fitted, or held fixed to a given value, while other parameters\n are fitted. Alternatively, parameters can be constrained to lie within\n given limits or even tied by simple relations to other parameters.\n5) Additive and/or multiplicative polynomials can be included to adjust the\n continuum shape of the template to the observed spectrum.\n6) Iterative sigma clipping can be used to clean the spectrum.\n7) It is possible to fit a mirror-symmetric LOSVD to two spectra at the\n same time. This is useful for spectra taken at point-symmetric spatial\n positions with respect to the center of an equilibrium stellar system.\n8) One can include sky spectra in the fit, to deal with cases where the sky\n dominates the observed spectrum and an accurate sky subtraction is\n critical.\n9) One can derive an estimate of the reddening in the spectrum. This can be\n done independently for the stellar spectrum or the Balmer emission lines.\n10) The covariance matrix can be input instead of the error spectrum, to\n account for correlated errors in the spectral pixels.\n11) One can specify the weights fraction between two kinematics components,\n e.g. to model bulge and disk contributions.\n12) One can use templates with higher resolution than the galaxy, to\n improve the accuracy of the LOSVD extraction at low dispersion.\n\nCalling Sequence\n----------------\n\n.. code-block:: python\n\n from ppxf.ppxf import ppxf\n\n pp = ppxf(templates, galaxy, noise, velscale, start,\n bias=None, bounds=None, clean=False, component=0, degree=4,\n fixed=None, fraction=None, ftol=1e-4, gas_component=None,\n gas_names=None, gas_reddening=None, goodpixels=None, lam=None,\n linear=False, mask=None, method='capfit', mdegree=0, moments=2,\n plot=False, quiet=False, reddening=None, reddening_func=None,\n reg_dim=None, reg_ord=2, regul=0, sigma_diff=0, sky=None,\n templates_rfft=None, tied=None, trig=False, velscale_ratio=1,\n vsyst=0)\n\n print(pp.sol) # print best-fitting kinematics (V, sigma, h3, h4)\n pp.plot() # Plot best fit and gas lines\n\nInput Parameters\n----------------\n\ntemplates:\n Vector containing the spectrum of a single template star or more\n commonly an array of dimensions ``templates[nPixels, nTemplates]``\n containing different templates to be optimized during the fit of the\n kinematics. It has to be ``nPixels >= galaxy.size``.\n\n To apply linear regularization to the ``weights`` via the keyword\n ``regul``, ``templates`` should be an array of two\n ``templates[nPixels, nAge]``, three ``templates[nPixels, nAge, nMetal]``\n or four ``templates[nPixels, nAge, nMetal, nAlpha]`` dimensions,\n depending on the number of population variables one wants to study.\n This can be useful to try to attach a physical meaning to the output\n ``weights``, in term of the galaxy star formation history and chemical\n composition distribution.\n In that case the templates may represent single stellar population SSP\n models and should be arranged in sequence of increasing age,\n metallicity or alpha along the second, third or fourth dimension of the\n array respectively.\ngalaxy:\n Vector containing the spectrum of the galaxy to be measured. The\n star and the galaxy spectra have to be logarithmically rebinned but the\n continuum should *not* be subtracted. The rebinning may be performed\n with the ``log_rebin`` routine in ``ppxf.ppxf_util``.\n\n For high redshift galaxies, one should bring the spectra close to the\n restframe wavelength, before doing the ``pPXF`` fit. This can be done\n by dividing the observed wavelength by ``(1 + z)``, where ``z`` is a\n rough estimate of the galaxy redshift, before the logarithmic\n rebinning. See Section 2.4 of `Cappellari (2017)\n `_ for details.\n\n ``galaxy`` can also be an array of dimensions ``galaxy[nGalPixels, 2]``\n containing two spectra to be fitted, at the same time, with a\n reflection-symmetric LOSVD. This is useful for spectra taken at\n point-symmetric spatial positions with respect to the center of an\n equilibrium stellar system.\n For a discussion of the usefulness of this two-sided fitting see e.g.\n Section 3.6 of `Rix & White (1992)\n `_.\n\n IMPORTANT: (1) For the two-sided fitting the ``vsyst`` keyword has to\n be used. (2) Make sure the spectra are rescaled to be not too many\n order of magnitude different from unity, to avoid over or underflow\n problems in the calculation. E.g. units of ``erg/(s cm^2 A)`` may cause\n problems!\nnoise:\n Vector containing the ``1*sigma`` error (per pixel) in the galaxy\n spectrum, or covariance matrix describing the correlated errors in the\n galaxy spectrum. Of course this vector/matrix must have the same units\n as the galaxy spectrum.\n\n If ``galaxy`` is a ``Nx2`` array, ``noise`` has to be an array with the\n same dimensions.\n\n When ``noise`` has dimensions ``NxN`` it is assumed to contain the\n covariance matrix with elements ``sigma(i, j)``. When the errors in the\n spectrum are uncorrelated it is mathematically equivalent to input in\n ``pPXF`` an error vector ``noise=errvec`` or a ``NxN`` diagonal matrix\n ``noise=np.diag(errvec**2)`` (note squared!).\n\n IMPORTANT: the penalty term of the ``pPXF`` method is based on the\n *relative* change of the fit residuals. For this reason, the penalty\n will work as expected even if no reliable estimate of the ``noise`` is\n available (see `Cappellari & Emsellem (2004)\n `_ for details). If no\n reliable noise is available this keyword can just be set to::\n\n noise = np.ones_like(galaxy) # Same weight for all pixels\n\nvelscale:\n Velocity scale of the spectra in km/s per pixel. It has to be the\n same for both the galaxy and the template spectra.\n An exception is when the ``velscale_ratio`` keyword is used, in which\n case one can input ``templates`` with smaller ``velscale`` than\n ``galaxy``.\n\n ``velscale`` is *defined* in ``pPXF`` by\n ``velscale = c*Delta[np.log(lambda)]``, which is approximately\n ``velscale ~ c*Delta(lambda)/lambda``.\n See Section 2.3 of `Cappellari (2017)\n `_ for details.\nstart:\n Vector, or list/array of vectors ``[start1, start2, ...]``, with the\n initial estimate for the LOSVD parameters.\n\n When LOSVD parameters are not held fixed, each vector only needs to\n contain ``start = [velStart, sigmaStart]`` the initial guess for the\n velocity and the velocity dispersion in km/s. The starting values for\n h3-h6 (if they are fitted) are all set to zero by default.\n In other words, when ``moments=4``::\n\n start = [velStart, sigmaStart]\n\n is interpreted as::\n\n start = [velStart, sigmaStart, 0, 0]\n\n When the LOSVD for some kinematic components is held fixed (see\n ``fixed`` keyword), all values for ``[Vel, Sigma, h3, h4,...]`` can be\n provided.\n\n Unless a good initial guess is available, it is recommended to set the\n starting ``sigma >= 3*velscale`` in km/s (i.e. 3 pixels). In fact when\n the sigma is very low, and far from the true solution, the ``chi^2`` of\n the fit becomes weakly sensitive to small variations in sigma (see\n ``pPXF`` paper). In some instances, the near-constancy of ``chi^2`` may\n cause premature convergence of the optimization.\n\n In the case of two-sided fitting a good starting value for the velocity\n is ``velStart = 0.0`` (in this case ``vsyst`` will generally be\n nonzero). Alternatively on should keep in mind that velStart refers to\n the first input galaxy spectrum, while the second will have velocity\n ``-velStart``.\n\n With multiple kinematic components ``start`` must be a list of starting\n values, one for each different component.\n\n EXAMPLE: We want to fit two kinematic components. We fit 4 moments for\n the first component and 2 moments for the second one as follows::\n\n component = [0, 0, ... 0, 1, 1, ... 1]\n moments = [4, 2]\n start = [[V1, sigma1], [V2, sigma2]]\n\nOptional Keywords\n-----------------\n\nbias:\n This parameter biases the ``(h3, h4, ...)`` measurements towards zero\n (Gaussian LOSVD) unless their inclusion significantly decreases the\n error in the fit. Set this to ``bias=0`` not to bias the fit: the\n solution (including ``[V, sigma]``) will be noisier in that case. The\n default ``bias`` should provide acceptable results in most cases, but\n it would be safe to test it with Monte Carlo simulations. This keyword\n precisely corresponds to the parameter ``lambda`` in the\n `Cappellari & Emsellem (2004)\n `_ paper.\n Note that the penalty depends on the *relative* change of the fit\n residuals, so it is insensitive to proper scaling of the ``noise``\n vector. A nonzero ``bias`` can be safely used even without a reliable\n ``noise`` spectrum, or with equal weighting for all pixels.\nbounds:\n Lower and upper bounds for every kinematic parameter. This is an array,\n or list of arrays, with the same dimensions as ``start``, except for\n the last one, which is two. In practice, for every element of\n ``start`` one needs to specify a pair of values ``[lower, upper]``.\n\n EXAMPLE: We want to fit two kinematic components, with 4 moments for\n the first component and 2 for the second (e.g. stars and gas). In this\n case::\n\n moments = [4, 2]\n start_stars = [V1, sigma1, 0, 0]\n start_gas = [V2, sigma2]\n start = [start_stars, start_gas]\n\n then we can specify boundaries for each kinematic parameter as::\n\n bounds_stars = [[V1_lo, V1_up], [sigma1_lo, sigma1_up],\n [-0.3, 0.3], [-0.3, 0.3]]\n bounds_gas = [[V2_lo, V2_up], [sigma2_lo, sigma2_up]]\n bounds = [bounds_stars, bounds_gas]\n\ncomponent:\n When fitting more than one kinematic component, this keyword should\n contain the component number of each input template. In principle every\n template can belong to a different kinematic component.\n\n EXAMPLE: We want to fit the first 50 templates to component 0 and the\n last 10 templates to component 1. In this case::\n\n component = [0]*50 + [1]*10\n\n which, in Python syntax, is equivalent to::\n\n component = [0, 0, ... 0, 1, 1, ... 1]\n\n This keyword is especially useful when fitting both emissions (gas) and\n absorption (stars) templates simultaneously (see the example for\n ``moments`` keyword).\nclean:\n Set this keyword to use the iterative sigma clipping method described\n in Section 2.1 of `Cappellari et al. (2002)\n `_.\n This is useful to remove from the fit unmasked bad pixels, residual gas\n emissions or cosmic rays.\n\n IMPORTANT: This is recommended *only* if a reliable estimate of the\n ``noise`` spectrum is available. See also note below for ``.chi2``.\ndegree:\n Degree of the *additive* Legendre polynomial used to correct the\n template continuum shape during the fit (default: 4).\n Set ``degree=-1`` not to include any additive polynomial.\nfixed:\n Boolean vector set to ``True`` where a given kinematic parameter has to\n be held fixed with the value given in ``start``. This is an array, or\n list, with the same dimensions as ``start``.\n\n EXAMPLE: We want to fit two kinematic components, with 4 moments for\n the first component and 2 for the second. In this case::\n\n moments = [4, 2]\n start = [[V1, sigma1, h3, h4], [V2, sigma2]]\n\n then we can held fixed e.g. the sigma (only) of both components using::\n\n fixed = [[0, 1, 0, 0], [0, 1]]\n\n NOTE: Setting a negative ``moments`` for a kinematic component is\n entirely equivalent to setting ``fixed = 1`` for all parameters of the\n given kinematic component. In other words::\n\n moments = [-4, 2]\n\n is equivalent to::\n\n moments = [4, 2]\n fixed = [[1, 1, 1, 1], [0, 0]]\n\nfraction:\n This keyword allows one to fix the ratio between the first two\n kinematic components. This is a scalar defined as follows::\n\n fraction = np.sum(weights[component == 0])\n / np.sum(weights[component < 2])\n\n This is useful e.g. to try to kinematically decompose bulge and disk.\n\n IMPORTANT: The ``templates`` and ``galaxy`` spectra should be\n normalized with ``mean ~ 1`` (as an order of magnitude) for the\n ``fraction`` keyword to work as expected. A warning is printed if this\n is not the case and the resulting output ``fraction`` is inaccurate.\n\n The remaining kinematic components (``component > 1``) are left free,\n and this allows, for example, to still include gas emission line\n components.\nftol:\n Fractional tolerance for stopping the non-linear minimization (default\n 1e-4).\ngas_component:\n Boolean vector, of the same size as ``component``, set to ``True``\n where the given ``component`` describes a gas emission line. If given,\n ``pPXF`` provides the ``pp.gas_flux`` and ``pp.gas_flux_error`` in\n output.\n\n EXAMPLE: In the common situation where ``component = 0`` are stellar\n templates and the rest are gas emission lines, one will set::\n\n gas_component = component > 0\n\n This keyword is also used to plot the gas lines with a different color.\ngas_names:\n String array specifying the names of the emission lines (e.g.\n ``gas_names=[\"Hbeta\", \"[OIII]\",...]``, one per gas line. The length of\n this vector must match the number of nonzero elements in\n ``gas_component``. This vector is only used by ``pPXF`` to print the\n line names on the console.\ngas_reddening:\n Set this keyword to an initial estimate of the gas reddening\n ``E(B-V) >= 0`` to fit a positive gas reddening together with the\n kinematics and the templates. This reddening is applied only to the gas\n templates, namely to the templates with the corresponding element of\n ``gas_component=True``. The fit assumes by default the extinction curve\n of `Calzetti et al. (2000)\n `_ but any other\n prescription can be passed via the ``reddening_func`` keyword.\ngoodpixels:\n Integer vector containing the indices of the good pixels in the\n ``galaxy`` spectrum (in increasing order). Only these spectral pixels\n are included in the fit.\n\n IMPORTANT: in all likely situations this keyword *has* to be specified.\nlam:\n When the keyword ``reddening`` or ``gas_reddening`` are used, the user\n has to pass in this keyword a vector with the same dimensions of\n ``galaxy``, giving the restframe wavelength in Angstrom of every pixel\n in the input galaxy spectrum. If one uses my ``log_rebin`` routine to\n rebin the spectrum before the ``pPXF`` fit::\n\n from ppxf.ppxf_util import log_rebin\n specNew, logLam, velscale = log_rebin(lamRange, galaxy)\n\n the wavelength can be obtained as ``lam = np.exp(logLam)``.\n\n When ``lam`` is given, the wavelength is shown in the best-fitting\n plot, instead of the pixels.\nlinear:\n Set to ``True`` to keep *all* nonlinear parameters fixed and *only*\n perform a linear fit for the templates and additive polynomials\n weights. The output solution is a copy of the input one and the errors\n are zero.\nmask:\n Boolean vector of length ``galaxy.size`` specifying with ``True`` the\n pixels that should be included in the fit. This keyword is just an\n alternative way of specifying the ``goodpixels``.\nmethod: {'capfit', 'trf', 'dogbox', 'lm'}, optional.\n Algorithm to perform the non-linear minimization step.\n The default ``'capfit'`` is a novel trust-region implementation of the\n Levenberg-Marquardt method, generalized to deal with box constraints in\n a rigorous manner, while also allowing for tied or fixed variables.\n See documentation of ``scipy.optimize.least_squares`` for the other\n methods.\nmdegree:\n Degree of the *multiplicative* Legendre polynomial (with a mean of 1)\n used to correct the continuum shape during the fit (default: 0). The\n zero degree multiplicative polynomial is always included in the fit as\n it corresponds to the weights assigned to the templates. Note that the\n computation time is longer with multiplicative polynomials than with\n the same number of additive polynomials.\n\n IMPORTANT: Multiplicative polynomials cannot be used when the\n ``reddening`` keyword is set, as they are degenerate with the\n reddening.\nmoments:\n Order of the Gauss-Hermite moments to fit. Set this keyword to 4 to\n fit ``[h3, h4]`` and to 6 to fit ``[h3, h4, h5, h6]``. Note that in all\n cases the G-H moments are fitted (non-linearly) *together* with\n ``[V, sigma]``.\n\n If ``moments=2`` or ``moments`` is not set then only ``[V, sigma]`` are\n fitted.\n\n If ``moments`` is negative then the kinematics of the given\n ``component`` are kept fixed to the input values.\n NOTE: Setting a negative ``moments`` for a kinematic component is\n entirely equivalent to setting ``fixed = 1`` for all parameters of the\n given kinematic component.\n\n EXAMPLE: We want to keep fixed ``component = 0``, which has a LOSVD\n described by ``[V, sigma, h3, h4]`` and is modelled with 100 spectral\n templates; At the same time, we fit ``[V, sigma]`` for \n ``component = 1``, which is described by 5 templates (this situation\n may arise when fitting stellar templates with pre-determined stellar\n kinematics, while fitting the gas emission).\n We should give in input to ``pPXF`` the following parameters::\n\n component = [0]*100 + [1]*5 # --> [0, 0, ... 0, 1, 1, 1, 1, 1]\n moments = [-4, 2]\n start = [[V, sigma, h3, h4], [V, sigma]]\n\nvelscale_ratio:\n Integer. Gives the integer ``ratio >= 1`` between the ``velscale`` of\n the ``galaxy`` and the ``templates``. When this keyword is used, the\n templates are convolved by the LOSVD at their native resolution, and\n only subsequently are integrated over the pixels and fitted to\n ``galaxy``. This keyword is generally unnecessary and mostly useful for\n testing.\n\n Note that in realistic situations the uncertainty in the knowledge and\n variations of the intrinsic line-spread function become the limiting\n factor in recovering the LOSVD well below ``velscale``.\nplot:\n Set this keyword to plot the best fitting solution and the residuals\n at the end of the fit.\n\n One can also call the class function ``pp.plot()`` after the call to\n ``pp = ppxf(...)``.\nquiet:\n Set this keyword to suppress verbose output of the best fitting\n parameters at the end of the fit.\nreddening:\n Set this keyword to an initial estimate of the stellar reddening\n ``E(B-V) >= 0`` to fit a positive stellar reddening together with the\n kinematics and the templates. This reddening is applied only to the\n stellar templates, namely to the templates with the corresponding\n element of ``gas_component=False``, or to all templates, if\n ``gas_component`` is not set. The fit assumes by default the extinction\n curve of `Calzetti et al. (2000)\n `_ but any other\n prescription can be passed via the ``reddening_func`` keyword.\n\n IMPORTANT: The ``mdegree`` keyword cannot be used when ``reddening`` is\n set.\nregul:\n If this keyword is nonzero, the program applies first or second order\n linear regularization to the ``weights`` during the ``pPXF`` fit.\n Regularization is done in one, two or three dimensions depending on\n whether the array of ``templates`` has two, three or four dimensions\n respectively.\n Large ``regul`` values correspond to smoother ``weights`` output. When\n this keyword is nonzero the solution will be a trade-off between the\n smoothness of ``weights`` and goodness of fit.\n\n Section 3.5 of `Cappellari (2017)\n `_ gives a\n description of regularization.\n\n When fitting multiple kinematic ``component`` the regularization is\n applied only to the first ``component = 0``, while additional\n components are not regularized. This is useful when fitting stellar\n population together with gas emission lines. In that case, the SSP\n spectral templates must be given first and the gas emission templates\n are given last. In this situation, one has to use the ``reg_dim``\n keyword (below), to give ``pPXF`` the dimensions of the population\n parameters (e.g. ``nAge``, ``nMetal``, ``nAlpha``). A usage example is\n given in the file ``ppxf_example_population_gas_sdss.py``.\n\n The effect of the regularization scheme is the following:\n\n * With ``reg_ord=1`` it enforces the numerical first derivatives\n between neighbouring weights (in the 1-dim case) to be equal to\n ``w[j] - w[j+1] = 0`` with an error ``Delta = 1/regul``.\n\n * With ``reg_ord=2`` it enforces the numerical second derivatives\n between neighboring weights (in the 1-dim case) to be equal to\n ``w[j-1] - 2*w[j] + w[j+1] = 0`` with an error ``Delta = 1/regul``.\n\n It may be helpful to define ``regul = 1/Delta`` and think of ``Delta``\n as the regularization error.\n\n IMPORTANT: ``Delta`` needs to be smaller but of the same order of\n magnitude of the typical ``weights`` to play an effect on the\n regularization. One quick way to achieve this is:\n\n 1. Divide the full ``templates`` array by a scalar in such a way that\n the typical template has a median of one::\n\n templates /= np.median(templates)\n\n 2. Do the same for the input galaxy spectrum::\n\n galaxy /= np.median(galaxy)\n\n 3. In this situation, a sensible guess for ``Delta`` will be a few\n percent (e.g. ``0.01 --> regul=100``).\n\n Alternatively, for a more rigorous definition of the parameter\n ``regul``:\n\n A. Perform an un-regularized fit (``regul=0``) and then rescale the\n input ``noise`` spectrum so that::\n\n Chi^2/DOF = Chi^2/goodPixels.size = 1.\n\n This is achieved by rescaling the input ``noise`` spectrum as::\n\n noise = noise*sqrt(Chi**2/DOF) = noise*sqrt(pp.chi2);\n\n B. Increase ``regul`` and iteratively redo the ``pPXF`` fit until the\n ``Chi^2`` increases from the unregularized value\n ``Chi^2 = goodPixels.size`` by\n ``DeltaChi^2 = sqrt(2*goodPixels.size)``.\n\n The derived regularization corresponds to the maximum one still\n consistent with the observations and the derived star formation history\n will be the smoothest (minimum curvature or minimum variation) that is\n still consistent with the observations.\nreg_dim:\n When using regularization with more than one kinematic component (using\n the ``component`` keyword), the regularization is only applied to the\n first one (``component=0``). This is useful to fit the stellar\n population and gas emission together.\n\n In this situation, one has to use the ``reg_dim`` keyword, to give\n ``pPXF`` the dimensions of the population parameters (e.g. ``nAge``,\n ``nMetal``, ``nAlpha``). One should creates the initial array of\n population templates like e.g.\n ``templates[nPixels, nAge, nMetal, nAlpha]`` and define::\n\n reg_dim = templates.shape[1:] # = [nAge, nMetal, nAlpha]\n\n The array of stellar templates is then reshaped into a 2-dim array as::\n\n templates = templates.reshape(templates.shape[0], -1)\n\n and the gas emission templates are appended as extra columns at the\n end. An usage example is given in\n ``ppxf_example_population_gas_sdss.py``.\n\n When using regularization with a single component (the ``component``\n keyword is not used, or contains identical values), the number of\n population templates along different dimensions (e.g. ``nAge``,\n ``nMetal``, ``nAlpha``) is inferred from the dimensions of the\n ``templates`` array and this keyword is not necessary.\nreg_ord:\n Order of the derivative that is minimized by the regularization.\n The following two rotationally-symmetric estimators are supported:\n\n * ``reg_ord=1``: minimizes the integral over the weights of the squared\n gradient::\n\n Grad[w] @ Grad[w].\n\n * ``reg_ord=2``: minimizes the integral over the weights of the squared\n curvature::\n\n Laplacian[w]**2.\n\nsigma_diff:\n Quadratic difference in km/s defined as::\n\n sigma_diff**2 = sigma_inst**2 - sigma_temp**2\n\n between the instrumental dispersion of the galaxy spectrum and the\n instrumental dispersion of the template spectra.\n\n This keyword is useful when the templates have higher resolution than\n the galaxy and they were not convolved to match the instrumental\n dispersion of the galaxy spectrum. In this situation, the convolution\n is done by ``pPXF`` with increased accuracy, using an analytic Fourier\n Transform.\nsky:\n vector containing the spectrum of the sky to be included in the fit, or\n array of dimensions ``sky[nPixels, nSky]`` containing different sky\n spectra to add to the model of the observed ``galaxy`` spectrum. The\n ``sky`` has to be log-rebinned as the ``galaxy`` spectrum and needs to\n have the same number of pixels.\n\n The sky is generally subtracted from the data before the ``pPXF`` fit.\n However, for observations very heavily dominated by the sky spectrum,\n where a very accurate sky subtraction is critical, it may be useful\n *not* to subtract the sky from the spectrum, but to include it in the\n fit using this keyword.\ntemplates_rfft:\n When calling ``pPXF`` many times with an identical set of templates,\n one can use this keyword to pass the real FFT of the templates,\n computed in a previous ``pPXF`` call, stored in the\n ``pp.templates_rfft`` attribute. This keyword mainly exists to show\n that there is no need for it...\n\n IMPORTANT: Use this keyword only if you understand what you are doing!\ntied:\n A list of string expressions. Each expression \"ties\" the parameter to\n other free or fixed parameters. Any expression involving constants and\n the parameter array ``p[j]`` are permitted. Since they are totally\n constrained, tied parameters are considered to be fixed; no errors are\n computed for them.\n\n This is an array, or list of arrays, with the same dimensions as\n ``start``. In practice, for every element of ``start`` one needs to\n specify either an empty string ``''`` implying that the parameter is\n free, or a string expression involving some of the variables ``p[j]``,\n where ``j`` represents the index of the flattened list of kinematic \n parameters.\n\n EXAMPLE: We want to fit three kinematic components, with 4 moments for\n the first component and 2 moments for the second and third (e.g. stars\n and two gas components). In this case::\n\n moments = [4, 2, 2]\n start = [[V1, sigma1, 0, 0], [V2, sigma2], [V3, sigma3]]\n\n then we can force the equality constraint ``V2 = V3`` as follows::\n\n tied = [['', '', '', ''], ['', ''], ['p[4]', '']]\n\n or we can force the equality constraint ``sigma2 = sigma3`` as\n follows::\n\n tied = [['', '', '', ''], ['', ''], ['', 'p[5]']]\n\n NOTE: One could in principle use the ``tied`` keyword to completely tie\n the LOSVD of two kinematic components. However, this same effect is more\n efficient achieved by assigning them to the same kinematic component\n using the ``component`` keyword.\ntrig:\n Set ``trig=True`` to use trigonometric series as an alternative to\n Legendre polynomials, for both the additive and multiplicative\n polynomials. When ``trig=True`` the fitted series below has\n ``N = degree/2`` or ``N = mdegree/2``::\n\n poly = A_0 + sum_{n=1}^{N} [A_n*cos(n*th) + B_n*sin(n*th)]\n\n IMPORTANT: The trigonometric series has periodic boundary conditions.\n This is sometimes a desirable property, but this expansion is not as\n flexible as the Legendre polynomials.\nvsyst:\n Reference velocity in ``km/s`` (default 0). The input initial guess and\n the output velocities are measured with respect to this velocity. This\n keyword is generally used to account for the difference in the starting\n wavelength of the templates and the galaxy spectrum as follows::\n\n vsyst = c*np.log(wave_temp[0]/wave_gal[0])\n\n The value assigned to this keyword is *crucial* for the two-sided\n fitting. In this case ``vsyst`` can be determined from a previous\n normal one-sided fit to the galaxy velocity profile. After that initial\n fit, ``vsyst`` can be defined as the measured velocity at the galaxy\n center. More accurately ``vsyst`` is the value which has to be\n subtracted to obtain a nearly anti-symmetric velocity profile at the\n two opposite sides of the galaxy nucleus.\n\n IMPORTANT: this value is generally *different* from the systemic\n velocity one can get from the literature. Do not try to use that!\n\nOutput Parameters\n-----------------\n\nStored as attributes of the ``pPXF`` class:\n\n.apoly:\n Vector with the best fitting additive polynomial.\n.bestfit:\n Vector with the best fitting model for the galaxy spectrum.\n This is a linear combination of the templates, convolved with the best\n fitting LOSVD, multiplied by the multiplicative polynomials and\n with subsequently added polynomial continuum terms or sky components.\n.chi2:\n The reduced ``chi^2`` (namely ``chi^2/DOF``) of the fit\n (where ``DOF ~ pp.goodpixels.size``).\n\n IMPORTANT: if ``Chi^2/DOF`` is not ~1 it means that the errors are not\n properly estimated, or that the template is bad and it is *not* safe to\n set the ``clean`` keyword.\n.gas_bestfit:\n If ``gas_component`` is not ``None``, this attribute returns the\n best-fitting gas spectrum alone. The stellar spectrum alone can be\n computed as ``stellar_spectrum = pp.bestfit - pp.gas_bestfit``\n.gas_flux:\n Vector with the integrated flux (in counts) of all lines set as\n ``True`` in the input ``gas_component`` keyword. This is the flux of\n individual gas templates, which may include multiple lines.\n This implies that, if a gas template describes a doublet, the flux is\n that of both lines. If the Balmer series is input as a single template,\n this is the flux of the entire series.\n\n The returned fluxes are not corrected in any way and in particular, no\n reddening correction is applied. In other words, the returned\n ``.gas_flux`` should be unchanged, within the errors, regardless of\n whether reddening or multiplicative polynomials were fitted by ``pPXF``\n or not. The fluxes are just raw values as one could measure (with lower\n accuracy) by summing the pixels, within the given gas lines, on the\n continuum-subtracted input galaxy spectrum.\n\n IMPORTANT: ``pPXF`` makes no assumptions about the input flux units:\n The returned ``.gas_flux`` has the same units as the quantity one would\n obtain by just summing the values of the spectral pixels within the gas\n emission. This implies that, if the spectrum is in units of \n ``erg/(cm^2 s A)``, the gas flux returned by ``pPXF`` should be\n multiplied by the pixel size in Angstrom at the line wavelength to\n obtain the integrated line flux in units of ``erg/(cm^2 s)``.\n\n NOTE: If there is no gas reddening and each input gas templates was\n normalized to ``sum = 1``, then \n ``pp.gas_flux = pp.weights[pp.gas_component]``.\n\n When a gas template is identically zero within the fitted region, then\n ``pp.gas_flux = pp.gas_flux_error = np.nan``. The corresponding\n components of ``pp.gas_zero_template`` are set to ``True``. These\n ``np.nan`` values are set at the end of the calculation to flag the\n undefined values. They do *not* indicate numerical issues with the\n actual ``pPXF`` calculation, and the rest of the ``pPXF`` output is\n reliable.\n.gas_flux_error:\n *Formal* uncertainty (``1*sigma``) for the quantity ``pp.gas_flux``, in\n the same units as the gas fluxes.\n\n This error is approximate as it ignores the covariance between the gas\n flux and any non-linear parameter. Bootstrapping can be used for more\n accurate errors.\n\n These errors are meaningless unless ``Chi^2/DOF ~ 1``. However if one\n *assumes* that the fit is good, a corrected estimate of the errors is::\n\n gas_flux_error_corr = gas_flux_error*sqrt(chi^2/DOF)\n = pp.gas_flux_error*sqrt(pp.chi2).\n\n.gas_mpoly:\n vector with the best-fitting gas reddening curve.\n.gas_reddening:\n Best fitting ``E(B-V)`` value if the ``gas_reddening`` keyword is set.\n This is especially useful when the Balmer series is input as a single\n template with an assumed theoretically predicted decrement e.g. using\n ``emission_lines(..., tie_balmer=True)`` in ``ppxf.ppxf_util`` to\n compute the gas templates.\n.gas_zero_template:\n vector of size ``gas_component.sum()`` set to ``True`` where\n the gas template was identically zero within the fitted region.\n For those gas components ``pp.gas_flux = pp.gas_flux_error = np.nan``.\n.goodpixels:\n Integer vector containing the indices of the good pixels in the fit.\n This vector is a copy of the input ``goodpixels`` if ``clean = False``\n otherwise it will be updated by removing the detected outliers.\n.error:\n This variable contains a vector of *formal* uncertainty (``1*sigma``)\n for the fitted parameters in the output vector ``sol``. This option can\n be used when speed is essential, to obtain an order of magnitude\n estimate of the uncertainties, but we *strongly* recommend to run\n bootstrapping simulations to obtain more reliable errors. In fact these\n errors can be severely underestimated in the region where the penalty\n effect is most important (``sigma < 2*velscale``).\n\n These errors are meaningless unless ``Chi^2/DOF ~ 1``. However if one\n *assumes* that the fit is good, a corrected estimate of the errors is::\n\n error_corr = error*sqrt(chi^2/DOF) = pp.error*sqrt(pp.chi2).\n\n IMPORTANT: when running Monte Carlo simulations to determine the error,\n the penalty (``bias``) should be set to zero, or better to a very small\n value. See Section 3.4 of `Cappellari & Emsellem (2004)\n `_ for an explanation.\n.polyweights:\n This is largely superseded by the ``.apoly`` attribute above.\n\n When ``degree >= 0`` contains the weights of the additive Legendre\n polynomials of order ``0, 1,... degree``. The best fitting additive\n polynomial can be explicitly evaluated as::\n\n from numpy.polynomial import legendre\n x = np.linspace(-1, 1, len(galaxy))\n apoly = legendre.legval(x, pp.polyweights)\n\n When ``trig=True`` the polynomial is evaluated as::\n\n apoly = pp.trigval(x, pp.polyweights)\n\n When doing a two-sided fitting (see help for ``galaxy`` parameter), the\n additive polynomials are allowed to be different for the left and right\n spectrum. In that case, the output weights of the additive polynomials\n alternate between the first (left) spectrum and the second (right)\n spectrum.\n.matrix:\n Prediction ``matrix[nPixels, degree+nTemplates]`` of the linear system.\n\n ``pp.matrix[nPixels, :degree]`` contains the additive polynomials if\n ``degree >= 0``.\n\n ``pp.matrix[nPixels, degree:]`` contains the templates convolved by the\n LOSVD, and multiplied by the multiplicative polynomials if \n ``mdegree > 0``.\n.mpoly:\n Best fitting multiplicative polynomial (or reddening curve when\n ``reddening`` is set).\n.mpolyweights:\n This is largely superseded by the ``.mpoly`` attribute above.\n\n When ``mdegree > 0`` this contains in output the coefficients of the\n multiplicative Legendre polynomials of order ``1, 2,... mdegree``.\n The polynomial can be explicitly evaluated as::\n\n from numpy.polynomial import legendre\n x = np.linspace(-1, 1, len(galaxy))\n mpoly = legendre.legval(x, np.append(1, pp.mpolyweights))\n\n When ``trig = True`` the polynomial is evaluated as::\n\n mpoly = pp.trigval(x, np.append(1, pp.mpolyweights))\n\n.reddening:\n Best fitting ``E(B-V)`` value if the ``reddening`` keyword is set.\n.sol:\n Vector containing in output the parameters of the kinematics.\n\n * If ``moments=2`` this contains ``[Vel, Sigma]``\n * If ``moments=4`` this contains ``[Vel, Sigma, h3, h4]``\n * If ``moments=N`` this contains ``[Vel, Sigma, h3,... hN]``\n\n When fitting multiple kinematic ``component``, ``pp.sol`` contains a\n list with the solution for all different components, one after the\n other, sorted by ``component``: ``pp.sol = [sol1, sol2,...]``.\n\n ``Vel`` is the velocity, ``Sigma`` is the velocity dispersion, \n ``h3 - h6`` are the Gauss-Hermite coefficients. The model parameters\n are fitted simultaneously.\n\n IMPORTANT: The precise relation between the output ``pPXF`` velocity\n and redshift is ``Vel = c*np.log(1 + z)``. See Section 2.3 of\n `Cappellari (2017) `_\n for a detailed explanation.\n\n These are the default safety limits on the fitting parameters\n (they can be changed using the ``bounds`` keyword):\n\n * Vel is constrained to be +/-2000 km/s from the first input guess\n * ``velscale/100 < Sigma < 1000`` km/s\n * ``-0.3 < [h3, h4, ...] < 0.3`` (extreme value for real galaxies)\n\n In the case of two-sided LOSVD fitting the output values refer to the\n first input galaxy spectrum, while the second spectrum will have by\n construction kinematics parameters ``[-Vel, Sigma, -h3, h4, -h5, h6]``.\n If ``vsyst`` is nonzero (as required for two-sided fitting), then the\n output velocity is measured with respect to ``vsyst``.\n.status:\n Contains the output status of the optimization. Positive values\n generally represent success (the status is defined as in\n ``scipy.optimize.least_squares``).\n.weights:\n Receives the value of the weights by which each template was\n multiplied to best fit the galaxy spectrum. The optimal template can be\n computed with an array-vector multiplication::\n\n bestemp = templates @ weights\n\n These weights do not include the weights of the additive polynomials\n which are separately stored in ``pp.polyweights``.\n\n When the ``sky`` keyword is used ``weights[:nTemplates]`` contains the\n weights for the templates, while ``weights[nTemplates:]`` gives the\n ones for the sky. In that case the best fitting galaxy template and sky\n are given by::\n\n bestemp = templates @ weights[:nTemplates]\n bestsky = sky @ weights[nTemplates:]\n\n When doing a two-sided fitting (see help for ``galaxy`` parameter)\n *together* with the ``sky`` keyword, the sky weights are allowed to be\n different for the left and right spectrum. In that case the output sky\n weights alternate between the first (left) spectrum and the second\n (right) spectrum.\n\nHow to Set Regularization\n-------------------------\n\nThe ``pPXF`` routine can give sensible quick results with the default\n``bias`` parameter, however, like in any penalized/filtered/regularized\nmethod, the optimal amount of penalization generally depends on the problem\nunder study.\n\nThe general rule here is that the penalty should leave the line-of-sight\nvelocity-distribution (LOSVD) virtually unaffected, when it is well sampled\nand the signal-to-noise ratio (``S/N``) is sufficiently high.\n\nEXAMPLE: If you expect a LOSVD with up to a high ``h4 ~ 0.2`` and your\nadopted penalty (``bias``) biases the solution towards a much lower \n``h4 ~ 0.1``, even when the measured ``sigma > 3*velscale`` and the S/N is\nhigh, then you are *misusing* the ``pPXF`` method!\n\nTHE RECIPE: The following is a simple practical recipe for a sensible\ndetermination of the penalty in ``pPXF``:\n\n1. Choose a minimum ``(S/N)_min`` level for your kinematics extraction and\n spatially bin your data so that there are no spectra below\n ``(S/N)_min``;\n2. Perform a fit of your kinematics *without* penalty (keyword ``bias=0``).\n The solution will be noisy and may be affected by spurious solutions,\n however, this step will allow you to check the expected mean ranges in\n the Gauss-Hermite parameters ``[h3, h4]`` for the galaxy under study;\n3. Perform a Monte Carlo simulation of your spectra, following e.g. the\n included ``ppxf_example_simulation.py`` routine. Adopt as ``S/N`` in the\n simulation the chosen value ``(S/N)_min`` and as input ``[h3, h4]`` the\n maximum representative values measured in the non-penalized ``pPXF`` fit\n of the previous step;\n4. Choose as the penalty (``bias``) the *largest* value such that, for\n ``sigma > 3*velscale``, the mean difference delta between the output \n ``[h3, h4]`` and the input ``[h3, h4]`` is well within (e.g. \n ``delta ~ rms/3``) the rms scatter of the simulated values (see an\n example in Fig. 2 of `Emsellem et al. 2004\n `_).\n\nProblems with Your First Fit?\n-----------------------------\n\nCommon problems with your first ``pPXF`` fit are caused by incorrect\nwavelength ranges or different velocity scales between galaxy and\ntemplates. To quickly detect these problems try to overplot the (log\nrebinned) galaxy and the template just before calling the ``pPXF``\nprocedure.\n\nYou can use something like the following Python lines while adjusting the\nsmoothing window and the pixels shift. If you cannot get a rough match\nby eye it means something is wrong and it is unlikely that ``pPXF``\n(or any other program) will find a good match:\n\n.. code-block:: python\n\n import numpy as np\n import matplotlib.pyplot as plt\n import scipy.ndimage\n\n sigma = 2 # Velocity dispersion in pixels\n shift = -20 # Velocity shift in pixels\n template = np.roll(ndimage.gaussian_filter1d(template, sigma), shift)\n plt.plot(galaxy, 'k')\n plt.plot(template*np.median(galaxy)/np.median(template), 'r')\n\n\n\nLicense\n-------\n\nOther/Proprietary License\n\nCopyright (c) 2001-2019 Michele Cappellari\n\nThis software is provided as is without any warranty whatsoever.\nPermission to use, for non-commercial purposes is granted.\nPermission to modify for personal or internal use is granted,\nprovided this copyright and disclaimer are included in all \ncopies of the software. All other rights are reserved.\nIn particular, redistribution of the code is not allowed.\n\nChangelog\n---------\n\nV6.7.16: MC, Oxford, 12 June 2019\n+++++++++++++++++++++++++++++++++\n\n- ``capfit``: Use only free parameters for small-step convergence test.\n- ``capfit``: Describe in words convergence status with nonzero ``verbose``.\n- ``capfit``: Fixed program stop when ``abs_step`` is undefined.\n- ``capfit``: Fixed ignoring optional ``max_nfev``.\n\nV6.7.15: MC, Oxford, 7 February 2019\n++++++++++++++++++++++++++++++++++++\n- Removed unused ``re`` import.\n- Removed Scipy's ``next_fast_len`` usage due to an issue with odd padding size.\n Thanks to Eric Emsellem (ESO) for a clear example illustrating this rare and\n subtle bug.\n\nV6.7.14: MC, Oxford, 27 November 2018\n++++++++++++++++++++++++++++++++++++++\n- Print used ``tied`` parameters equalities, if any.\n- Return ``.ndof`` attribute.\n- Do not remove ``fixed`` or ``tied`` parameters from the DOF calculation.\n Thanks to Joanna Woo (Univ. of Victoria) for the correction.\n- Replaced ``normalize``, ``min_age``, ``max_age`` and ``metal`` keywords with\n ``norm_range``, ``age_range`` and ``metal_range`` in ``ppxf.miles_util.miles``.\n- Fixed ``clock`` ``DeprecationWarning`` in Python 3.7.\n\nV6.7.13: MC, Oxford, 20 September 2018\n++++++++++++++++++++++++++++++++++++++\n- Expanded documentation of ``reddening`` and ``gas_reddening``.\n Thanks to Nick Boardman (Univ. Utah) for the feedback.\n- ``capfit`` now raises an error if one tries to tie parameters to themselves.\n Thanks to Kyle Westfall (Univ. Santa Cruz) for the suggestion.\n- ``capfit`` uses Python 3.6 f-strings.\n\nV6.7.12: MC, Oxford, 9 July 2018\n++++++++++++++++++++++++++++++++\n- Allow for ``velscale`` and ``vsyst`` to be Numpy arrays rather than scalars.\n- Improved criterion for when the Balmer series is within the fitted wavelength\n range in ``ppxf.ppxf_util.emission_lines``. Thanks to Sam Vaughan\n (Univ. of Oxford) for the feedback.\n- Included ``width`` keyword in ``ppxf.ppxf_util.determine_goodpixels``.\n Thanks to George Privon (Univ. of Florida) for the suggestion.\n- Expanded ``.gas_flux`` documentation.\n\nV6.7.11: MC, Oxford, 5 June 2018\n++++++++++++++++++++++++++++++++\n\n- Formatted ``ppxf.py`` docstring in reStructuredText.\n- Removed CHANGELOG from the code and placed in a separate file.\n- Modified ``setup.py`` to show help and CHANGELOG on PyPi page.\n- Included ``ppxf.__version__``.\n\nV6.7.8: MC, Oxford, 21 May 2018\n+++++++++++++++++++++++++++++++\n\n- Moved package to the Python Package Index (PyPi).\n- Dropped legacy Python 2.7 support.\n\nV6.7.6: MC, Oxford, 16 April 2018\n+++++++++++++++++++++++++++++++++\n\n- Changed imports for the conversion of pPXF to a package.\n Thanks to Joe Burchett (Santa Cruz) for the suggestion.\n\nV6.7.5: MC, Oxford, 10 April 2018\n+++++++++++++++++++++++++++++++++\n\n- Fixed syntax error under Python 2.7.\n\nV6.7.4: MC, Oxford, 16 February 2018\n++++++++++++++++++++++++++++++++++++\n\n- Fixed bug in ``reddening_cal00()``. It only affected NIR lam > 1000 nm.\n\nV6.7.3: MC, Oxford, 8 February 2018\n+++++++++++++++++++++++++++++++++++\n\n- Plot wavelength in nm instead of Angstrom, following IAU rules.\n- Ensures each element of ``start`` is not longer than its ``moments``.\n- Removed underscore from internal function names.\n- Included ``ftol`` keyword.\n\nV6.7.2: MC, Oxford, 30 January 2018\n+++++++++++++++++++++++++++++++++++\n\n- Included dunder names as suggested by Peter Weilbacher (Potsdam).\n- Fixed wrong ``.gas_reddening`` when ``mdegree > 0``.\n- Improved formatting of documentation.\n\nV6.7.1: MC, Oxford, 29 November 2017\n++++++++++++++++++++++++++++++++++++\n\n- Removed import of ``misc.factorial``, deprecated in Scipy 1.0.\n\nV6.7.0: MC, Oxford, 6 November 2017\n+++++++++++++++++++++++++++++++++++\n\n- Allow users to input identically-zero gas templates while still\n producing a stable NNLS solution. In this case, warn the user and set\n the .gas_zero_template attribute. This situation can indicate an input\n bug or a gas line which entirely falls within a masked region.\n- Corrected ``gas_flux_error`` normalization, when input not normalized.\n- Return ``.gas_bestfit``, ``.gas_mpoly``, ``.mpoly`` and ``.apoly`` attributes.\n- Do not multiply gas emission lines by polynomials, instead allow for\n ``gas_reddening`` (useful with tied Balmer emission lines).\n- Use ``axvspan`` to visualize masked regions in plot.\n- Fixed program stop with ``linear`` keyword.\n- Introduced ``reddening_func`` keyword.\n\nV6.6.4: MC, Oxford, 5 October 2017\n++++++++++++++++++++++++++++++++++\n\n- Check for NaN in ``galaxy`` and check all ``bounds`` have two elements.\n- Allow ``start`` to be either a list or an array or vectors.\n\nV6.6.3: MC, Oxford, 25 September 2017\n+++++++++++++++++++++++++++++++++++++\n\n- Reduced bounds on multiplicative polynomials and clipped to positive\n values. Thanks to Xihan Ji (Tsinghua University) for providing an\n example of slightly negative gas emission lines, when the spectrum\n contains essentially just noise.\n- Improved visualization of masked pixels.\n\nV6.6.2: MC, Oxford, 15 September 2017\n+++++++++++++++++++++++++++++++++++++\n\n- Fixed program stop with a 2-dim templates array and regularization.\n Thanks to Adriano Poci (Macquarie University) for the clear report and\n the fix.\n\nV6.6.1: MC, Oxford, 4 August 2017\n+++++++++++++++++++++++++++++++++\n\n- Included note on ``.gas_flux`` output units. Thanks to Xihan Ji\n (Tsinghua University) for the feedback.\n\nV6.6.0: MC, Oxford, 27 June 2017\n++++++++++++++++++++++++++++++++\n\n- Print and return gas fluxes and errors, if requested, with the new\n ``gas_component`` and ``gas_names`` keywords.\n\nV6.5.0: MC, Oxford, 23 June 2017\n++++++++++++++++++++++++++++++++\n\n- Replaced ``MPFIT`` with ``capfit`` for a Levenberg-Marquardt method with\n fixed or tied variables, which rigorously accounts for box constraints.\n\nV6.4.2: MC, Oxford, 2 June 2017\n+++++++++++++++++++++++++++++++\n\n- Fixed removal of bounds in solution, introduced in V6.4.1.\n Thanks to Kyle Westfall (Univ. Santa Cruz) for reporting this.\n- Included ``method`` keyword to use Scipy's ``least_squares()``\n as alternative to MPFIT.\n- Force float division in pixel conversion of ``start`` and ``bounds``.\n\nV6.4.1: MC, Oxford, 25 May 2017\n+++++++++++++++++++++++++++++++\n\n- ``linear_fit()`` does not return unused status any more, for\n consistency with the correspinding change to ``cap_mpfit``.\n\nV6.4.0: MC, Oxford, 12 May 2017\n+++++++++++++++++++++++++++++++\n\n- Introduced ``tied`` keyword to tie parameters during fitting.\n- Included discussion of formal errors of ``.weights``.\n\nV6.3.2: MC, Oxford, 4 May 2017\n++++++++++++++++++++++++++++++\n\n- Fixed possible program stop introduced in V6.0.7 and consequently\n removed unnecessary function ``_templates_rfft()``. Many thanks to\n Jesus Falcon-Barroso for a very clear and useful bug report!\n\nV6.3.1: MC, Oxford, 13 April 2017\n+++++++++++++++++++++++++++++++++\n\n- Fixed program stop when fitting two galaxy spectra with\n reflection-symmetric LOSVD.\n\nV6.3.0: MC, Oxford, 30 March 2017\n+++++++++++++++++++++++++++++++++\n\n- Included ``reg_ord`` keyword to allow for both first and second order\n regularization.\n\nV6.2.0: MC, Oxford, 27 March 2017\n+++++++++++++++++++++++++++++++++\n\n- Improved curvature criterion for regularization when ``dim > 1``.\n\nV6.1.0: MC, Oxford, 15 March 2017\n+++++++++++++++++++++++++++++++++\n\n- Introduced ``trig`` keyword to use a trigonometric series as\n alternative to Legendre polynomials.\n\nV6.0.7: MC, Oxford, 13 March 2017\n+++++++++++++++++++++++++++++++++\n\n- Use ``next_fast_len()`` for optimal ``rfft()`` zero padding.\n- Included keyword ``gas_component`` in the ``.plot()`` method, to\n distinguish gas emission lines in best-fitting plots.\n- Improved plot of residuals for noisy spectra.\n- Simplified regularization implementation.\n\nV6.0.6: MC, Oxford, 23 February 2017\n++++++++++++++++++++++++++++++++++++\n\n- Added ``linear_fit()`` and ``nonlinear_fit()`` functions to better\n clarify the code structure. Included ``templates_rfft`` keyword.\n- Updated documentation. Some code simplifications.\n\nV6.0.5: MC, Oxford, 21 February 2017\n++++++++++++++++++++++++++++++++++++\n\n- Consistently use new format_output() function both with/without\n the ``linear`` keyword. Added ``.status`` attribute. Changes suggested by\n Kyle Westfall (Univ. Santa Cruz).\n\nV6.0.4: MC, Oxford, 30 January 2017\n+++++++++++++++++++++++++++++++++++\n\n- Re-introduced ``linear`` keyword to only perform a linear fit and\n skip the non-linear optimization.\n\nV6.0.3: MC, Oxford, 1 December 2016\n+++++++++++++++++++++++++++++++++++\n\n- Return usual ``Chi**2/DOF`` instead of Biweight estimate.\n\nV6.0.2: MC, Oxford, 15 August 2016\n++++++++++++++++++++++++++++++++++\n\n- Improved formatting of printed output.\n\nV6.0.1: MC, Oxford, 10 August 2016\n++++++++++++++++++++++++++++++++++\n\n- Allow ``moments`` to be an arbitrary integer.\n- Allow for scalar ``moments`` with multiple kinematic components.\n\nV6.0.0: MC, Oxford, 28 July 2016\n++++++++++++++++++++++++++++++++\n\n- Compute the Fourier Transform of the LOSVD analytically:\n- Major improvement in velocity accuracy when ``sigma < velscale``.\n- Removed ``oversample`` keyword, which is now unnecessary.\n- Removed limit on velocity shift of templates.\n- Simplified FFT zero padding. Updated documentation.\n\nV5.3.3: MC, Oxford 24 May 2016\n++++++++++++++++++++++++++++++\n\n- Fixed Python 2 compatibility. Thanks to Masato Onodera (NAOJ).\n\nV5.3.2: MC, Oxford, 22 May 2016\n+++++++++++++++++++++++++++++++\n\n- Backward compatibility change: allow ``start`` to be smaller than\n ``moments``. After feedback by Masato Onodera (NAOJ).\n- Updated documentation of ``bounds`` and ``fixed``.\n\nV5.3.1: MC, Oxford, 18 May 2016\n+++++++++++++++++++++++++++++++\n\n- Use wavelength in plot when available. Make ``plot()`` a class function.\n Changes suggested and provided by Johann Cohen-Tanugi (LUPM).\n\nV5.3.0: MC, Oxford, 9 May 2016\n++++++++++++++++++++++++++++++\n\n- Included ``velscale_ratio`` keyword to pass a set of templates with\n higher resolution than the galaxy spectrum.\n- Changed ``oversample`` keyword to require integers not Booleans.\n\nV5.2.0: MC, Baltimore, 26 April 2016\n++++++++++++++++++++++++++++++++++++\n\n- Included ``bounds``, ``fixed`` and ``fraction`` keywords.\n\nV5.1.18: MC, Oxford, 20 April 2016\n++++++++++++++++++++++++++++++++++\n\n- Fixed deprecation warning in Numpy 1.11. Changed order from 1 to 3\n during oversampling. Warn if sigma is under-sampled.\n\nV5.1.17: MC, Oxford, 21 January 2016\n++++++++++++++++++++++++++++++++++++\n\n- Expanded explanation of the relation between output velocity and redshift.\n\nV5.1.16: MC, Oxford, 9 November 2015\n++++++++++++++++++++++++++++++++++++\n\n- Fixed potentially misleading typo in documentation of ``moments``.\n\nV5.1.15: MC, Oxford, 22 October 2015\n++++++++++++++++++++++++++++++++++++\n\n- Updated documentation. Thanks to Peter Weilbacher (Potsdam) for\n corrections.\n\nV5.1.14: MC, Oxford, 19 October 2015\n++++++++++++++++++++++++++++++++++++\n\n- Fixed deprecation warning in Numpy 1.10.\n\nV5.1.13: MC, Oxford, 24 April 2015\n++++++++++++++++++++++++++++++++++\n\n- Updated documentation.\n\nV5.1.12: MC, Oxford, 25 February 2015\n+++++++++++++++++++++++++++++++++++++\n\n- Use ``color=`` instead of ``c=`` to avoid new Matplotlib 1.4 bug.\n\nV5.1.11: MC, Sydney, 5 February 2015\n++++++++++++++++++++++++++++++++++++\n\n- Reverted change introduced in V5.1.2. Thanks to Nora Lu\"tzgendorf\n for reporting problems with ``oversample``.\n\nV5.1.10: MC, Oxford, 14 October 2014\n++++++++++++++++++++++++++++++++++++\n\n- Fixed bug in saving output introduced in previous version.\n\nV5.1.9: MC, Las Vegas Airport, 13 September 2014\n++++++++++++++++++++++++++++++++++++++++++++++++\n\n- Pre-compute FFT and oversampling of templates. This speeds up the\n calculation for very long or highly-oversampled spectra. Thanks to\n Remco van den Bosch for reporting situations where this optimization\n may be useful.\n\nV5.1.8: MC, Utah, 10 September 2014\n+++++++++++++++++++++++++++++++++++\n\n- Fixed program stop with ``reddening`` keyword. Thanks to Masatao\n Onodera for reporting the problem.\n\nV5.1.7: MC, Oxford, 3 September 2014\n++++++++++++++++++++++++++++++++++++\n\n- Relaxed requirement on input maximum velocity shift.\n- Minor reorganization of the code structure.\n\nV5.1.6: MC, Oxford, 6 August 2014\n+++++++++++++++++++++++++++++++++\n\n- Catch an additional input error. Updated documentation for Python.\n Included templates ``matrix`` in output. Modified plotting colours.\n\nV5.1.5: MC, Oxford, 21 June 2014\n++++++++++++++++++++++++++++++++\n\n- Fixed deprecation warning.\n\nV5.1.4: MC, Oxford, 25 May 2014\n+++++++++++++++++++++++++++++++\n\n- Support both Python 2.7 and Python 3.\n\nV5.1.3: MC, Oxford, 7 May 2014\n++++++++++++++++++++++++++++++\n\n- Allow for an input covariance matrix instead of an error spectrum.\n\nV5.1.2: MC, Oxford, 6 May 2014\n++++++++++++++++++++++++++++++\n\n- Replaced REBIN with INTERPOLATE + /OVERSAMPLE keyword. This is\n to account for the fact that the Line Spread Function of the observed\n galaxy spectrum already includes pixel convolution. Thanks to Mike\n Blanton for the suggestion.\n\nV5.1.1: MC, Dallas Airport, 9 February 2014\n+++++++++++++++++++++++++++++++++++++++++++\n\n- Fixed typo in the documentation of ``nnls_flags``.\n\nV5.1.0: MC, Oxford, 9 January 2014\n++++++++++++++++++++++++++++++++++\n\n- Allow for a different LOSVD for each template. Templates can be\n stellar or can be gas emission lines. A PPXF version adapted for\n multiple kinematic components existed for years. It was updated in\n JAN/2012 for the paper by Johnston et al. (2013, MNRAS). This version\n merges those changes with the public PPXF version, making sure that all\n previous PPXF options are still supported.\n\nV5.0.1: MC, Oxford, 12 December 2013\n++++++++++++++++++++++++++++++++++++\n\n- Minor cleaning and corrections.\n\nV5.0.0: MC, Oxford, 6 December 2013\n+++++++++++++++++++++++++++++++++++\n\n- Translated from IDL into Python and tested against the original version.\n\nV4.6.6: MC, Paranal, 8 November 2013\n++++++++++++++++++++++++++++++++++++\n\n- Uses CAP_RANGE to avoid potential naming conflicts.\n\nV4.6.5: MC, Oxford, 15 November 2012\n++++++++++++++++++++++++++++++++++++\n\n- Expanded documentation of REGUL keyword.\n\nV4.6.4: MC, Oxford, 9 December 2011\n+++++++++++++++++++++++++++++++++++\n\n- Increased oversampling factor to 30x, when the /OVERSAMPLE keyword\n is used. Updated corresponding documentation. Thanks to Nora\n Lu\"tzgendorf for test cases illustrating errors in the recovered\n velocity when the sigma is severely undersampled.\n\nV4.6.3: MC, Oxford 25 October 2011\n++++++++++++++++++++++++++++++++++\n\n- Do not change TEMPLATES array in output when REGUL is nonzero.\n From feedback of Richard McDermid.\n\nV4.6.2: MC, Oxford, 17 October 2011\n+++++++++++++++++++++++++++++++++++\n\n- Included option for 3D regularization and updated documentation of\n REGUL keyword.\n\nV4.6.1: MC, Oxford, 29 July 2011\n++++++++++++++++++++++++++++++++\n\n- Use Coyote Graphics (http://www.idlcoyote.com/) by David W. Fanning.\n The required routines are now included in NASA IDL Astronomy Library.\n\nV4.6.0: MC, Oxford, 12 April 2011\n+++++++++++++++++++++++++++++++++\n\n- Important fix to /CLEAN procedure: bad pixels are now properly\n updated during the 3sigma iterations.\n\nV4.5.0: MC, Oxford, 13 April 2010\n+++++++++++++++++++++++++++++++++\n\n- Dramatic speed up in the convolution of long spectra.\n\nV4.4.0: MC, Oxford, 18 September 2009\n+++++++++++++++++++++++++++++++++++++\n\n- Introduced Calzetti et al. (2000) PPXF_REDDENING_CURVE function to\n estimate the reddening from the fit.\n\nV4.3.0: MC, Oxford, 4 Mach 2009\n+++++++++++++++++++++++++++++++\n\n- Introduced REGUL keyword to perform linear regularization of WEIGHTS\n in one or two dimensions.\n\nV4.2.3: MC, Oxford, 27 November 2008\n++++++++++++++++++++++++++++++++++++\n\n- Corrected error message for too big velocity shift.\n\nV4.2.2: MC, Windhoek, 3 July 2008\n+++++++++++++++++++++++++++++++++\n\n- Added keyword POLYWEIGHTS.\n\nV4.2.1: MC, Oxford, 17 May 2008\n+++++++++++++++++++++++++++++++\n\n- Use LA_LEAST_SQUARES (IDL 5.6) instead of SVDC when fitting a single\n template. Please let me know if you need to use PPXF with an older IDL\n version.\n\nV4.2.0: MC, Oxford, 15 March 2008\n+++++++++++++++++++++++++++++++++\n\n- Introduced optional fitting of SKY spectrum. Many thanks to\n Anne-Marie Weijmans for testing.\n\nV4.1.7: MC, Oxford, 6 October 2007\n++++++++++++++++++++++++++++++++++\n\n- Updated documentation with important note on penalty determination.\n\nV4.1.6: MC, Leiden, 20 January 2006\n+++++++++++++++++++++++++++++++++++\n\n- Print number of nonzero templates. Do not print outliers in /QUIET mode.\n\nV4.1.5: MC, Leiden, 10 February 2005\n++++++++++++++++++++++++++++++++++++\n\n- Verify that GOODPIXELS is monotonic and does not contain duplicated\n values. After feedback from Richard McDermid.\n\nV4.1.4: MC, Leiden, 12 January 2005\n+++++++++++++++++++++++++++++++++++\n\n- Make sure input NOISE is a positive vector.\n\nV4.1.3: MC, Vicenza, 30 December 2004\n+++++++++++++++++++++++++++++++++++++\n\n- Updated documentation.\n\nV4.1.2: MC, Leiden, 11 November 2004\n++++++++++++++++++++++++++++++++++++\n\n- Handle special case where a single template without additive\n polynomials is fitted to the galaxy.\n\nV4.1.1: MC, Leiden, 21 September 2004\n+++++++++++++++++++++++++++++++++++++\n\n- Increased maximum number of iterations ITMAX in BVLS. Thanks to\n Jesus Falcon-Barroso for reporting problems.\n- Introduced error message when velocity shift is too big.\n- Corrected output when MOMENTS=0.\n\nV4.1.0: MC, Leiden, 3 September 2004\n++++++++++++++++++++++++++++++++++++\n\n- Corrected implementation of two-sided fitting of the LOSVD. Thanks\n to Stefan van Dongen for reporting problems.\n\nV4.0.0: MC, Vicenza, 16 August 2004\n+++++++++++++++++++++++++++++++++++\n\n- Introduced optional two-sided fitting assuming a reflection\n symmetric LOSVD for two input spectra.\n\nV3.7.3: MC, Leiden, 7 August 2004\n+++++++++++++++++++++++++++++++++\n\n- Corrected bug: keyword ERROR was returned in pixels instead of km/s.\n- Decreased lower limit on fitted dispersion. Thanks to Igor V. Chilingarian.\n\nV3.7.2: MC, Leiden, 28 April 2004\n+++++++++++++++++++++++++++++++++\n\n- Corrected program stop after fit when MOMENTS=2. Bug was introduced in V3.7.0.\n\nV3.7.1: MC, Leiden, 31 March 2004\n+++++++++++++++++++++++++++++++++\n\n- Updated documentation.\n\nV3.7.0: MC, Leiden, 23 March 2004\n+++++++++++++++++++++++++++++++++\n\n- Revised implementation of MDEGREE option. Nonlinear implementation:\n straightforward, robust, but slower.\n\nV3.6.0: MC, Leiden, 19 March 2004\n+++++++++++++++++++++++++++++++++\n\n- Added MDEGREE option for multiplicative polynomials. Linear implementation:\n fast, works well in most cases, but can fail in certain cases.\n\nV3.5.0: MC, Leiden, 11 December 2003\n++++++++++++++++++++++++++++++++++++\n\n- Included /OVERSAMPLE option.\n\nV3.4.7: MC, Leiden, 8 December 2003\n+++++++++++++++++++++++++++++++++++\n\n- First released version.\n\nV1.0.0: Leiden, 10 October 2001\n+++++++++++++++++++++++++++++++\n\n- Created by Michele Cappellari.", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://purl.org/cappellari/software", "keywords": "", "license": "Other/Proprietary License", "maintainer": "", "maintainer_email": "", "name": "ppxf", "package_url": "https://pypi.org/project/ppxf/", "platform": "", "project_url": "https://pypi.org/project/ppxf/", "project_urls": { "Homepage": "http://purl.org/cappellari/software" }, "release_url": "https://pypi.org/project/ppxf/6.7.16/", "requires_dist": null, "requires_python": "", "summary": "pPXF: Full Spectrum Fitting of Galactic and Stellar Spectra", "version": "6.7.16" }, "last_serial": 5390355, "releases": { "6.7.11": [ { "comment_text": "", "digests": { "md5": "c8666b8a309e0fba9745f6f45fc0ff65", "sha256": "ef411718f2cd1800b572d414818b356a0b64a93e96f532c9629cd14ba203b009" }, "downloads": -1, "filename": "ppxf-6.7.11.tar.gz", "has_sig": false, "md5_digest": "c8666b8a309e0fba9745f6f45fc0ff65", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3268127, "upload_time": "2018-06-05T13:55:05", "url": "https://files.pythonhosted.org/packages/e8/ad/09b6cb0d9adbf9989c9cfaab2a344e5d5c019d432e032ab128b62012bae8/ppxf-6.7.11.tar.gz" } ], "6.7.12": [ { "comment_text": "", "digests": { "md5": "b8a6449a16befd961c5aa382b719d51a", "sha256": "c9caab4582764a852d6a5ab452030f01235212cbe29216b25e040236379dd310" }, "downloads": -1, "filename": "ppxf-6.7.12.tar.gz", "has_sig": false, "md5_digest": "b8a6449a16befd961c5aa382b719d51a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3269455, "upload_time": "2018-07-09T10:01:06", "url": "https://files.pythonhosted.org/packages/83/11/4940cb01e78df8feeb1cd1026171fa22dbee24a5db9f1711d6415b3e2551/ppxf-6.7.12.tar.gz" } ], "6.7.13": [ { "comment_text": "", "digests": { "md5": "3980d0e00fceb0742a47ca9569d5a0cf", "sha256": "b4bc8272bf9dafa0fe0db2bb849723eff837fbba12d5597424f77b6790843cdd" }, "downloads": -1, "filename": "ppxf-6.7.13.tar.gz", "has_sig": false, "md5_digest": "3980d0e00fceb0742a47ca9569d5a0cf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3269942, "upload_time": "2018-09-20T15:15:55", "url": "https://files.pythonhosted.org/packages/29/fb/c4ff828af045f1d702b45a672a33a70d515a2f4db9a21f81bed9d0ed8063/ppxf-6.7.13.tar.gz" } ], "6.7.14": [ { "comment_text": "", "digests": { "md5": "af6832d3668467d9b999778121360f45", "sha256": "c7d4f1196388c0788bd8a18e06655fe6347f09c23fd149a354e0cf3053fdbcf7" }, "downloads": -1, "filename": "ppxf-6.7.14.tar.gz", "has_sig": false, "md5_digest": "af6832d3668467d9b999778121360f45", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3271992, "upload_time": "2018-11-27T18:38:21", "url": "https://files.pythonhosted.org/packages/3c/d0/c419334ca1d3f1062202f4a54c13c5285ba717dc086d80ae3446e2bd6f19/ppxf-6.7.14.tar.gz" } ], "6.7.15": [ { "comment_text": "", "digests": { "md5": "c5e408260cfc23f24b130768868b2f34", "sha256": "49942ace6c6d2d0903b11ebcbc9f7c3a4c529328dee1f7a0473e6eee18ab42e3" }, "downloads": -1, "filename": "ppxf-6.7.15.tar.gz", "has_sig": false, "md5_digest": "c5e408260cfc23f24b130768868b2f34", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3269778, "upload_time": "2019-02-07T16:51:53", "url": "https://files.pythonhosted.org/packages/78/c4/e6b1fa4ed5a3e1a799c096a9dde010263befe17a89ce3a76971c7754ad75/ppxf-6.7.15.tar.gz" } ], "6.7.16": [ { "comment_text": "", "digests": { "md5": "a6e21097f1517f760e8fa20022cce739", "sha256": "1b50c1aae4c4932558ba8fd23bc8facddeebd4594bced5d2348d2e9a8052bfcf" }, "downloads": -1, "filename": "ppxf-6.7.16.tar.gz", "has_sig": false, "md5_digest": "a6e21097f1517f760e8fa20022cce739", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3270119, "upload_time": "2019-06-12T09:59:17", "url": "https://files.pythonhosted.org/packages/44/52/bbc40f1ecfca314822ea4c10dd0bd92743e9d980a7b3e729a0f2565f1bf0/ppxf-6.7.16.tar.gz" } ], "6.7.8": [ { "comment_text": "", "digests": { "md5": "6eae34bfcf8dccb2234f764cf7e83ea9", "sha256": "6d2314f2ba90750b33c6236006ad1c8a0167e0c072b58b33badd354cd53bfb80" }, "downloads": -1, "filename": "ppxf-6.7.8.tar.gz", "has_sig": false, "md5_digest": "6eae34bfcf8dccb2234f764cf7e83ea9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3231032, "upload_time": "2018-05-21T10:29:00", "url": "https://files.pythonhosted.org/packages/26/69/96e269d9d7ec78a63bcf08fc94f22eab530e06282a10d88c7266f2613953/ppxf-6.7.8.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a6e21097f1517f760e8fa20022cce739", "sha256": "1b50c1aae4c4932558ba8fd23bc8facddeebd4594bced5d2348d2e9a8052bfcf" }, "downloads": -1, "filename": "ppxf-6.7.16.tar.gz", "has_sig": false, "md5_digest": "a6e21097f1517f760e8fa20022cce739", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3270119, "upload_time": "2019-06-12T09:59:17", "url": "https://files.pythonhosted.org/packages/44/52/bbc40f1ecfca314822ea4c10dd0bd92743e9d980a7b3e729a0f2565f1bf0/ppxf-6.7.16.tar.gz" } ] }