jampy 7.2.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
jampy/CHANGELOG.rst ADDED
@@ -0,0 +1,427 @@
1
+
2
+ Changelog
3
+ ---------
4
+
5
+ V7.2.5: MC, Oxford 20 May 2024
6
+ ++++++++++++++++++++++++++++++
7
+
8
+ - ``quad1d`` and ``quad2d``: Require positive values for either ``epsrel`` or
9
+ ``epsabs`` keywords. Thanks to Carlos Melo (cufrgs.br) for the feedback.
10
+ - ``jam_axi_proj``: Dropped support for Python 3.9.
11
+
12
+ V7.2.4: MC, Oxford, 10 January 2024
13
+ +++++++++++++++++++++++++++++++++++
14
+
15
+ - ``jam_axi_proj``: Support prolate models with ``qobs_lum > 1`` or
16
+ ``qobs_pot > 1``.
17
+ - ``jam_axi_proj``: Output unconvolved surface brightness ``jam.flux`` when no
18
+ PSF/aperture convolution is applied to the kinematics, due to zero
19
+ ``sigmapsf`` or ``pixsize``.
20
+ - ``mge_vcirc``: Use scale-independent integration ranges like other JamPy
21
+ functions.
22
+ - ``jam_axi_sersic``: Include ``sigma_e`` in the output and enable rotated
23
+ aperture option. Updated docstring.
24
+
25
+ V7.2.1: MC, Oxford, 21 July 2023
26
+ ++++++++++++++++++++++++++++++++
27
+
28
+ - ``jam_axi_intr``: Integrate all velocity components at the same time with a
29
+ single call to the updated ``quad1d`` and ``quad2d``. Significant speedup.
30
+ - ``quad1d``, ``quad2d``: Allow for integration of vector functions. All
31
+ components are integrated over the same set of evaluation points.
32
+ - ``jam_axi_proj``: Updated verbose output with more information.
33
+ - New procedure ``jam_axi_sersic`` to efficiently compute dynamical masses of
34
+ axisymmetric galaxies described by Sersic profiles while allowing for seeing
35
+ and aperture effects and assuming a given intrinsic axial ratio. This is
36
+ meant to be a simple and quick replacement for the similar but less accurate
37
+ virial estimators.
38
+ - New utility function ``cosmology_distance`` used in examples.
39
+
40
+ V7.1.0: MC, Oxford, 5 June 2023
41
+ +++++++++++++++++++++++++++++++
42
+
43
+ - Separated computation for the black hole kinematics for both the
44
+ cylindrically and spherically-aligned solutions. In both cases, this removed
45
+ one numerical quadrature. This is useful in extreme situations when the
46
+ minimum radius one wants to model around the black hole is orders of
47
+ magnitude smaller than the smallest MGE Gaussian. This change eliminated the
48
+ need for the ``rbh`` keyword in ``jam_axi_intr``, which I removed. The only
49
+ case where the black hole is still approximated with a small Gaussian is in
50
+ ``jam_axi_proj`` when both ``align='cyl'`` and ``analytic_los=True``.
51
+ - Adopted minimum radius based on ``step`` for the intrinsic interpolation grid
52
+ as already done for the projected one.
53
+ - Simplified minimum-inclination test.
54
+ - Removed ``legacy`` folder with old redundant procedures.
55
+ - Moved the formalism for the LOS analytic integrand with ``align='cyl'`` into
56
+ ``jam_axi_proj``.
57
+ - ``jam_axi_proj``, ``jam_axi_intr``, ``jam_sph_proj``, ``jam_sph_intr``: New
58
+ keyword ``logistic`` to specify when JAM should interpret the input
59
+ anisotropy parameters ``beta`` and ``gamma`` as defining a logistic function
60
+ anisotropy profile.
61
+ - ``jam_axi_intr``: Use DE quadrature from ``[z, inf]`` instead of ``[0, 1]``
62
+ with ``align='cyl'`` as already done with ``align='sph'``.
63
+ - ``jam_hernquist_model_example``: New test against Osipkov-Merritt radial
64
+ variation of the anisotropy using ``logistic=True``. Revised plot.
65
+
66
+ V7.0.10: MC, Oxford, 17 January 2023
67
+ ++++++++++++++++++++++++++++++++++++
68
+
69
+ - Introduced an analytic radial variation of the anisotropy ``beta``
70
+ and ``gamma`` using a flexible logistic function of logarithmic radius
71
+ ``beta(r) = beta_0 + (beta_inf - beta_0)/[1 + (r_a/r)^alpha]``.
72
+ This function specifies the inner/outer anisotropy ``beta_0`` and
73
+ ``beta_inf``, the anisotropy radius ``r_a`` and the sharpness ``alpha``
74
+ of the transition. This new function is an alternative to assigning
75
+ different anisotropies to different Gaussians. All procedures
76
+ ``jam_axi_proj``, ``jam_axi_intr``, ``jam_sph_proj`` and ``jam_sph_intr``,
77
+ with both ``align='sph'`` and ``align='cyl'``, were modified, documented
78
+ and extensively tested to support the variable-anisotropy function.
79
+ - ``jam_sph_proj_example``: adapted to show the usage of the new analytic
80
+ radial anisotropy variation.
81
+ - ``jam_axi_intr``: Fixed program stop in the plotting function.
82
+ - ``jam_axi_proj``: Raise an error when ``rbh`` is too small.
83
+ - ``jam_axi_proj``: Raise an error if the user includes the singularity
84
+ ``(x,y) = (0,0)`` in the input coordinates without PSF convolution.
85
+ - ``quad1d``: new defaults ``singular=0`` and ``epsabs=0`` like ``quad2d``.
86
+
87
+ V6.4.0: MC, Oxford, 3 October 2022
88
+ ++++++++++++++++++++++++++++++++++
89
+
90
+ - ``jam_sph_proj``: Created this new function by renaming the procedure
91
+ ``legacy.jam_sph_rms`` and changing its interface to be consistent with
92
+ the axisymmetric version.
93
+ - ``jam_sph_proj``: Included special isotropic formula for testing.
94
+ - ``jam_sph_proj``: Included Osipkov-Merritt anisotropy for testing.
95
+ - ``jam_sph_proj``: Made quadrature limits insensitive to scaling.
96
+ - ``jam_sph_proj``: Simplified integrand with formulas of Cappellari (2020)
97
+ and using recurrence relations to reduce calls to special functions.
98
+ - ``jam_sph_proj``: More efficient TANH transformation of the integration
99
+ variable following Cappellari (2020).
100
+ - ``jam_sph_intr``: New function to compute the intrinsic moments in
101
+ spherical symmetry.
102
+ - ``jam_axi_proj``: Removed fixed minimum radius limit in pc for the
103
+ interpolation without PSF convolution. This avoids the risk of artificial
104
+ truncation when using small arbitrary spatial coordinates for testing.
105
+ - ``jam_axi_proj``: Tenfold increase of LOS evaluations to ``nlos=1500``.
106
+ - New procedure ``examples.jam_dark_halo_bayes_example.py``.
107
+ - Renamed ``quadva`` as ``quad1d`` with modified interface and new
108
+ ``singular`` keyword to skip transforming the integration variable.
109
+
110
+ V6.3.3: MC, Oxford, 7 July 2021
111
+ +++++++++++++++++++++++++++++++
112
+
113
+ - ``jam_axi_proj``: Clarified meaning of ``interp`` keyword in docstring.
114
+ Thanks to Kai Zhu (nao.cas.cn) for the feedback.
115
+ - ``jam_axi_proj``: print "No PSF/pixel convolution" when ``interp == False``.
116
+
117
+ V6.3.2: MC, Oxford, 28 April 2021
118
+ +++++++++++++++++++++++++++++++++
119
+
120
+ - Use the new ``jam_axi_proj`` instead of ``legacy`` software in the examples.
121
+ - Removed redundant ``legacy`` examples.
122
+
123
+ V6.3.1: MC, Oxford, 11 November 2020
124
+ ++++++++++++++++++++++++++++++++++++
125
+
126
+ - ``jam_axi_proj``: New keyword ``analytic_los`` to chose between numeric
127
+ or analytic line-of-sight integral for the second velocity moment,
128
+ when ``align='cyl'``.
129
+ - ``jam_axi_proj``: Increased default value of ``nlos`` keyword.
130
+ - ``jam_axi_proj``: Raise an error if ``rbh`` is too small.
131
+ - ``jam_axi_proj`` and ``jam_axi_intr``: Removed ``**kwargs`` argument and
132
+ included new ``nodots`` keyword passed to ``plot_velfield``.
133
+
134
+ V6.2.1: MC, Oxford, 15 September 2020
135
+ +++++++++++++++++++++++++++++++++++++
136
+
137
+ - ``jam_axi_proj``: Fixed program stop when ``data == ml == None``.
138
+ Thank to Bitao Wang (pku.edu.cn) for reporting.
139
+
140
+ V6.2.0: MC, Oxford, 17 August 2020
141
+ ++++++++++++++++++++++++++++++++++
142
+
143
+ - ``jam_axi_proj``: Avoid possible division by zero after convolution,
144
+ when the tracer MGE is much smaller than the field of view.
145
+ - ``jam_axi_proj``: Fully broadcasted ``vmom_proj``.
146
+ - ``jam_axi_proj``: Removed minimum-radius clipping in ``vmom_proj``.
147
+ - ``jam_axi_proj``: New ``interp`` keyword to force no-interpolation
148
+ when using the full first and second velocity moments simultaneously.
149
+ - Made ``jam.plot()`` callable after ``jam_axi_proj`` or ``jam_axi_intr``.
150
+ - New axisymmetric analytic vs MGE test in ``mge_vcirc_example``.
151
+ - ``mge_vcirc``: Upgraded formalism.
152
+ - Fixed Numpy 1.9 ``VisibleDeprecationWarning``.
153
+ - Updated documentation.
154
+
155
+ V6.1.5: MC, Oxford, 23 July 2020
156
+ ++++++++++++++++++++++++++++++++
157
+
158
+ - Fixed program stop in first velocity moment without input data,
159
+ introduced in V6.1.2. Thanks to Bitao Wang (pku.edu.cn) for reporting.
160
+ - Implemented the ``kappa`` input keyword as scalar.
161
+
162
+ V6.1.4: MC, Oxford, 16 July 2020
163
+ ++++++++++++++++++++++++++++++++
164
+
165
+ - Added ``kappa`` to the returned parameters of ``jam_axi_proj``.
166
+ - Compute both velocity and Vrms in ``jam_axi_proj_example``.
167
+
168
+ V6.1.3: MC, Oxford, 13 July 2020
169
+ ++++++++++++++++++++++++++++++++
170
+
171
+ - Fixed program stop in ``legacy.jam_axi_vel`` due to a variable name typo
172
+ introduced in V6.1.2.
173
+
174
+ V6.1.2: MC, Oxford, 20 June 2020
175
+ ++++++++++++++++++++++++++++++++
176
+
177
+ - ``jam_axi_proj``: Fixed input ``ml`` being ignored. Thanks to Sabine
178
+ Thater (univie.ac.at) and Takafumi Tsukui (grad.nao.ac.jp) for reporting.
179
+ - ``jam_axi_rms``: I reduced the interpolation error before the PSF
180
+ convolution for all the routines in the ``legacy`` sub-folder, as already
181
+ implemented in the new ``jam_axi_proj``. Thanks to Takafumi Tsukui
182
+ (grad.nao.ac.jp) for reporting differences.
183
+ - ``jam_axi_intr``: Request input ``data = [sigR, sigz, sigphi, vrms_phi]``
184
+ instead of ``data = [sigR, sigz, sigphi, vphi]``.
185
+ - ``jam_axi_intr``: exclude ``sigphi`` from ``ml`` fitting. These two
186
+ changes make the fitted ``ml`` strictly independent of the adopted
187
+ tangential anisotropy ``gamma``.
188
+
189
+ V6.0.1: MC, Oxford, 23 April 2020
190
+ +++++++++++++++++++++++++++++++++
191
+
192
+ - Fixed ``model`` output when fitting ``ml``.
193
+ Thanks to Selina Nitschai (mpia-hd.mpg.de) for reporting.
194
+
195
+ V6.0.0: MC, Oxford, 22 April 2020
196
+ +++++++++++++++++++++++++++++++++
197
+
198
+ - Major changes to the whole ``jampy`` package: from this version
199
+ I include the new spherically-aligned solution of the Jeans
200
+ equations from Cappellari (2020, MNRAS).
201
+ - Two new functions ``jam_axi_intr`` and ``jam_axi_proj``
202
+ now provide either the intrinsic or the projected moments,
203
+ respectively, for both the spherically-aligned and
204
+ cylindrically-aligned JAM solutions.
205
+ - I moved the previous procedures ``jam_axi_rms``, ``jam_axi_vel``
206
+ and ``jam_sph_rms`` to the ``jampy.legacy`` folder.
207
+
208
+ V5.0.23: MC, Oxford, 31 October 2019
209
+ ++++++++++++++++++++++++++++++++++++
210
+
211
+ - Use analytic ``mge_surf`` in convolution.
212
+
213
+ V5.0.22: MC, Oxford, 21 March 2019
214
+ ++++++++++++++++++++++++++++++++++
215
+
216
+ - Reformatted documentation of all procedures.
217
+
218
+ V5.0.21: MC, Oxford, 14 February 2019
219
+ +++++++++++++++++++++++++++++++++++++
220
+
221
+ - Significant speedup of ``mge_vcirc``.
222
+ - Formatted documentation.
223
+ - Created package-wide CHANGELOG: before this version, the
224
+ CHANGELOG file only refers to the procedure ``jam_axi_rms``.
225
+
226
+ V5.0.16: MC, Oxford, 27 September 2018
227
+ ++++++++++++++++++++++++++++++++++++++
228
+
229
+ - Fixed clock ``DeprecationWarning`` in Python 3.7.
230
+
231
+ V5.0.15: MC, Oxford, 12 May 2018
232
+ ++++++++++++++++++++++++++++++++
233
+
234
+ - Dropped Python 2.7 support.
235
+
236
+ V5.0.14: MC, Oxford, 17 April 2018
237
+ ++++++++++++++++++++++++++++++++++
238
+
239
+ - Fixed ``MatplotlibDeprecationWarning`` in Matplotlib 2.2.
240
+ - Changed imports for jam as a package.
241
+ - Removed example.
242
+
243
+ V5.0.13: MC, Oxford, 7 March 2018
244
+ +++++++++++++++++++++++++++++++++
245
+
246
+ - Check that PSF is normalized.
247
+
248
+ V5.0.12: MC, Oxford, 22 January 2018
249
+ ++++++++++++++++++++++++++++++++++++
250
+
251
+ - Print a message when no PSF convolution was performed.
252
+ - Broadcast kernel and MGE convolution loops.
253
+ - Fixed missing tensor in assertion test.
254
+
255
+ V5.0.11: MC, Oxford, 10 September 2017
256
+ ++++++++++++++++++++++++++++++++++++++
257
+
258
+ - Make default ``step`` depend on ``sigmapsf`` regardless of ``pixsize``.
259
+
260
+ V5.0.10: MC, Oxford, 10 August 2017
261
+ +++++++++++++++++++++++++++++++++++
262
+
263
+ - Raise an error if ``goodbins`` is all False.
264
+
265
+ V5.0.9: MC, Oxford, 17 March 2017
266
+ +++++++++++++++++++++++++++++++++
267
+
268
+ - Included ``flux_obs`` keyword. Updated documentation.
269
+ - Fixed ``DeprecationWarning`` in Numpy 1.12.
270
+
271
+ V5.0.8: MC, Oxford, 17 February 2017
272
+ ++++++++++++++++++++++++++++++++++++
273
+
274
+ - Use odd kernel size for convolution.
275
+ - Fixed corner case with coordinates falling outside the
276
+ interpolation region, due to finite machine precision.
277
+
278
+ V5.0.7: MC, Oxford, 23 February 2016
279
+ ++++++++++++++++++++++++++++++++++++
280
+
281
+ - Scale rmsModel by the input M/L also when rms is not given.
282
+ Thanks to Alex Grainger (Oxford) for pointing out the inconsistency.
283
+ - Pass ``**kwargs`` for plotting.
284
+
285
+ V5.0.6: MC, Oxford, 18 September 2015
286
+ +++++++++++++++++++++++++++++++++++++
287
+
288
+ - Plot bad bins on the data.
289
+
290
+ V5.0.5: MC, Oxford, 23 May 2015
291
+ +++++++++++++++++++++++++++++++
292
+
293
+ - Changed the meaning of ``goodbins`` to be a boolean vector.
294
+
295
+ V5.0.4: MC, Sydney, 5 February 2015
296
+ +++++++++++++++++++++++++++++++++++
297
+
298
+ - Introduced further checks on matching input sizes.
299
+
300
+ V5.0.3: MC, Oxford, 31 October 2014
301
+ +++++++++++++++++++++++++++++++++++
302
+
303
+ - Modified final plot layout.
304
+
305
+ V5.0.2: MC, Oxford, 25 May 2014
306
+ +++++++++++++++++++++++++++++++
307
+
308
+ - Support both Python 2.7 and Python 3.
309
+
310
+ V5.0.1: MC, Oxford, 24 February 2014
311
+ ++++++++++++++++++++++++++++++++++++
312
+
313
+ - Plot bi-symmetrized ``V_rms`` as in IDL version.
314
+
315
+ V5.0.0: MC, Paranal, 11 November 2013
316
+ +++++++++++++++++++++++++++++++++++++
317
+
318
+ - Translated from IDL into Python.
319
+
320
+ V4.1.5: MC, Paranal, 8 November 2013
321
+ ++++++++++++++++++++++++++++++++++++
322
+
323
+ - Use renamed CAP* routines to avoid potential naming conflicts.
324
+
325
+ V4.1.4: MC, Oxford, 12 February 2013
326
+ ++++++++++++++++++++++++++++++++++++
327
+
328
+ - Include _EXTRA and RANGE keywords for plotting.
329
+
330
+ V4.1.3: MC, Oxford, 1 February 2013
331
+ +++++++++++++++++++++++++++++++++++
332
+
333
+ - Output FLUX in ``Lsun/pc^2``.
334
+
335
+ V4.1.2: MC, Oxford, 28 May 2012
336
+ +++++++++++++++++++++++++++++++
337
+
338
+ - Updated documentation.
339
+
340
+ V4.1.1: MC, Oxford, 8 December 2011
341
+ +++++++++++++++++++++++++++++++++++
342
+
343
+ - Only calculates FLUX if required.
344
+
345
+ V4.1.0: MC, Oxford 19 October 2010
346
+ ++++++++++++++++++++++++++++++++++
347
+
348
+ - Included TENSOR keyword to calculate any of the six components of
349
+ the symmetric proper motion dispersion tensor (as in note 5 of the paper).
350
+
351
+ V4.0.9: MC, Oxford, 15 September 2010
352
+ +++++++++++++++++++++++++++++++++++++
353
+
354
+ - Plot and output with the FLUX keyword the PSF-convolved MGE surface brightness.
355
+
356
+ V4.0.8: MC, Oxford, 09 August 2010
357
+ ++++++++++++++++++++++++++++++++++
358
+
359
+ - Use linear instead of smooth interpolation. After feedback from Eric Emsellem.
360
+
361
+ V4.0.7: MC, Oxford, 01 March 2010
362
+ +++++++++++++++++++++++++++++++++
363
+
364
+ - Forces ``q_lum && q_pot < 1``.
365
+
366
+ V4.0.6: MC, Oxford, 08 February 2010
367
+ ++++++++++++++++++++++++++++++++++++
368
+
369
+ - The routine TEST_JAM_AXISYMMETRIC_RMS with the usage example now adopts
370
+ more realistic input kinematics.
371
+ - Updated documentation.
372
+
373
+ V4.0.5: MC, Oxford, 6 July 2009
374
+ +++++++++++++++++++++++++++++++
375
+
376
+ - Skip unnecessary interpolation when computing a few points without PSF
377
+ convolution. After feedback from Eric Emsellem.
378
+
379
+ V4.0.4: MC, Oxford, 29 May 2009
380
+ +++++++++++++++++++++++++++++++
381
+
382
+ - Compute FLUX even when not plotting.
383
+
384
+ V4.0.3: MC, Oxford 4 April 2009
385
+ +++++++++++++++++++++++++++++++
386
+
387
+ - Added keyword RBH.
388
+
389
+ V4.0.2: MC, Oxford, 21 November 2008
390
+ ++++++++++++++++++++++++++++++++++++
391
+
392
+ - Added keywords NRAD and NANG. Thanks to Michael Williams for
393
+ reporting possible problems with too coarse interpolation.
394
+
395
+ V4.0.1: MC, Windhoek, 29 September 2008
396
+ +++++++++++++++++++++++++++++++++++++++
397
+
398
+ - Bug fix: when ERMS was not given, the default was not properly set.
399
+ Included keyword STEP. The keyword FLUX is now only used for output:
400
+ the surface brightness for plotting is computed from the MGE model.
401
+
402
+ V4.0.0: MC, Oxford, 11 September 2008
403
+ +++++++++++++++++++++++++++++++++++++
404
+
405
+ - Implemented PSF convolution using interpolation on a polar grid.
406
+ Dramatic speed-up of calculation. Further documentation.
407
+
408
+ V3.2.0: MC, Oxford, 14 August 2008
409
+ ++++++++++++++++++++++++++++++++++
410
+
411
+ - Updated documentation.
412
+
413
+ V3.1.3: MC, Oxford, 12 August 2008
414
+ ++++++++++++++++++++++++++++++++++
415
+
416
+ - First released version.
417
+
418
+ V2.0.0: MC, Oxford, 20 September 2007
419
+ +++++++++++++++++++++++++++++++++++++
420
+
421
+ - Introduced a new solution of the MGE Jeans equations with constant
422
+ anisotropy ``sig_R = b*sig_z``.
423
+
424
+ V1.0.0: Michele Cappellari, Vicenza, 19 November 2003
425
+ +++++++++++++++++++++++++++++++++++++++++++++++++++++
426
+
427
+ - Written and tested
jampy/LICENSE.txt ADDED
@@ -0,0 +1,10 @@
1
+ Other/Proprietary License
2
+
3
+ Copyright (c) 2003-2024 Michele Cappellari
4
+
5
+ This software is provided as is with no warranty. You may use it for
6
+ non-commercial purposes and modify it for personal or internal use, as long
7
+ as you include this copyright and disclaimer in all copies. You may not
8
+ redistribute the code.
9
+
10
+ ###########################################################################
jampy/README.rst ADDED
@@ -0,0 +1,97 @@
1
+ The JamPy Package
2
+ =================
3
+
4
+ **Jeans Anisotropic Modelling for Galactic Dynamics**
5
+
6
+ .. image:: http://www-astro.physics.ox.ac.uk/~cappellari/software/jam_logo.svg
7
+ :target: https://www-astro.physics.ox.ac.uk/~cappellari/software/#jam
8
+ :width: 100
9
+ .. image:: https://img.shields.io/pypi/v/jampy.svg
10
+ :target: https://pypi.org/project/jampy/
11
+ .. image:: https://img.shields.io/badge/arXiv-0806.0042-orange.svg
12
+ :target: https://arxiv.org/abs/0806.0042
13
+ .. image:: https://img.shields.io/badge/DOI-10.1111/...-green.svg
14
+ :target: https://doi.org/10.1111/j.1365-2966.2008.13754.x
15
+
16
+ ``JamPy`` is a Python implementation of the Jeans Anisotropic Modelling (JAM)
17
+ formalism for the dynamical modelling of galaxies.
18
+
19
+ This software can be used e.g. to measure the mass of supermassive black holes
20
+ in galaxies, to infer their dark-matter content or to measure galaxy masses and
21
+ density profiles.
22
+
23
+ The method calculates all the first and second velocity moments, for both the
24
+ intrinsic and the projected kinematics, in spherical and axisymmetric geometry.
25
+
26
+ The JAM solution assuming a cylindrically-oriented velocity ellipsoid was introduced in
27
+ `Cappellari (2008) <https://ui.adsabs.harvard.edu/abs/2008MNRAS.390...71C>`_,
28
+ while the solution assuming a spherically-oriented velocity ellipsoid was introduced in
29
+ `Cappellari (2020) <https://ui.adsabs.harvard.edu/abs/2020MNRAS.494.4819C>`_
30
+
31
+ .. contents:: :depth: 2
32
+
33
+ Attribution
34
+ -----------
35
+
36
+ If you use this software for your research, please cite `Cappellari (2008)`_
37
+ for the cylindrically-aligned JAM solution and `Cappellari (2020)`_
38
+ for the spherically-aligned JAM solution.
39
+
40
+ The BibTeX entry for the two main JAM papers are respectively::
41
+
42
+ @ARTICLE{Cappellari2008,
43
+ author = {{Cappellari}, Michele},
44
+ title = "{Measuring the inclination and mass-to-light ratio of axisymmetric
45
+ galaxies via anisotropic Jeans models of stellar kinematics}",
46
+ journal = {MNRAS},
47
+ eprint = {0806.0042},
48
+ year = 2008,
49
+ volume = 390,
50
+ pages = {71-86},
51
+ doi = {10.1111/j.1365-2966.2008.13754.x}
52
+ }
53
+
54
+ @ARTICLE{Cappellari2020,
55
+ author = {{Cappellari}, Michele},
56
+ title = "{Efficient solution of the anisotropic spherically-aligned axisymmetric
57
+ Jeans equations of stellar hydrodynamics for galactic dynamics}",
58
+ journal = {MNRAS},
59
+ eprint = {1907.09894},
60
+ year = 2020,
61
+ volume = 494,
62
+ pages = {4819-4837},
63
+ doi = {10.1093/mnras/staa959}
64
+ }
65
+
66
+ Installation
67
+ ------------
68
+
69
+ install with::
70
+
71
+ pip install jampy
72
+
73
+ Without writing access to the global ``site-packages`` directory, use::
74
+
75
+ pip install --user jampy
76
+
77
+ To upgrade ``JamPy`` to the latest version use::
78
+
79
+ pip install --upgrade jampy
80
+
81
+ Documentation
82
+ -------------
83
+
84
+ Full documentation is contained in the individual files docstrings.
85
+
86
+ Usage examples are contained in the directory ``jampy/examples``
87
+ which is copied by ``pip`` within the global folder
88
+ `site-packages <https://stackoverflow.com/a/46071447>`_.
89
+
90
+ What follows is the documentation of the two main procedures of the ``JamPy``
91
+ package, extracted from their Python docstrings. The other procedures are
92
+ documented in their respective docstrings.
93
+
94
+ The older ``JamPy`` routines from version < v6.0 are generally redundant,
95
+ but can be imported from ``jampy.legacy`` and used like before.
96
+
97
+ ###########################################################################
jampy/__init__.py ADDED
@@ -0,0 +1 @@
1
+ __version__ = "7.2.5"
@@ -0,0 +1,106 @@
1
+ """
2
+ Copyright (C) 2016-2023, Michele Cappellari
3
+
4
+ E-mail: michele.cappellari_at_physics.ox.ac.uk
5
+
6
+ Updated versions of the software are available from my web page
7
+ https://purl.org/cappellari/software
8
+
9
+ This software is provided as is without any warranty whatsoever.
10
+ Permission to use, for non-commercial purposes is granted.
11
+ Permission to modify for personal or internal use is granted,
12
+ provided this copyright and disclaimer are included unchanged
13
+ at the beginning of the file. All other rights are reserved.
14
+ In particular, redistribution of the code is not allowed.
15
+
16
+ Changelog
17
+ ---------
18
+
19
+ V1.0.0: Michele Cappellari, Oxford, 6 June 2016
20
+ +++++++++++++++++++++++++++++++++++++++++++++++
21
+
22
+ - Written and tested as a separate procedure.
23
+
24
+ V1.1.0: MC, Oxford, 17 August 2022
25
+ ++++++++++++++++++++++++++++++++++
26
+
27
+ - Included angular_diameter_distance and luminosity_distance.
28
+
29
+ Vx.x.x: MC, Oxford
30
+ ++++++++++++++++++
31
+
32
+ - Additional changes are documented in the CHANGELOG of the JamPy package.
33
+
34
+ """
35
+ import numpy as np
36
+
37
+ from jampy.quad1d import quad1d
38
+
39
+ ###############################################################################
40
+
41
+ def integrand(z, omega_m, omega_k, omega_lam):
42
+ """Equation (14) of Hogg-99 http://arxiv.org/abs/astro-ph/9905116v4"""
43
+
44
+ ez = np.sqrt(omega_m*(1 + z)**3 + omega_k*(1 + z)**2 + omega_lam)
45
+
46
+ return 1/ez
47
+
48
+ ###############################################################################
49
+
50
+ def comoving_distance(z, h0=70, omega_m=0.3, omega_lam=None):
51
+ """Calculate comoving distance D_C (in Mpc) of an object given its redshift"""
52
+
53
+ if omega_lam is None: # flat Universe
54
+ omega_lam = 1 - omega_m
55
+
56
+ # Equation (7) of Hogg-99
57
+ omega_k = 1 - omega_m - omega_lam
58
+
59
+ c = 299792.458 # speed of light in km/s
60
+ dh = c/h0
61
+
62
+ is_scalar = np.isscalar(z)
63
+ z = np.atleast_1d(z)
64
+ dc = np.zeros_like(z, dtype=float)
65
+ for i, zi in enumerate(z): # equation (15) of Hogg-99
66
+ dc[i] = dh*quad1d(integrand, [0, zi], args=(omega_m, omega_k, omega_lam)).integ
67
+
68
+ # Equation (16) of Hogg-99
69
+ if omega_k > 0:
70
+ dm = dh*np.sinh(np.sqrt(omega_k)*dc/dh)/np.sqrt(omega_k)
71
+ elif omega_k < 0:
72
+ dm = dh*np.sin(np.sqrt(np.abs(omega_k))*dc/dh)/np.sqrt(np.abs(omega_k))
73
+ else:
74
+ dm = dc
75
+
76
+ if is_scalar:
77
+ dm = dm.item() # Make it a scalar if input was scalar
78
+
79
+ return dm
80
+
81
+ ##############################################################################
82
+
83
+ def angular_diameter_distance(z, **kwargs):
84
+ """Calculate angular diameter distance D_A (in Mpc) of an object given its redshift"""
85
+
86
+ return comoving_distance(z, **kwargs)/(1 + z)
87
+
88
+ ##############################################################################
89
+
90
+ def luminosity_distance(z, **kwargs):
91
+ """Calculate luminosity distance D_L (in Mpc) of an object given its redshift"""
92
+
93
+ return comoving_distance(z, **kwargs)*(1 + z)
94
+
95
+ ##############################################################################
96
+
97
+ if __name__ == '__main__':
98
+
99
+ z = 3.0
100
+ dm = comoving_distance(z)
101
+ print(f"redshift: {z}\nComoving distance: {dm}\nLuminosity distance: {dm*(1 + z)}\n"
102
+ f"Angular diameter distance: {dm/(1 + z)}")
103
+
104
+ dm = comoving_distance(z, omega_m=0.4, omega_lam=0.3)
105
+ print(f"redshift: {z}\nComoving distance: {dm}\nLuminosity distance: {dm*(1 + z)}\n"
106
+ f"Angular diameter distance: {dm/(1 + z)}")
@@ -0,0 +1 @@
1
+ # This file is intentionally empty
@@ -0,0 +1,29 @@
1
+ # MGE model for a Satoh model
2
+ # This is Table 1 from Cappellari (2020, MNRAS)
3
+ # https://ui.adsabs.harvard.edu/abs/2020MNRAS.494.4819C
4
+ ################################################
5
+ # logDens logSig q
6
+ ################################################
7
+ -1.834 -0.238 0.581
8
+ -1.686 -0.093 0.695
9
+ -1.934 0.053 0.374
10
+ -2.208 0.076 0.739
11
+ -3.019 0.228 0.808
12
+ -2.339 0.236 0.397
13
+ -2.977 0.378 0.162
14
+ -3.850 0.406 0.792
15
+ -3.171 0.417 0.424
16
+ -4.960 0.485 0.970
17
+ -3.305 0.558 0.174
18
+ -4.964 0.643 0.653
19
+ -4.305 0.644 0.386
20
+ -5.610 0.694 0.863
21
+ -4.124 0.754 0.170
22
+ -4.057 0.781 0.074
23
+ -6.695 0.809 1.000
24
+ -5.611 0.972 0.271
25
+ -6.350 0.998 0.493
26
+ -5.160 1.068 0.118
27
+ -4.596 1.072 0.058
28
+ -7.518 1.085 1.000
29
+