ppxf 9.2.0__tar.gz → 9.2.2__tar.gz
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.
- {ppxf-9.2.0 → ppxf-9.2.2}/PKG-INFO +113 -70
- {ppxf-9.2.0 → ppxf-9.2.2}/ppxf/CHANGELOG.rst +46 -21
- ppxf-9.2.2/ppxf/__init__.py +1 -0
- {ppxf-9.2.0 → ppxf-9.2.2}/ppxf/examples/ppxf_example_kinematics_sauron.py +3 -3
- {ppxf-9.2.0 → ppxf-9.2.2}/ppxf/examples/ppxf_example_kinematics_sdss.py +18 -21
- {ppxf-9.2.0 → ppxf-9.2.2}/ppxf/examples/ppxf_example_population_gas_sdss.py +1 -2
- {ppxf-9.2.0 → ppxf-9.2.2}/ppxf/examples/ppxf_python_reference_output.txt +53 -53
- {ppxf-9.2.0 → ppxf-9.2.2}/ppxf/ppxf.py +115 -78
- {ppxf-9.2.0 → ppxf-9.2.2}/ppxf/ppxf_util.py +36 -18
- {ppxf-9.2.0 → ppxf-9.2.2}/ppxf/sps_util.py +5 -6
- {ppxf-9.2.0 → ppxf-9.2.2}/ppxf.egg-info/PKG-INFO +113 -70
- ppxf-9.2.0/ppxf/__init__.py +0 -1
- {ppxf-9.2.0 → ppxf-9.2.2}/ppxf/LICENSE.txt +0 -0
- {ppxf-9.2.0 → ppxf-9.2.2}/ppxf/README.rst +0 -0
- {ppxf-9.2.0 → ppxf-9.2.2}/ppxf/capfit.py +0 -0
- {ppxf-9.2.0 → ppxf-9.2.2}/ppxf/examples/FILTER.RES.info.txt +0 -0
- {ppxf-9.2.0 → ppxf-9.2.2}/ppxf/examples/FILTER.RES.txt +0 -0
- {ppxf-9.2.0 → ppxf-9.2.2}/ppxf/examples/__init__.py +0 -0
- {ppxf-9.2.0 → ppxf-9.2.2}/ppxf/examples/ppxf_example_gas_sdss_tied.py +0 -0
- {ppxf-9.2.0 → ppxf-9.2.2}/ppxf/examples/ppxf_example_montecarlo_simulation.py +0 -0
- {ppxf-9.2.0 → ppxf-9.2.2}/ppxf/examples/ppxf_example_population_photometry.py +0 -0
- {ppxf-9.2.0 → ppxf-9.2.2}/ppxf/examples/ppxf_example_sky_and_symmetric_losvd.py +0 -0
- {ppxf-9.2.0 → ppxf-9.2.2}/ppxf/examples/ppxf_example_two_components.py +0 -0
- {ppxf-9.2.0 → ppxf-9.2.2}/ppxf/spectra/NGC3073_SDSS_DR8.fits +0 -0
- {ppxf-9.2.0 → ppxf-9.2.2}/ppxf/spectra/NGC3522_SDSS_DR8.fits +0 -0
- {ppxf-9.2.0 → ppxf-9.2.2}/ppxf/spectra/NGC4550_SAURON.fits +0 -0
- {ppxf-9.2.0 → ppxf-9.2.2}/ppxf/spectra/NGC4636_SDSS_DR12.fits +0 -0
- {ppxf-9.2.0 → ppxf-9.2.2}/ppxf/spectra/legac_M19_56670_v3.0.fits +0 -0
- {ppxf-9.2.0 → ppxf-9.2.2}/ppxf/sps_models/Vazdekis2012_ssp_mass_Padova00_UN_baseFe_v10.0.txt +0 -0
- {ppxf-9.2.0 → ppxf-9.2.2}/ppxf/sps_models/Vazdekis2012_ssp_phot_Padova00_UN_v10.0.txt +0 -0
- {ppxf-9.2.0 → ppxf-9.2.2}/ppxf/sps_models/Vazdekis2012_ssp_sdss_miuscat_UN1.30_v9.txt +0 -0
- {ppxf-9.2.0 → ppxf-9.2.2}/ppxf/sps_models/spectra_sun_vega.npz +0 -0
- {ppxf-9.2.0 → ppxf-9.2.2}/ppxf.egg-info/SOURCES.txt +0 -0
- {ppxf-9.2.0 → ppxf-9.2.2}/ppxf.egg-info/dependency_links.txt +0 -0
- {ppxf-9.2.0 → ppxf-9.2.2}/ppxf.egg-info/requires.txt +0 -0
- {ppxf-9.2.0 → ppxf-9.2.2}/ppxf.egg-info/top_level.txt +0 -0
- {ppxf-9.2.0 → ppxf-9.2.2}/ppxf.egg-info/zip-safe +0 -0
- {ppxf-9.2.0 → ppxf-9.2.2}/setup.cfg +0 -0
- {ppxf-9.2.0 → ppxf-9.2.2}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ppxf
|
|
3
|
-
Version: 9.2.
|
|
3
|
+
Version: 9.2.2
|
|
4
4
|
Summary: pPXF: Full Spectrum and SED Fitting of Galactic and Stellar Spectra
|
|
5
5
|
Home-page: https://purl.org/cappellari/software
|
|
6
6
|
Author: Michele Cappellari
|
|
@@ -159,13 +159,13 @@ Calling Sequence
|
|
|
159
159
|
constr_kinem=None, degree=4, dust=None, fixed=None,
|
|
160
160
|
fraction=None, ftol=1e-4, gas_component=None, gas_names=None,
|
|
161
161
|
gas_reddening=None, gas_reddening_func=None,
|
|
162
|
-
global_search=False, goodpixels=None, lam=None,
|
|
163
|
-
linear=False, linear_method='lsq_box',
|
|
164
|
-
method='capfit', mdegree=0, moments=2, phot=None,
|
|
165
|
-
quiet=False, reddening=None, reddening_func=None,
|
|
166
|
-
reg_dim=None, reg_ord=2,
|
|
167
|
-
|
|
168
|
-
vsyst=0, x0=None)
|
|
162
|
+
global_search=False, goodpixels=None, lam=None,
|
|
163
|
+
lam_temp=None, linear=False, linear_method='lsq_box',
|
|
164
|
+
mask=None, method='capfit', mdegree=0, moments=2, phot=None,
|
|
165
|
+
plot=False, quiet=False, reddening=None, reddening_func=None,
|
|
166
|
+
reg_dim=None, reg_ord=2, reg_step=None, regul=0,
|
|
167
|
+
sigma_diff=0, sky=None, templates_rfft=None, tied=None,
|
|
168
|
+
trig=False, velscale_ratio=1, vsyst=0, x0=None)
|
|
169
169
|
|
|
170
170
|
print(pp.sol) # print best-fitting kinematics (V, sigma, h3, h4)
|
|
171
171
|
pp.plot() # Plot best fit with gas lines and photometry
|
|
@@ -900,6 +900,65 @@ reddening: float, optional
|
|
|
900
900
|
|
|
901
901
|
NOTE: This keyword is obsolete. I recommend using the more flexible and
|
|
902
902
|
general ``dust`` keyword instead.
|
|
903
|
+
reg_dim: tuple, optional
|
|
904
|
+
When using regularization with more than one kinematic component (using
|
|
905
|
+
the ``component`` keyword), the regularization is only applied to the
|
|
906
|
+
first one (``component=0``). This is useful to fit the stellar
|
|
907
|
+
population and gas emissions together.
|
|
908
|
+
|
|
909
|
+
In this situation, one has to use the ``reg_dim`` keyword, to give
|
|
910
|
+
``pPXF`` the dimensions of the population parameters (e.g. ``n_age``,
|
|
911
|
+
``n_metal``, ``n_alpha``). One should create the initial array of
|
|
912
|
+
population templates like e.g.
|
|
913
|
+
``templates[n_pixels, n_age, n_metal, n_alpha]`` and define::
|
|
914
|
+
|
|
915
|
+
reg_dim = templates.shape[1:] # = [n_age, n_metal, n_alpha]
|
|
916
|
+
|
|
917
|
+
The array of stellar templates is then reshaped into a 2-dim array as::
|
|
918
|
+
|
|
919
|
+
templates = templates.reshape(templates.shape[0], -1)
|
|
920
|
+
|
|
921
|
+
and the gas emission templates are appended as extra columns at the
|
|
922
|
+
end. An usage example is given in
|
|
923
|
+
``ppxf_example_population_gas_sdss.py``.
|
|
924
|
+
|
|
925
|
+
When using regularization with a single component (the ``component``
|
|
926
|
+
keyword is not used, or contains identical values), the number of
|
|
927
|
+
population templates along different dimensions (e.g. ``n_age``,
|
|
928
|
+
``n_metal``, ``n_alpha``) is inferred from the dimensions of the
|
|
929
|
+
``templates`` array and this keyword is not necessary.
|
|
930
|
+
reg_ord: int, optional
|
|
931
|
+
Order of the derivative that is minimized by the regularization.
|
|
932
|
+
The following two rotationally-symmetric estimators are supported:
|
|
933
|
+
|
|
934
|
+
* ``reg_ord=1``: minimizes the integral over the weights of the squared
|
|
935
|
+
gradient::
|
|
936
|
+
|
|
937
|
+
Grad[w] @ Grad[w].
|
|
938
|
+
|
|
939
|
+
* ``reg_ord=2``: minimizes the integral over the weights of the squared
|
|
940
|
+
curvature::
|
|
941
|
+
|
|
942
|
+
Laplacian[w]**2.
|
|
943
|
+
|
|
944
|
+
reg_step: list of arrays, shape (len(reg_dim),)
|
|
945
|
+
Defines the step sizes for numerical estimation of derivatives during
|
|
946
|
+
regularization. Each array in the list corresponds to a dimension in
|
|
947
|
+
``reg_dim``, specifying the step size for each interval within that
|
|
948
|
+
dimension. By default, if ``reg_step`` is not provided, a step size of
|
|
949
|
+
one is assumed for all dimensions, equivalent to
|
|
950
|
+
``reg_step = [np.ones(rd - 1) for rd in reg_dim]``. To customize,
|
|
951
|
+
provide ``reg_step`` as a list containing arrays, where each array has
|
|
952
|
+
a length of ``reg_dim[j] - 1``, allowing for variable step sizes across
|
|
953
|
+
intervals and dimensions.
|
|
954
|
+
|
|
955
|
+
NOTE 1: Multiplying each element in ``reg_step`` by a constant factor
|
|
956
|
+
``k`` has the same effect as dividing the regularization parameter
|
|
957
|
+
``regul`` by ``k**reg_ord``.
|
|
958
|
+
|
|
959
|
+
NOTE 2: The standard approach consists of sampling the SPS template
|
|
960
|
+
spectra logarithmically in age and adopt a constant unitary step,
|
|
961
|
+
**without** using this keyword.
|
|
903
962
|
regul: float, optional
|
|
904
963
|
If this keyword is nonzero, the program applies first or second-order
|
|
905
964
|
linear regularization to the ``weights`` during the ``pPXF`` fit.
|
|
@@ -972,47 +1031,6 @@ regul: float, optional
|
|
|
972
1031
|
consistent with the observations and the derived star formation history
|
|
973
1032
|
will be the smoothest (minimum curvature or minimum variation) that is
|
|
974
1033
|
still consistent with the observations.
|
|
975
|
-
reg_dim: tuple, optional
|
|
976
|
-
When using regularization with more than one kinematic component (using
|
|
977
|
-
the ``component`` keyword), the regularization is only applied to the
|
|
978
|
-
first one (``component=0``). This is useful to fit the stellar
|
|
979
|
-
population and gas emissions together.
|
|
980
|
-
|
|
981
|
-
In this situation, one has to use the ``reg_dim`` keyword, to give
|
|
982
|
-
``pPXF`` the dimensions of the population parameters (e.g. ``n_age``,
|
|
983
|
-
``n_metal``, ``n_alpha``). One should create the initial array of
|
|
984
|
-
population templates like e.g.
|
|
985
|
-
``templates[n_pixels, n_age, n_metal, n_alpha]`` and define::
|
|
986
|
-
|
|
987
|
-
reg_dim = templates.shape[1:] # = [n_age, n_metal, n_alpha]
|
|
988
|
-
|
|
989
|
-
The array of stellar templates is then reshaped into a 2-dim array as::
|
|
990
|
-
|
|
991
|
-
templates = templates.reshape(templates.shape[0], -1)
|
|
992
|
-
|
|
993
|
-
and the gas emission templates are appended as extra columns at the
|
|
994
|
-
end. An usage example is given in
|
|
995
|
-
``ppxf_example_population_gas_sdss.py``.
|
|
996
|
-
|
|
997
|
-
When using regularization with a single component (the ``component``
|
|
998
|
-
keyword is not used, or contains identical values), the number of
|
|
999
|
-
population templates along different dimensions (e.g. ``n_age``,
|
|
1000
|
-
``n_metal``, ``n_alpha``) is inferred from the dimensions of the
|
|
1001
|
-
``templates`` array and this keyword is not necessary.
|
|
1002
|
-
reg_ord: int, optional
|
|
1003
|
-
Order of the derivative that is minimized by the regularization.
|
|
1004
|
-
The following two rotationally-symmetric estimators are supported:
|
|
1005
|
-
|
|
1006
|
-
* ``reg_ord=1``: minimizes the integral over the weights of the squared
|
|
1007
|
-
gradient::
|
|
1008
|
-
|
|
1009
|
-
Grad[w] @ Grad[w].
|
|
1010
|
-
|
|
1011
|
-
* ``reg_ord=2``: minimizes the integral over the weights of the squared
|
|
1012
|
-
curvature::
|
|
1013
|
-
|
|
1014
|
-
Laplacian[w]**2.
|
|
1015
|
-
|
|
1016
1034
|
sigma_diff: float, optional
|
|
1017
1035
|
Quadratic difference in km/s defined as::
|
|
1018
1036
|
|
|
@@ -1472,33 +1490,58 @@ redistribute the code.
|
|
|
1472
1490
|
Changelog
|
|
1473
1491
|
---------
|
|
1474
1492
|
|
|
1475
|
-
V9.2.
|
|
1493
|
+
V9.2.2: MC, Oxford, 20 May 2024
|
|
1494
|
+
+++++++++++++++++++++++++++++++
|
|
1495
|
+
|
|
1496
|
+
- ``ppxf``: Fixed an issue where the absence of the ``reg_dim`` keyword could
|
|
1497
|
+
halt the program (bug from V9.2.1). Thanks to Jesse van de Sande
|
|
1498
|
+
(unsw.edu.au) and Luiz A. Silva-Lima (Univ. São Paulo, Brazil) for the
|
|
1499
|
+
report.
|
|
1500
|
+
|
|
1501
|
+
- ``ppxf``: Avoid possible program stop when ``templates`` are shorter than
|
|
1502
|
+
``galaxy`` (bug from V9.2.1).
|
|
1503
|
+
|
|
1504
|
+
- ``ppxf``: Avoid truncating ``templates`` to ``goodpixels`` in the final plot,
|
|
1505
|
+
when both ``lam`` and ``lam_temp`` parameters are supplied. Instead, show the
|
|
1506
|
+
``templates`` over the full ``galaxy`` spectral range.
|
|
1507
|
+
|
|
1508
|
+
- ``ppxf``: Corrected behaviour to only use the range between the first and
|
|
1509
|
+
last ``goodpixels`` for determining the vertical plotting range. Thanks to
|
|
1510
|
+
David Gooding (chch.ox.ac.uk) for illustrating the problem.
|
|
1511
|
+
|
|
1512
|
+
- ``ppxf_example_kinematics_sdss.py``: Modified the example to de-redshift the
|
|
1513
|
+
spectrum by default, minimizing potential confusion.
|
|
1514
|
+
|
|
1515
|
+
V9.2.1: MC, Oxford, 18 April 2024
|
|
1476
1516
|
+++++++++++++++++++++++++++++++++
|
|
1477
1517
|
|
|
1478
|
-
-
|
|
1479
|
-
|
|
1480
|
-
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1518
|
+
- ``sps_util.synthetic_photometry``: Accepts input wavelengths that are not
|
|
1519
|
+
evenly spaced.
|
|
1520
|
+
- ``ppxf_util.mag_spectrum``: A new function to get the apparent magnitude from
|
|
1521
|
+
a spectrum in any photometric band, at any redshift, in either the AB or Vega
|
|
1522
|
+
magnitude system.
|
|
1523
|
+
- ``ppxf``: Now considers the given ``goodpixels`` when checking that the
|
|
1524
|
+
``templates`` cover the full ``galaxy`` spectrum, if both ``lam`` and
|
|
1525
|
+
``lam_temp`` are provided.
|
|
1526
|
+
- ``ppxf``: Allow for variable step size across intervals and dimensions in the
|
|
1527
|
+
numerical derivatives used for regularization, with the new keyword
|
|
1528
|
+
``reg_step``.
|
|
1529
|
+
- ``ppxf``: Avoids new ``SyntaxWarning`` in Matplotlib LaTeX string in the
|
|
1530
|
+
latest Python 3.12.
|
|
1531
|
+
- ``ppxf``: Avoid program stop when passing an input covariance matrix while
|
|
1532
|
+
fitting for gas emission lines. Thanks to Jackson ODonnell (ucsc.edu) for the
|
|
1533
|
+
report.
|
|
1491
1534
|
|
|
1492
1535
|
V9.1.1: MC, Oxford, 18 January 2024
|
|
1493
1536
|
+++++++++++++++++++++++++++++++++++
|
|
1494
1537
|
|
|
1495
|
-
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1538
|
+
- ``sps_util.mass_to_light``: Now it can calculate the stellar mass-to-light
|
|
1539
|
+
ratio (``M*/L``) for any stellar population synthesis (SPS) model, any
|
|
1540
|
+
filter, and any redshift, using the output weights from ``pPXF``. No need for
|
|
1541
|
+
pre-computed tables anymore.
|
|
1542
|
+
- ``ppxf_util.mag_sun``: A new function to get the absolute solar magnitude in
|
|
1543
|
+
any photometric band, at any redshift, in either the AB or Vega magnitude
|
|
1544
|
+
system.
|
|
1502
1545
|
|
|
1503
1546
|
V9.0.2: MC, Oxford, 30 November 2023
|
|
1504
1547
|
++++++++++++++++++++++++++++++++++++
|
|
@@ -2,33 +2,58 @@
|
|
|
2
2
|
Changelog
|
|
3
3
|
---------
|
|
4
4
|
|
|
5
|
-
V9.2.
|
|
5
|
+
V9.2.2: MC, Oxford, 20 May 2024
|
|
6
|
+
+++++++++++++++++++++++++++++++
|
|
7
|
+
|
|
8
|
+
- ``ppxf``: Fixed an issue where the absence of the ``reg_dim`` keyword could
|
|
9
|
+
halt the program (bug from V9.2.1). Thanks to Jesse van de Sande
|
|
10
|
+
(unsw.edu.au) and Luiz A. Silva-Lima (Univ. São Paulo, Brazil) for the
|
|
11
|
+
report.
|
|
12
|
+
|
|
13
|
+
- ``ppxf``: Avoid possible program stop when ``templates`` are shorter than
|
|
14
|
+
``galaxy`` (bug from V9.2.1).
|
|
15
|
+
|
|
16
|
+
- ``ppxf``: Avoid truncating ``templates`` to ``goodpixels`` in the final plot,
|
|
17
|
+
when both ``lam`` and ``lam_temp`` parameters are supplied. Instead, show the
|
|
18
|
+
``templates`` over the full ``galaxy`` spectral range.
|
|
19
|
+
|
|
20
|
+
- ``ppxf``: Corrected behaviour to only use the range between the first and
|
|
21
|
+
last ``goodpixels`` for determining the vertical plotting range. Thanks to
|
|
22
|
+
David Gooding (chch.ox.ac.uk) for illustrating the problem.
|
|
23
|
+
|
|
24
|
+
- ``ppxf_example_kinematics_sdss.py``: Modified the example to de-redshift the
|
|
25
|
+
spectrum by default, minimizing potential confusion.
|
|
26
|
+
|
|
27
|
+
V9.2.1: MC, Oxford, 18 April 2024
|
|
6
28
|
+++++++++++++++++++++++++++++++++
|
|
7
29
|
|
|
8
|
-
-
|
|
9
|
-
|
|
10
|
-
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
30
|
+
- ``sps_util.synthetic_photometry``: Accepts input wavelengths that are not
|
|
31
|
+
evenly spaced.
|
|
32
|
+
- ``ppxf_util.mag_spectrum``: A new function to get the apparent magnitude from
|
|
33
|
+
a spectrum in any photometric band, at any redshift, in either the AB or Vega
|
|
34
|
+
magnitude system.
|
|
35
|
+
- ``ppxf``: Now considers the given ``goodpixels`` when checking that the
|
|
36
|
+
``templates`` cover the full ``galaxy`` spectrum, if both ``lam`` and
|
|
37
|
+
``lam_temp`` are provided.
|
|
38
|
+
- ``ppxf``: Allow for variable step size across intervals and dimensions in the
|
|
39
|
+
numerical derivatives used for regularization, with the new keyword
|
|
40
|
+
``reg_step``.
|
|
41
|
+
- ``ppxf``: Avoids new ``SyntaxWarning`` in Matplotlib LaTeX string in the
|
|
42
|
+
latest Python 3.12.
|
|
43
|
+
- ``ppxf``: Avoid program stop when passing an input covariance matrix while
|
|
44
|
+
fitting for gas emission lines. Thanks to Jackson ODonnell (ucsc.edu) for the
|
|
45
|
+
report.
|
|
21
46
|
|
|
22
47
|
V9.1.1: MC, Oxford, 18 January 2024
|
|
23
48
|
+++++++++++++++++++++++++++++++++++
|
|
24
49
|
|
|
25
|
-
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
-
|
|
30
|
-
|
|
31
|
-
|
|
50
|
+
- ``sps_util.mass_to_light``: Now it can calculate the stellar mass-to-light
|
|
51
|
+
ratio (``M*/L``) for any stellar population synthesis (SPS) model, any
|
|
52
|
+
filter, and any redshift, using the output weights from ``pPXF``. No need for
|
|
53
|
+
pre-computed tables anymore.
|
|
54
|
+
- ``ppxf_util.mag_sun``: A new function to get the absolute solar magnitude in
|
|
55
|
+
any photometric band, at any redshift, in either the AB or Vega magnitude
|
|
56
|
+
system.
|
|
32
57
|
|
|
33
58
|
V9.0.2: MC, Oxford, 30 November 2023
|
|
34
59
|
++++++++++++++++++++++++++++++++++++
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "9.2.2"
|
|
@@ -106,7 +106,7 @@ def ppxf_example_kinematics_sauron(high_redshift=False):
|
|
|
106
106
|
fwhm_gal = 4.2 # SAURON has an instrumental resolution FWHM of 4.2A.
|
|
107
107
|
|
|
108
108
|
# If high_redshift is True I create a mock high-redshift spectrum by
|
|
109
|
-
# artificially
|
|
109
|
+
# artificially red-shifting the local wavelength to redshift z0 ~ 1.23.
|
|
110
110
|
# I also have to broaden both the wavelength range and the instrumental
|
|
111
111
|
# resolution (in wavelength units!).
|
|
112
112
|
# You should comment/ignore the following four lines if you are using a
|
|
@@ -192,8 +192,8 @@ def ppxf_example_kinematics_sauron(high_redshift=False):
|
|
|
192
192
|
# emission lines are excluded from the pPXF fit using the GOODPIXELS
|
|
193
193
|
# keyword.
|
|
194
194
|
c = 299792.458
|
|
195
|
-
vel = c*np.log(1 + redshift)
|
|
196
|
-
start = [vel, 200.]
|
|
195
|
+
vel = c*np.log(1 + redshift) # eq.(8) of Cappellari (2017, MNRAS)
|
|
196
|
+
start = [vel, 200.] # (km/s), starting guess for [V, sigma]
|
|
197
197
|
t = clock()
|
|
198
198
|
|
|
199
199
|
pp = ppxf(sps.templates, galaxy, noise, velscale, start,
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
# templates. MC, Oxford, 31 August 2023
|
|
71
71
|
# V3.4.0: Use the new `sps_util` instead of `miles_util`.
|
|
72
72
|
# MC, Oxford, 12 November 2023
|
|
73
|
+
# V3.5.0: De-redshift the spectrum before the fit. MC, Oxford, 17 May 2024
|
|
73
74
|
#
|
|
74
75
|
##############################################################################
|
|
75
76
|
|
|
@@ -99,31 +100,27 @@ def ppxf_example_kinematics_sdss():
|
|
|
99
100
|
|
|
100
101
|
galaxy = t['flux']/np.median(t['flux']) # Normalize spectrum to avoid numerical issues
|
|
101
102
|
ln_lam_gal = t['loglam']*np.log(10) # Convert lg --> ln
|
|
102
|
-
lam_gal = np.exp(ln_lam_gal)
|
|
103
|
-
|
|
103
|
+
lam_gal = np.exp(ln_lam_gal) # Wavelength in Angstroms
|
|
104
|
+
|
|
104
105
|
c = 299792.458 # speed of light in km/s
|
|
106
|
+
d_ln_lam_gal = (ln_lam_gal[-1] - ln_lam_gal[0])/(ln_lam_gal.size - 1) # Use full lam range for accuracy
|
|
105
107
|
velscale = c*d_ln_lam_gal # Velocity scale in km/s per pixel (eq.8 of Cappellari 2017)
|
|
106
|
-
velscale = velscale.item() # velscale must be a scalar
|
|
107
108
|
noise = np.full_like(galaxy, 0.0166) # Assume constant noise per pixel here
|
|
108
109
|
|
|
109
|
-
# Compute instrumental FWHM for every pixel in
|
|
110
|
-
dlam_gal = np.
|
|
111
|
-
dlam_gal = np.append(dlam_gal, dlam_gal[-1])
|
|
110
|
+
# Compute instrumental FWHM for every pixel in Angstroms
|
|
111
|
+
dlam_gal = np.gradient(lam_gal) # Size of every pixel in Angstroms
|
|
112
112
|
wdisp = t['wdisp'] # Intrinsic dispersion of every pixel, in pixels units
|
|
113
113
|
fwhm_gal = 2.355*wdisp*dlam_gal # Resolution FWHM of every pixel, in Angstroms
|
|
114
114
|
|
|
115
|
-
#
|
|
116
|
-
#
|
|
117
|
-
#
|
|
118
|
-
#
|
|
119
|
-
#
|
|
115
|
+
# In general, especially at significant redshift, it is easier to bring the
|
|
116
|
+
# galaxy spectrum roughly to the rest-frame wavelength, before calling pPXF
|
|
117
|
+
# (See Sec.2.4 of Cappellari 2017). In practice there is no need to modify
|
|
118
|
+
# the spectrum in any way, given that a red shift corresponds to a linear
|
|
119
|
+
# shift of the log-rebinned spectrum. One just needs to compute the
|
|
120
120
|
# wavelength range in the rest-frame and adjust the instrumental resolution
|
|
121
|
-
# of the galaxy observations.
|
|
122
|
-
#
|
|
123
|
-
#
|
|
124
|
-
# lam_gal = lam_gal/(1 + z) # Compute approximate restframe wavelength
|
|
125
|
-
# fwhm_gal = fwhm_gal/(1 + z) # Adjust resolution in Angstroms
|
|
126
|
-
# z = 0 # Spectrum is now in rest-frame
|
|
121
|
+
# of the galaxy observations.
|
|
122
|
+
lam_gal = lam_gal/(1 + redshift_0) # Compute approximate restframe wavelength
|
|
123
|
+
fwhm_gal = fwhm_gal/(1 + redshift_0) # Adjust resolution in Angstroms
|
|
127
124
|
|
|
128
125
|
#------------------- Setup stellar templates -----------------------
|
|
129
126
|
|
|
@@ -172,14 +169,14 @@ def ppxf_example_kinematics_sdss():
|
|
|
172
169
|
|
|
173
170
|
sps = lib.sps_lib(filename, velscale, fwhm_gal, wave_range=lam_range_temp)
|
|
174
171
|
|
|
175
|
-
goodpixels = util.determine_goodpixels(np.log(lam_gal), lam_range_temp
|
|
172
|
+
goodpixels = util.determine_goodpixels(np.log(lam_gal), lam_range_temp)
|
|
176
173
|
|
|
177
174
|
# Here the actual fit starts. The best fit is plotted on the screen.
|
|
178
175
|
# Gas emission lines are excluded from the pPXF fit using the GOODPIXELS keyword.
|
|
179
176
|
#
|
|
180
|
-
c = 299792.458
|
|
181
|
-
vel =
|
|
182
|
-
start = [vel, 200.]
|
|
177
|
+
c = 299792.458 # km/s
|
|
178
|
+
vel = 0 # Spectrum is de-redshifted --> starting guess is zero
|
|
179
|
+
start = [vel, 200.] # (km/s), starting guess for [V, sigma]
|
|
183
180
|
t = clock()
|
|
184
181
|
|
|
185
182
|
pp = ppxf(sps.templates, galaxy, noise, velscale, start,
|
|
@@ -82,7 +82,6 @@ from ppxf.ppxf import ppxf
|
|
|
82
82
|
import ppxf.ppxf_util as util
|
|
83
83
|
import ppxf.sps_util as lib
|
|
84
84
|
|
|
85
|
-
|
|
86
85
|
##############################################################################
|
|
87
86
|
|
|
88
87
|
def ppxf_example_population_gas_sdss(tie_balmer, limit_doublets):
|
|
@@ -178,7 +177,7 @@ def ppxf_example_population_gas_sdss(tie_balmer, limit_doublets):
|
|
|
178
177
|
url = "https://raw.githubusercontent.com/micappe/ppxf_data/main/" + basename
|
|
179
178
|
request.urlretrieve(url, filename)
|
|
180
179
|
|
|
181
|
-
sps = lib.sps_lib(filename, velscale, wave_range=lam_range_temp, norm_range=[5070, 5950])
|
|
180
|
+
sps = lib.sps_lib(filename, velscale, FWHM_gal, wave_range=lam_range_temp, norm_range=[5070, 5950])
|
|
182
181
|
|
|
183
182
|
#------------------- Setup templates -----------------------
|
|
184
183
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
# Reference expected output of the pPXF 9.2.
|
|
1
|
+
# Reference expected output of the pPXF 9.2.2 examples (20 May 2024).
|
|
2
2
|
# Python 3.12 using NumPy 1.26, SciPy 1.13, Matplotlib 3.8
|
|
3
3
|
###############################################################################
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
>>> runfile('ppxf_example_kinematics_sauron.py')
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Best Fit: Vel sigma h3 h4
|
|
9
9
|
comp. 0: 33 111 0.028 0.066
|
|
10
10
|
chi2/DOF: 1.026; DOF: 337; degree = 4; mdegree = 0
|
|
11
11
|
method = capfit; Jac calls: 4; Func calls: 22; Status: 2
|
|
@@ -13,7 +13,7 @@ linear_method = lsq_box; Nonzero Templates (>0.1%): 7/150
|
|
|
13
13
|
Formal errors:
|
|
14
14
|
dV dsigma dh3 dh4
|
|
15
15
|
2.5 5.6 0.019 0.034
|
|
16
|
-
Elapsed time in pPXF: 0.
|
|
16
|
+
Elapsed time in pPXF: 0.25 s
|
|
17
17
|
Best-fitting redshift z = 1.233248 +/- 0.000019
|
|
18
18
|
|
|
19
19
|
|
|
@@ -24,15 +24,15 @@ Best-fitting redshift z = 1.233248 +/- 0.000019
|
|
|
24
24
|
|
|
25
25
|
WARNING: the template's resolution dlam is larger than the galaxy's
|
|
26
26
|
Best Fit: Vel sigma h3 h4
|
|
27
|
-
comp. 0:
|
|
28
|
-
chi2/DOF: 0.
|
|
27
|
+
comp. 0: 67 223 -0.023 0.084
|
|
28
|
+
chi2/DOF: 0.8812; DOF: 3617; degree = 20; mdegree = 0
|
|
29
29
|
method = capfit; Jac calls: 3; Func calls: 17; Status: 2
|
|
30
30
|
linear_method = lsq_box; Nonzero Templates (>0.1%): 3/150
|
|
31
31
|
Formal errors:
|
|
32
32
|
dV dsigma dh3 dh4
|
|
33
33
|
2.4 3.2 0.0086 0.01
|
|
34
|
-
Elapsed time in pPXF: 0.
|
|
35
|
-
Best-fitting redshift z = 0.
|
|
34
|
+
Elapsed time in pPXF: 0.70 s
|
|
35
|
+
Best-fitting redshift z = 0.0033519 +/- 0.0000080
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
###############################################################################
|
|
@@ -49,36 +49,36 @@ Emission lines included in gas templates:
|
|
|
49
49
|
'[SII]6731' '[NeIII]3968' '[NeIII]3869' 'HeII4687' 'HeI5876'
|
|
50
50
|
'[OIII]5007_d' '[OI]6300_d' '[NII]6583_d']
|
|
51
51
|
Best Fit: Vel sigma h3 h4
|
|
52
|
-
comp. 0: 1213
|
|
53
|
-
comp. 1: 1206
|
|
54
|
-
comp. 2: 1194
|
|
52
|
+
comp. 0: 1213 101 -0.019 0.039
|
|
53
|
+
comp. 1: 1206 93
|
|
54
|
+
comp. 2: 1194 72
|
|
55
55
|
chi2/DOF: 1.003; DOF: 3829; degree = -1; mdegree = 10
|
|
56
|
-
method = capfit; Jac calls: 6; Func calls:
|
|
57
|
-
linear_method = lsq_box; Nonzero Templates (>0.1%):
|
|
56
|
+
method = capfit; Jac calls: 6; Func calls: 116; Status: 2
|
|
57
|
+
linear_method = lsq_box; Nonzero Templates (>0.1%): 38/167
|
|
58
58
|
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
59
59
|
gas_component name flux err V sig
|
|
60
60
|
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
61
|
-
Comp: 1 H10 0.
|
|
62
|
-
Comp: 1 H9 0.000 0.
|
|
63
|
-
Comp: 1 H8 0.
|
|
64
|
-
Comp: 1 Heps 0.
|
|
65
|
-
Comp: 1 Hdelta 0.
|
|
66
|
-
Comp: 1 Hgamma 0.
|
|
67
|
-
Comp: 1 Hbeta 0.
|
|
68
|
-
Comp: 1 Halpha 1.
|
|
69
|
-
Comp: 1 [SII]6716 0.
|
|
70
|
-
Comp: 1 [SII]6731 0.
|
|
71
|
-
Comp: 2 [NeIII]3968 0.
|
|
72
|
-
Comp: 2 [NeIII]3869 0.
|
|
73
|
-
Comp: 2 HeII4687 0.
|
|
74
|
-
Comp: 2 HeI5876 0.
|
|
75
|
-
Comp: 2 [OIII]5007_d 1.
|
|
76
|
-
Comp: 2 [OI]6300_d 0.
|
|
77
|
-
Comp: 2 [NII]6583_d 0.
|
|
61
|
+
Comp: 1 H10 0.6625 0.043 1206 93
|
|
62
|
+
Comp: 1 H9 0.000 0.042 1206 93
|
|
63
|
+
Comp: 1 H8 0.03338 0.042 1206 93
|
|
64
|
+
Comp: 1 Heps 0.1956 0.048 1206 93
|
|
65
|
+
Comp: 1 Hdelta 0.1666 0.042 1206 93
|
|
66
|
+
Comp: 1 Hgamma 0.2500 0.041 1206 93
|
|
67
|
+
Comp: 1 Hbeta 0.4733 0.040 1206 93
|
|
68
|
+
Comp: 1 Halpha 1.202 0.039 1206 93
|
|
69
|
+
Comp: 1 [SII]6716 0.3208 0.039 1206 93
|
|
70
|
+
Comp: 1 [SII]6731 0.2422 0.039 1206 93
|
|
71
|
+
Comp: 2 [NeIII]3968 0.02460 0.045 1194 72
|
|
72
|
+
Comp: 2 [NeIII]3869 0.2205 0.040 1194 72
|
|
73
|
+
Comp: 2 HeII4687 0.1231 0.038 1194 72
|
|
74
|
+
Comp: 2 HeI5876 0.005943 0.036 1194 72
|
|
75
|
+
Comp: 2 [OIII]5007_d 1.256 0.047 1194 72
|
|
76
|
+
Comp: 2 [OI]6300_d 0.009331 0.045 1194 72
|
|
77
|
+
Comp: 2 [NII]6583_d 0.4339 0.045 1194 72
|
|
78
78
|
-----------------------------------------------------------------
|
|
79
79
|
Desired Delta Chi^2: 87.72
|
|
80
|
-
Current Delta Chi^2:
|
|
81
|
-
Elapsed time in pPXF:
|
|
80
|
+
Current Delta Chi^2: 11.35
|
|
81
|
+
Elapsed time in pPXF: 4.32
|
|
82
82
|
Weighted <lg_age> [yr]: 9.87
|
|
83
83
|
Weighted <[M/H]>: 0.0266
|
|
84
84
|
(M*/L)=4.543 (SDSS/r at z=0.0040)
|
|
@@ -91,32 +91,32 @@ Emission lines included in gas templates:
|
|
|
91
91
|
['Balmer' '[SII]6731_d1' '[SII]6731_d2' '[NeIII]3968' '[NeIII]3869'
|
|
92
92
|
'HeII4687' 'HeI5876' '[OIII]5007_d' '[OI]6300_d' '[NII]6583_d']
|
|
93
93
|
Best Fit: Vel sigma h3 h4
|
|
94
|
-
comp. 0: 1213
|
|
94
|
+
comp. 0: 1213 101 -0.024 0.049
|
|
95
95
|
comp. 1: 1208 84
|
|
96
96
|
comp. 2: 1195 72
|
|
97
|
-
Gas Attenuation A_V: 0.
|
|
98
|
-
chi2/DOF: 1.
|
|
99
|
-
method = capfit; Jac calls:
|
|
97
|
+
Gas Attenuation A_V: 0.315
|
|
98
|
+
chi2/DOF: 1.054; DOF: 3828; degree = -1; mdegree = 10
|
|
99
|
+
method = capfit; Jac calls: 7; Func calls: 147; Status: 4
|
|
100
100
|
linear_method = lsq_box; Nonzero Templates (>0.1%): 32/160
|
|
101
101
|
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
102
102
|
gas_component name flux err V sig
|
|
103
103
|
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
104
|
-
Comp: 1 Balmer 2.
|
|
105
|
-
Comp: 1 [SII]6731_d1 0.
|
|
106
|
-
Comp: 1 [SII]6731_d2 0.
|
|
107
|
-
Comp: 2 [NeIII]3968 0.
|
|
108
|
-
Comp: 2 [NeIII]3869 0.
|
|
109
|
-
Comp: 2 HeII4687 0.
|
|
110
|
-
Comp: 2 HeI5876 0.
|
|
111
|
-
Comp: 2 [OIII]5007_d 1.
|
|
112
|
-
Comp: 2 [OI]6300_d
|
|
113
|
-
Comp: 2 [NII]6583_d 0.
|
|
104
|
+
Comp: 1 Balmer 2.252 0.066 1208 84
|
|
105
|
+
Comp: 1 [SII]6731_d1 0.04365 0.094 1208 84
|
|
106
|
+
Comp: 1 [SII]6731_d2 0.4954 0.099 1208 84
|
|
107
|
+
Comp: 2 [NeIII]3968 0.07676 0.040 1195 72
|
|
108
|
+
Comp: 2 [NeIII]3869 0.2176 0.040 1195 72
|
|
109
|
+
Comp: 2 HeII4687 0.1265 0.038 1195 72
|
|
110
|
+
Comp: 2 HeI5876 0.007354 0.036 1195 72
|
|
111
|
+
Comp: 2 [OIII]5007_d 1.264 0.047 1195 72
|
|
112
|
+
Comp: 2 [OI]6300_d 0.01120 0.045 1195 72
|
|
113
|
+
Comp: 2 [NII]6583_d 0.4343 0.045 1195 72
|
|
114
114
|
-----------------------------------------------------------------
|
|
115
115
|
Desired Delta Chi^2: 87.72
|
|
116
|
-
Current Delta Chi^2:
|
|
117
|
-
Elapsed time in pPXF:
|
|
116
|
+
Current Delta Chi^2: 209.5
|
|
117
|
+
Elapsed time in pPXF: 5.91
|
|
118
118
|
Weighted <lg_age> [yr]: 9.88
|
|
119
|
-
Weighted <[M/H]>: 0.
|
|
119
|
+
Weighted <[M/H]>: 0.0304
|
|
120
120
|
(M*/L)=4.569 (SDSS/r at z=0.0040)
|
|
121
121
|
|
|
122
122
|
|
|
@@ -159,7 +159,7 @@ Starting pPXF fit
|
|
|
159
159
|
comp. 0: 1144 19
|
|
160
160
|
comp. 1: 1152 48
|
|
161
161
|
Stars Attenuation A_V: 0.002
|
|
162
|
-
chi2/DOF: 0.
|
|
162
|
+
chi2/DOF: 0.7885; DOF: 2945; degree = -1; mdegree = 8
|
|
163
163
|
Photometry chi2/n_bands: 0.1685; n_bands: 10
|
|
164
164
|
method = capfit; Jac calls: 8; Func calls: 116; Status: 2
|
|
165
165
|
linear_method = lsq_box; Nonzero Templates (>0.1%): 43/232
|
|
@@ -184,7 +184,7 @@ Comp: 1 [OIII]5007_d 1.363 0.051 1152 48
|
|
|
184
184
|
Comp: 1 [OI]6300_d 0.08694 0.048 1152 48
|
|
185
185
|
Comp: 1 [NII]6583_d 1.527 0.047 1152 48
|
|
186
186
|
-----------------------------------------------------------------
|
|
187
|
-
Elapsed time in pPXF:
|
|
187
|
+
Elapsed time in pPXF: 7.67
|
|
188
188
|
Weighted <lg_age> [yr]: 8.57
|
|
189
189
|
Weighted <[M/H]>: 0.0119
|
|
190
190
|
(M*/L)=1.036 (SDSS/r at z=0.0038)
|
|
@@ -202,7 +202,7 @@ The input values are: Vel=200, sigma=300, h3=0.1, h4=0.1
|
|
|
202
202
|
chi2/DOF: 0.9764; DOF: 6316; degree = 4; mdegree = 4
|
|
203
203
|
method = capfit; Jac calls: 3; Func calls: 41; Status: 2
|
|
204
204
|
linear_method = lsq_box; Nonzero Templates (>0.1%): 7/154
|
|
205
|
-
Elapsed time in pPXF:
|
|
205
|
+
Elapsed time in pPXF: 2.18 s
|
|
206
206
|
|
|
207
207
|
|
|
208
208
|
###############################################################################
|
|
@@ -245,7 +245,7 @@ linear_method = lsq_box; Nonzero Templates (>0.1%): 4/4
|
|
|
245
245
|
Templates weights:
|
|
246
246
|
0.485 0.512 0.485 0.512
|
|
247
247
|
==============================================
|
|
248
|
-
Total elapsed time 0.
|
|
248
|
+
Total elapsed time 0.44 s
|
|
249
249
|
|
|
250
250
|
|
|
251
251
|
###############################################################################
|
|
@@ -299,7 +299,7 @@ Comp: 6 [OIII]5007_d 1.224 0.040 1155 1
|
|
|
299
299
|
Comp: 7 [OI]6300_d 0.08985 0.036 1155 1
|
|
300
300
|
Comp: 8 [NII]6583_d 1.488 0.042 1155 56
|
|
301
301
|
-----------------------------------------------------------------
|
|
302
|
-
Elapsed time in pPXF:
|
|
302
|
+
Elapsed time in pPXF: 5.67
|
|
303
303
|
|
|
304
304
|
|
|
305
305
|
###############################################################################
|