Package: pafit
The PaFit PackageKinematic Position Angle Fitting for GalaxiesThe PaFit package is a Python-based tool to determine the global kinematic
position angle of galaxies. This is done by analyzing the observed integral-field
stellar or gas kinematics of the galaxies, using the algorithm described in
Appendix C ofKrajnovic et al. (2006).ContentsThe PaFit PackageAttributionInstallationDocumentationfit_kinematic_paPurposeCalling SequenceInput ParametersOptional KeywordsOutput ParametersLicenseChangelogAttributionIf you use this software for your research, please citeKrajnovic et al. (2006).
The BibTeX entry for the paper is:@Article{Krajnovic2006,
    title = {Kinemetry: a generalization of photometry to the higher moments
        of the line-of-sight velocity distribution},
    author = {{Krajnovi{\'c}}, D. and {Cappellari}, M. and {de Zeeuw}, P.~T.
        and {Copin}, Y.},
    journal = {MNRAS},
    eprint = {arXiv:astro-ph/0512200}
    year = {2006},
    pages = {787-802},
    volume = {366},
    doi = {10.1111/j.1365-2966.2005.09902.x}
}Installationinstall with:pip install pafitWithout writing access to the globalsite-packagesdirectory, use:pip install --user pafitTo upgrade PaFit to the latest version use:pip install --upgrade pafitDocumentationSee thepafit/fit_kinematic_pa.pyfile docstring orPyPi.fit_kinematic_paPurposeDetermine the global kinematic position angle of a galaxy from
integral-field kinematics of the stars or gas with the method described in
Appendix C ofKrajnovic et al. (2006)Calling SequenceangBest,angErr,vSyst=fit_kinematic_pa(x,y,vel,debug=False,nsteps=361,quiet=False,plot=True,dvel=10)Input Parametersxbin, ybin:Vectors with the coordinates of the bins (or pixels) measured from
the centre of rotation (typically the galaxy centre).IMPORTANT: The routine will not give meaningful output unless(x, y) = (0, 0)is an estimate of the centre of rotation.vel:Measured velocity at the position(xbin, ybin).IMPORTANT: An estimate of the systemic velocity has to be already
subtracted from this velocity [e.g.vel_corr = vel - np.median(vel)].
The routine will then provide in the outputvelsysta correction
to be added to the adopted systemic velocity.dvel:Scalar with the typical uncertainty in the velocityvelor vector
with the uncertainty of each bin(xbin, ybin).Optional Keywordsnsteps:Number of steps along which the angle is sampled.
Default is 361 steps which gives a 0.5 degr accuracy.
Decrease this number to limit computation time during testing.Output Parametersanglebest:Kinematical PA. Note that this is the angle along which|vel|is maximum (note modulus!). If one reverses the sense of
rotation in a galaxyanglebestdoes not change. The sense of
rotation can be trivially determined by looking at the map of Vel.angleerror:Corresponding error to assign toanglebest.velsyst:Best-fitting correction to the adopted systemic velocity for the galaxy.If the median was subtracted to the input velocityvelbefore
thepafit, then the corrected systemic velocity will beLicenseOther/Proprietary LicenseCopyright (c) 2005-2023 Michele CappellariThis software is provided as is without any warranty whatsoever.
Permission to use, for non-commercial purposes is granted.
Permission to modify for personal or internal use is granted,
provided this copyright and disclaimer are included in all
copies of the software. All other rights are reserved.
In particular, redistribution of the code is not allowed.ChangelogV2.0.8: MC, Oxford, 3 April 2023Includedkwargskeyword passed toplot_velfield.Subtractnp.median(vel)in the example.Formatted documentation as docstring.Published documentation on PyPi.V2.0.7: MC, Oxford, 23 March 2021Some documentation updates.V2.0.6: MC, Oxford 12 May 2018Dropped Python 2.7 support.V2.0.5: MC, Oxford, 17 April 2018Changed imports for plotbin as package.V2.0.4: MC, Oxford, 17 March 2017Use Numpynp.percentileinstead of deprecated Scipy version.V2.0.3: MC, Oxford, 7 September 2015Changed color of plotted lines.Check matching of input sizes.V2.0.2: MC, Sydney, 2 February 2015Fixed possible program stop.V2.0.1: MC, Oxford, 25 May 2014Support both legacy Python 2.7 and Python 3.V2.0.0: MC, Oxford, 10 April 2014Translated from IDL into Python.V1.3.1: MC, Oxford, 2 December 2013Uses CAP_RANGE routine to avoid potential naming conflicts.Uses TOLERANCE keyword of TRIANGULATE to try to avoid IDL error
“TRIANGULATE: Points are co-linear, no solution.”V1.3.0: MC, Oxford, 8 October 2013The program is two orders of magnitude faster, thanks to a
newcap_symmetrize_velfieldroutine.V1.2.0: MC, Oxford, 23 March 2010Includes error in chi^2 in the determination of angErr.
Thanks to Davor Krajnovic for reporting problems.V1.1.5: MC, Oxford, 14 October 2009Overplot best PA on data. Some changes to the documentation.V1.1.4: MC, Oxford, 31 March 2009Clarified that systemic velocity has to be subtracted from VEL.V1.1.3: MC, Leiden, 25 May 2008Determine plotting ranges from velSym instead of vel.
Thanks to Anne-Marie Weijmans.V1.1.2: MC, Oxford, 19 October 2007Force error to be larger than 1/2 of the angular step size.V1.1.1: MC, Oxford, 17 October 2007Corrected handling of NSTEPS keyword. Thanks to Roland Jesseit.V1.1.0: MC, Oxford, 9 October 2007Written documentation.V1.0.0: Michele Cappellari, Leiden, 30 May 2005Written and tested