dustapprox 0.1__tar.gz → 0.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.
Files changed (140) hide show
  1. {dustapprox-0.1 → dustapprox-0.2.2}/LICENSE +1 -1
  2. dustapprox-0.2.2/MANIFEST.in +1 -0
  3. dustapprox-0.2.2/PKG-INFO +129 -0
  4. {dustapprox-0.1 → dustapprox-0.2.2}/README.rst +20 -5
  5. dustapprox-0.2.2/pyproject.toml +173 -0
  6. dustapprox-0.2.2/src/dustapprox/__init__.py +3 -0
  7. dustapprox-0.2.2/src/dustapprox/astropy_units.py +87 -0
  8. dustapprox-0.2.2/src/dustapprox/data/Fitz19_EDR3_extinctionlawcoefficients/README.md +5 -0
  9. dustapprox-0.2.2/src/dustapprox/data/Gaia2/README.md +5 -0
  10. dustapprox-0.2.2/src/dustapprox/data/gaia_C1_extinction.ecsv +50 -0
  11. dustapprox-0.2.2/src/dustapprox/data/precomputed/README.rst +1 -0
  12. dustapprox-0.2.2/src/dustapprox/data/precomputed/grids/README.rst +5 -0
  13. dustapprox-0.2.2/src/dustapprox/data/precomputed/polynomial/G23/kurucz/nov2026_a0r0_gaia_dr3_kurucz_G23_teff_A0_R0.ecsv +91 -0
  14. dustapprox-0.2.2/src/dustapprox/data/precomputed/polynomial/G23/kurucz/nov2026_a0r0_gaiac1_kurucz_G23_teff_A0_R0.ecsv +108 -0
  15. dustapprox-0.2.2/src/dustapprox/data/precomputed/polynomial/G23/kurucz/nov2026_a0r0_gaiadr4_kurucz_G23_teff_A0_R0.ecsv +91 -0
  16. dustapprox-0.2.2/src/dustapprox/data/precomputed/polynomial/G23/kurucz/nov2026_a0r0_galex_kurucz_G23_teff_A0_R0.ecsv +90 -0
  17. dustapprox-0.2.2/src/dustapprox/data/precomputed/polynomial/G23/kurucz/nov2026_a0r0_generic_kurucz_G23_teff_A0_R0.ecsv +96 -0
  18. dustapprox-0.2.2/src/dustapprox/data/precomputed/polynomial/G23/kurucz/nov2026_a0r0_sloan_kurucz_G23_teff_A0_R0.ecsv +93 -0
  19. dustapprox-0.2.2/src/dustapprox/data/precomputed/polynomial/G23/kurucz/nov2026_a0r0_twomass_kurucz_G23_teff_A0_R0.ecsv +91 -0
  20. dustapprox-0.2.2/src/dustapprox/data/precomputed/polynomial/G23/kurucz/nov2026_a0r0_wise_kurucz_G23_teff_A0_R0.ecsv +92 -0
  21. dustapprox-0.2.2/src/dustapprox/data/precomputed/polynomial/f99/kurucz/nov2026_a0r0_gaia_dr3_kurucz_F99_teff_A0_R0.ecsv +91 -0
  22. dustapprox-0.2.2/src/dustapprox/data/precomputed/polynomial/f99/kurucz/nov2026_a0r0_gaiac1_kurucz_F99_teff_A0_R0.ecsv +108 -0
  23. dustapprox-0.2.2/src/dustapprox/data/precomputed/polynomial/f99/kurucz/nov2026_a0r0_gaiadr4_kurucz_F99_teff_A0_R0.ecsv +91 -0
  24. dustapprox-0.2.2/src/dustapprox/data/precomputed/polynomial/f99/kurucz/nov2026_a0r0_galex_kurucz_F99_teff_A0_R0.ecsv +90 -0
  25. dustapprox-0.2.2/src/dustapprox/data/precomputed/polynomial/f99/kurucz/nov2026_a0r0_generic_kurucz_F99_teff_A0_R0.ecsv +96 -0
  26. dustapprox-0.2.2/src/dustapprox/data/precomputed/polynomial/f99/kurucz/nov2026_a0r0_sloan_kurucz_F99_teff_A0_R0.ecsv +93 -0
  27. dustapprox-0.2.2/src/dustapprox/data/precomputed/polynomial/f99/kurucz/nov2026_a0r0_twomass_kurucz_F99_teff_A0_R0.ecsv +91 -0
  28. dustapprox-0.2.2/src/dustapprox/data/precomputed/polynomial/f99/kurucz/nov2026_a0r0_wise_kurucz_F99_teff_A0_R0.ecsv +92 -0
  29. dustapprox-0.2.2/src/dustapprox/extinction.py +215 -0
  30. dustapprox-0.2.2/src/dustapprox/io/__init__.py +6 -0
  31. dustapprox-0.2.2/src/dustapprox/io/ecsv.py +256 -0
  32. {dustapprox-0.1 → dustapprox-0.2.2/src}/dustapprox/io/svo.py +94 -42
  33. dustapprox-0.1/dustapprox/extinction.py → dustapprox-0.2.2/src/dustapprox/legacy_extinction.py +182 -84
  34. {dustapprox-0.1 → dustapprox-0.2.2/src}/dustapprox/literature/__init__.py +3 -1
  35. {dustapprox-0.1 → dustapprox-0.2.2/src}/dustapprox/literature/c1.py +55 -35
  36. {dustapprox-0.1 → dustapprox-0.2.2/src}/dustapprox/literature/edr3.py +67 -45
  37. dustapprox-0.2.2/src/dustapprox/models/__init__.py +318 -0
  38. dustapprox-0.2.2/src/dustapprox/models/basemodel.py +49 -0
  39. dustapprox-0.2.2/src/dustapprox/models/polynomial.py +648 -0
  40. dustapprox-0.2.2/src/dustapprox/tools/__init__.py +6 -0
  41. dustapprox-0.2.2/src/dustapprox/tools/downloader.py +173 -0
  42. dustapprox-0.2.2/src/dustapprox/tools/generate_model.py +419 -0
  43. dustapprox-0.2.2/src/dustapprox/tools/grid.py +260 -0
  44. dustapprox-0.2.2/src/dustapprox/tools/model_characteristics.py +520 -0
  45. dustapprox-0.2.2/src/dustapprox/version.py +1 -0
  46. dustapprox-0.2.2/src/dustapprox.egg-info/PKG-INFO +129 -0
  47. dustapprox-0.2.2/src/dustapprox.egg-info/SOURCES.txt +92 -0
  48. dustapprox-0.2.2/src/dustapprox.egg-info/requires.txt +37 -0
  49. dustapprox-0.2.2/tests/test_astropy_units.py +237 -0
  50. dustapprox-0.2.2/tests/test_downloader.py +576 -0
  51. dustapprox-0.2.2/tests/test_extinction.py +356 -0
  52. dustapprox-0.2.2/tests/test_grid_extended.py +366 -0
  53. dustapprox-0.2.2/tests/test_io_ecsv.py +466 -0
  54. dustapprox-0.2.2/tests/test_io_svo.py +477 -0
  55. dustapprox-0.2.2/tests/test_legacy_extinction.py +518 -0
  56. dustapprox-0.2.2/tests/test_literature.py +652 -0
  57. dustapprox-0.2.2/tests/test_models.py +473 -0
  58. dustapprox-0.2.2/tests/test_package.py +249 -0
  59. dustapprox-0.2.2/tests/test_polynomial_extended.py +400 -0
  60. dustapprox-0.2.2/tests/test_regressions.py +456 -0
  61. dustapprox-0.2.2/tests/test_tools_grid.py +428 -0
  62. dustapprox-0.1/.github/workflows/documentation.yml +0 -61
  63. dustapprox-0.1/.github/workflows/python-publish.yml +0 -37
  64. dustapprox-0.1/.github/workflows/unittests.yml +0 -27
  65. dustapprox-0.1/.gitignore +0 -133
  66. dustapprox-0.1/.vscode/settings.json +0 -14
  67. dustapprox-0.1/CITATION.cff +0 -33
  68. dustapprox-0.1/CODE_OF_CONDUCT.md +0 -44
  69. dustapprox-0.1/MANIFEST.in +0 -1
  70. dustapprox-0.1/PKG-INFO +0 -82
  71. dustapprox-0.1/docs/Makefile +0 -240
  72. dustapprox-0.1/docs/atmospheres.rst +0 -92
  73. dustapprox-0.1/docs/conf.py +0 -161
  74. dustapprox-0.1/docs/extinction.rst +0 -42
  75. dustapprox-0.1/docs/generate_precomputed_list.py +0 -43
  76. dustapprox-0.1/docs/index.rst +0 -399
  77. dustapprox-0.1/docs/make.bat +0 -35
  78. dustapprox-0.1/docs/models/Kurucz2003all/fm05at10500g40k2odfnew.fl.dat.txt +0 -1183
  79. dustapprox-0.1/docs/models/Kurucz2003all/fm05at5000g25k2odfnew.fl.dat.txt +0 -1209
  80. dustapprox-0.1/docs/models/Kurucz2003all/fm40at6000g00k2odfnew.fl.dat.txt +0 -1209
  81. dustapprox-0.1/docs/models/README +0 -1
  82. dustapprox-0.1/docs/modules.rst +0 -7
  83. dustapprox-0.1/docs/photometry.rst +0 -32
  84. dustapprox-0.1/docs/precomputed.rst +0 -200
  85. dustapprox-0.1/docs/precomputed_content.rst +0 -23
  86. dustapprox-0.1/docs/requirements.txt +0 -5
  87. dustapprox-0.1/dustapprox/__init__.py +0 -1
  88. dustapprox-0.1/dustapprox/data/precomputed/README.rst +0 -1
  89. dustapprox-0.1/dustapprox/io/__init__.py +0 -1
  90. dustapprox-0.1/dustapprox/io/ecsv.py +0 -177
  91. dustapprox-0.1/dustapprox/models/__init__.py +0 -169
  92. dustapprox-0.1/dustapprox/models/basemodel.py +0 -37
  93. dustapprox-0.1/dustapprox/models/polynomial.py +0 -535
  94. dustapprox-0.1/dustapprox/tools/__init__.py +0 -1
  95. dustapprox-0.1/dustapprox/tools/downloader.py +0 -141
  96. dustapprox-0.1/dustapprox/tools/grid.py +0 -137
  97. dustapprox-0.1/dustapprox/tools/parallel.py +0 -35
  98. dustapprox-0.1/dustapprox/version.py +0 -1
  99. dustapprox-0.1/dustapprox.egg-info/PKG-INFO +0 -82
  100. dustapprox-0.1/dustapprox.egg-info/SOURCES.txt +0 -84
  101. dustapprox-0.1/dustapprox.egg-info/not-zip-safe +0 -1
  102. dustapprox-0.1/dustapprox.egg-info/requires.txt +0 -8
  103. dustapprox-0.1/examples/Examples.ipynb +0 -1631
  104. dustapprox-0.1/pyproject.toml +0 -12
  105. dustapprox-0.1/requirements.txt +0 -8
  106. dustapprox-0.1/setup.py +0 -44
  107. dustapprox-0.1/unittests/test_quick.py +0 -15
  108. {dustapprox-0.1 → dustapprox-0.2.2}/setup.cfg +0 -0
  109. {dustapprox-0.1 → dustapprox-0.2.2/src}/dustapprox/data/Fitz19_EDR3_extinctionlawcoefficients/Fitz19_EDR3_HRDTop.csv +0 -0
  110. {dustapprox-0.1 → dustapprox-0.2.2/src}/dustapprox/data/Fitz19_EDR3_extinctionlawcoefficients/Fitz19_EDR3_MainSequence.csv +0 -0
  111. {dustapprox-0.1 → dustapprox-0.2.2/src}/dustapprox/data/Gaia2/C1B431.csv +0 -0
  112. {dustapprox-0.1 → dustapprox-0.2.2/src}/dustapprox/data/Gaia2/C1B556.csv +0 -0
  113. {dustapprox-0.1 → dustapprox-0.2.2/src}/dustapprox/data/Gaia2/C1B655.csv +0 -0
  114. {dustapprox-0.1 → dustapprox-0.2.2/src}/dustapprox/data/Gaia2/C1B768.csv +0 -0
  115. {dustapprox-0.1 → dustapprox-0.2.2/src}/dustapprox/data/Gaia2/C1B916.csv +0 -0
  116. {dustapprox-0.1 → dustapprox-0.2.2/src}/dustapprox/data/Gaia2/C1M326.csv +0 -0
  117. {dustapprox-0.1 → dustapprox-0.2.2/src}/dustapprox/data/Gaia2/C1M344.csv +0 -0
  118. {dustapprox-0.1 → dustapprox-0.2.2/src}/dustapprox/data/Gaia2/C1M379.csv +0 -0
  119. {dustapprox-0.1 → dustapprox-0.2.2/src}/dustapprox/data/Gaia2/C1M395.csv +0 -0
  120. {dustapprox-0.1 → dustapprox-0.2.2/src}/dustapprox/data/Gaia2/C1M410.csv +0 -0
  121. {dustapprox-0.1 → dustapprox-0.2.2/src}/dustapprox/data/Gaia2/C1M467.csv +0 -0
  122. {dustapprox-0.1 → dustapprox-0.2.2/src}/dustapprox/data/Gaia2/C1M506.csv +0 -0
  123. {dustapprox-0.1 → dustapprox-0.2.2/src}/dustapprox/data/Gaia2/C1M515.csv +0 -0
  124. {dustapprox-0.1 → dustapprox-0.2.2/src}/dustapprox/data/Gaia2/C1M549.csv +0 -0
  125. {dustapprox-0.1 → dustapprox-0.2.2/src}/dustapprox/data/Gaia2/C1M656.csv +0 -0
  126. {dustapprox-0.1 → dustapprox-0.2.2/src}/dustapprox/data/Gaia2/C1M716.csv +0 -0
  127. {dustapprox-0.1 → dustapprox-0.2.2/src}/dustapprox/data/Gaia2/C1M747.csv +0 -0
  128. {dustapprox-0.1 → dustapprox-0.2.2/src}/dustapprox/data/Gaia2/C1M825.csv +0 -0
  129. {dustapprox-0.1 → dustapprox-0.2.2/src}/dustapprox/data/Gaia2/C1M861.csv +0 -0
  130. {dustapprox-0.1 → dustapprox-0.2.2/src}/dustapprox/data/Gaia2/C1M965.csv +0 -0
  131. /dustapprox-0.1/docs/models/precomputed/kurucs_gaiaedr3_small_a0_grid.csv → /dustapprox-0.2.2/src/dustapprox/data/precomputed/grids/kurucz_gaiaedr3_small_a0_grid.csv +0 -0
  132. {dustapprox-0.1 → dustapprox-0.2.2/src}/dustapprox/data/precomputed/polynomial/f99/kurucz/2mass_kurucz_f99_a0_teff.ecsv +0 -0
  133. {dustapprox-0.1 → dustapprox-0.2.2/src}/dustapprox/data/precomputed/polynomial/f99/kurucz/gaia_kurucz_f99_a0_teff.ecsv +0 -0
  134. {dustapprox-0.1 → dustapprox-0.2.2/src}/dustapprox/data/precomputed/polynomial/f99/kurucz/gaiac1_kurucz_f99_a0_teff.ecsv +0 -0
  135. {dustapprox-0.1 → dustapprox-0.2.2/src}/dustapprox/data/precomputed/polynomial/f99/kurucz/galex_kurucz_f99_a0_teff.ecsv +0 -0
  136. {dustapprox-0.1 → dustapprox-0.2.2/src}/dustapprox/data/precomputed/polynomial/f99/kurucz/generic_kurucz_f99_a0_teff.ecsv +0 -0
  137. {dustapprox-0.1 → dustapprox-0.2.2/src}/dustapprox/data/precomputed/polynomial/f99/kurucz/sloan_kurucz_f99_a0_teff.ecsv +0 -0
  138. {dustapprox-0.1 → dustapprox-0.2.2/src}/dustapprox/data/precomputed/polynomial/f99/kurucz/wise_kurucz_f99_a0_teff.ecsv +0 -0
  139. {dustapprox-0.1 → dustapprox-0.2.2/src}/dustapprox.egg-info/dependency_links.txt +0 -0
  140. {dustapprox-0.1 → dustapprox-0.2.2/src}/dustapprox.egg-info/top_level.txt +0 -0
@@ -26,4 +26,4 @@ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
26
  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
27
  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
28
  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1 @@
1
+ include README.rst LICENSE
@@ -0,0 +1,129 @@
1
+ Metadata-Version: 2.4
2
+ Name: dustapprox
3
+ Version: 0.2.2
4
+ Summary: A tool for computing extinction coefficients in a quick and dirty manner
5
+ Author: Morgan Fouesneau, René Andrae, Rosanna Sordo, Thavisha Dharmawardena
6
+ License: BSD 3-Clause License
7
+ Classifier: Programming Language :: Python :: 3.11
8
+ Classifier: Programming Language :: Python :: 3.12
9
+ Classifier: Programming Language :: Python :: 3.13
10
+ Classifier: License :: OSI Approved :: BSD License
11
+ Classifier: Operating System :: OS Independent
12
+ Requires-Python: >=3.11
13
+ Description-Content-Type: text/x-rst
14
+ License-File: LICENSE
15
+ Requires-Dist: astropy>=6.0.0
16
+ Requires-Dist: dust-extinction>=1.6
17
+ Requires-Dist: ipywidgets>=8.1.7
18
+ Requires-Dist: joblib>=1.5.2
19
+ Requires-Dist: matplotlib>=3.10.7
20
+ Requires-Dist: numpy>=2.0.0
21
+ Requires-Dist: pandas>=2.3.3
22
+ Requires-Dist: pyphot>=2.0.0
23
+ Requires-Dist: pyyaml>=6.0.3
24
+ Requires-Dist: scikit-learn>=1.7.2
25
+ Requires-Dist: scipy>=1.14.0
26
+ Requires-Dist: snakemake>=7.32.4
27
+ Requires-Dist: tqdm>=4.67.1
28
+ Provides-Extra: ci
29
+ Requires-Dist: ruff; extra == "ci"
30
+ Requires-Dist: pytest>=7; extra == "ci"
31
+ Requires-Dist: pytest-doctestplus; extra == "ci"
32
+ Requires-Dist: codecov; extra == "ci"
33
+ Requires-Dist: pytest-cov; extra == "ci"
34
+ Requires-Dist: prek; extra == "ci"
35
+ Provides-Extra: docs
36
+ Requires-Dist: sphinx>=5.3; extra == "docs"
37
+ Requires-Dist: sphinx-book-theme>=0.3.3; extra == "docs"
38
+ Requires-Dist: sphinx-automodapi>=0.14; extra == "docs"
39
+ Requires-Dist: sphinx_copybutton>=0.5; extra == "docs"
40
+ Requires-Dist: sphinx-mdinclude>=0.6; extra == "docs"
41
+ Requires-Dist: sphinxcontrib-htmlhelp>=2.1.0; extra == "docs"
42
+ Requires-Dist: sphinxcontrib-serializinghtml>=2.0.0; extra == "docs"
43
+ Requires-Dist: sphinx-tabs>=3.0; extra == "docs"
44
+ Requires-Dist: myst-nb>=0.16.0; extra == "docs"
45
+ Requires-Dist: sphinx-design>=0.6; extra == "docs"
46
+ Requires-Dist: IPython>=8.0; extra == "docs"
47
+ Requires-Dist: matplotlib; extra == "docs"
48
+ Requires-Dist: numpydoc; extra == "docs"
49
+ Requires-Dist: sphinx-datatables>=0.3.1; extra == "docs"
50
+ Dynamic: license-file
51
+
52
+ dustapprox -- A tool for computing approximative extinction coefficients
53
+ ========================================================================
54
+
55
+ .. image:: https://img.shields.io/pypi/v/dustapprox.svg
56
+ :target: https://pypi.org/project/dustapprox/
57
+
58
+ .. image:: https://img.shields.io/badge/python-3.11,_3.12,_3.13,_3.14-blue.svg
59
+
60
+ This is a set of tools to compute photometric extinction coefficients in a *quick and dirty* way.
61
+
62
+ full documentation at: http://mfouesneau.github.io/dustapprox/
63
+
64
+ see recent changes at: `What's new <http://mfouesneau.github.io/dustapprox/whats_new.html>`_
65
+
66
+
67
+ Quick Start
68
+ -----------
69
+
70
+ .. code-block:: python
71
+
72
+ import pandas as pd
73
+ from dustapprox import models
74
+ from dustapprox.literature import edr3
75
+ import pylab as plt
76
+
77
+ # get Gaia models
78
+ lib = models.PrecomputedModel()
79
+ r = lib.find(passband='Gaia')[0] # taking the first one
80
+ model = lib.load_model(r, passband='GAIA_GAIA3.G')
81
+
82
+ # get some data
83
+ data = pd.read_csv('models/precomputed/kurucz_gaiaedr3_small_a0_grid.csv')
84
+ df = data[(data['passband'] == 'GAIA_GAIA3.G') & (data['A0'] > 0)]
85
+
86
+ # values
87
+ kg_pred = model.predict(df)
88
+
89
+ Installation
90
+ ------------
91
+ * Installation from PyPI
92
+
93
+ .. code::
94
+
95
+ pip install dustapprox
96
+
97
+ * Installation from pip+github
98
+
99
+ .. code::
100
+
101
+ pip install git+https://github.com/mfouesneau/dustapprox
102
+
103
+ * Manual installation
104
+
105
+ download the repository and run the setup
106
+
107
+ .. code::
108
+
109
+ git clone https://github.com/mfouesneau/dustapprox
110
+ python -m pip install .
111
+
112
+ Contributors
113
+ ------------
114
+
115
+ - Morgan Fouesneau (@mfouesneau)
116
+ - René Andrae
117
+ - Rosanna Sordo
118
+ - Thavisha Dharmawardena
119
+
120
+
121
+ Contributing
122
+ ------------
123
+
124
+ Please open a new issue or new pull request for bugs, feedback, or new features
125
+ you would like to see. If there is an issue you would like to work on, please
126
+ leave a comment, and we will be happy to assist. New contributions and
127
+ contributors are very welcome!
128
+
129
+ see `contributing guide <http://mfouesneau.github.io/dustapprox/contributing.html>`_ for more information.
@@ -1,10 +1,17 @@
1
1
  dustapprox -- A tool for computing approximative extinction coefficients
2
- =============================================================================
2
+ ========================================================================
3
+
4
+ .. image:: https://img.shields.io/pypi/v/dustapprox.svg
5
+ :target: https://pypi.org/project/dustapprox/
6
+
7
+ .. image:: https://img.shields.io/badge/python-3.11,_3.12,_3.13,_3.14-blue.svg
3
8
 
4
9
  This is a set of tools to compute photometric extinction coefficients in a *quick and dirty* way.
5
10
 
6
11
  full documentation at: http://mfouesneau.github.io/dustapprox/
7
12
 
13
+ see recent changes at: `What's new <http://mfouesneau.github.io/dustapprox/whats_new.html>`_
14
+
8
15
 
9
16
  Quick Start
10
17
  -----------
@@ -22,7 +29,7 @@ Quick Start
22
29
  model = lib.load_model(r, passband='GAIA_GAIA3.G')
23
30
 
24
31
  # get some data
25
- data = pd.read_csv('models/precomputed/kurucs_gaiaedr3_small_a0_grid.csv')
32
+ data = pd.read_csv('models/precomputed/kurucz_gaiaedr3_small_a0_grid.csv')
26
33
  df = data[(data['passband'] == 'GAIA_GAIA3.G') & (data['A0'] > 0)]
27
34
 
28
35
  # values
@@ -34,7 +41,13 @@ Installation
34
41
 
35
42
  .. code::
36
43
 
37
- pip install git+https://github.com/mfouesneau/gdr3_extinction
44
+ pip install dustapprox
45
+
46
+ * Installation from pip+github
47
+
48
+ .. code::
49
+
50
+ pip install git+https://github.com/mfouesneau/dustapprox
38
51
 
39
52
  * Manual installation
40
53
 
@@ -42,8 +55,8 @@ download the repository and run the setup
42
55
 
43
56
  .. code::
44
57
 
45
- git clone https://github.com/mfouesneau/gdr3_extinction
46
- python setup.py install
58
+ git clone https://github.com/mfouesneau/dustapprox
59
+ python -m pip install .
47
60
 
48
61
  Contributors
49
62
  ------------
@@ -61,3 +74,5 @@ Please open a new issue or new pull request for bugs, feedback, or new features
61
74
  you would like to see. If there is an issue you would like to work on, please
62
75
  leave a comment, and we will be happy to assist. New contributions and
63
76
  contributors are very welcome!
77
+
78
+ see `contributing guide <http://mfouesneau.github.io/dustapprox/contributing.html>`_ for more information.
@@ -0,0 +1,173 @@
1
+ [project]
2
+ name = "dustapprox"
3
+ version = "0.2.2"
4
+ description = "A tool for computing extinction coefficients in a quick and dirty manner"
5
+ readme = "README.rst"
6
+ authors = [
7
+ {name="Morgan Fouesneau"},
8
+ {name="René Andrae"},
9
+ {name="Rosanna Sordo"},
10
+ {name="Thavisha Dharmawardena"}
11
+ ]
12
+ license = {text = "BSD 3-Clause License"}
13
+ classifiers = [
14
+ "Programming Language :: Python :: 3.11",
15
+ "Programming Language :: Python :: 3.12",
16
+ "Programming Language :: Python :: 3.13",
17
+ "License :: OSI Approved :: BSD License",
18
+ "Operating System :: OS Independent"
19
+ ]
20
+ requires-python = ">=3.11"
21
+ dependencies = [
22
+ "astropy>=6.0.0",
23
+ "dust-extinction>=1.6",
24
+ "ipywidgets>=8.1.7",
25
+ "joblib>=1.5.2",
26
+ "matplotlib>=3.10.7",
27
+ "numpy>=2.0.0",
28
+ "pandas>=2.3.3",
29
+ "pyphot >= 2.0.0",
30
+ "pyyaml>=6.0.3",
31
+ "scikit-learn>=1.7.2",
32
+ "scipy>=1.14.0",
33
+ "snakemake>=7.32.4",
34
+ "tqdm>=4.67.1",
35
+ ]
36
+
37
+ [build-system]
38
+ requires = ["setuptools>=60",
39
+ "wheel",
40
+ ]
41
+ build-backend = "setuptools.build_meta"
42
+
43
+ [tool.setuptools]
44
+ # By default, include-package-data is true in pyproject.toml, so you do
45
+ # NOT have to specify this line.
46
+ include-package-data = true
47
+
48
+ [tool.setuptools.packages.find]
49
+ where = ["src"] # list of folders that contain the packages (["."] by default)
50
+ include = ["dustapprox*"] # package names should match these glob patterns (["*"] by default)
51
+ exclude = ["unittests*", "tests*"] # exclude packages matching these glob patterns (empty by default)
52
+ namespaces = true # to disable scanning PEP 420 namespaces (true by default)
53
+
54
+ [tool.setuptools.package-data]
55
+ dustapprox = ['*.ecsv', '*.csv', '*.rst', 'data/**/*']
56
+
57
+ [project.optional-dependencies]
58
+
59
+ ci = [
60
+ "ruff",
61
+ "pytest>=7",
62
+ "pytest-doctestplus",
63
+ "codecov",
64
+ "pytest-cov",
65
+ "prek"]
66
+
67
+ docs = [
68
+ "sphinx>=5.3",
69
+ "sphinx-book-theme>=0.3.3",
70
+ "sphinx-automodapi>=0.14",
71
+ "sphinx_copybutton>=0.5",
72
+ "sphinx-mdinclude>=0.6",
73
+ "sphinxcontrib-htmlhelp>=2.1.0",
74
+ "sphinxcontrib-serializinghtml>=2.0.0",
75
+ "sphinx-tabs>=3.0",
76
+ "myst-nb>=0.16.0",
77
+ "sphinx-design>=0.6",
78
+ "IPython>=8.0",
79
+ "matplotlib",
80
+ "numpydoc",
81
+ "sphinx-datatables>=0.3.1",
82
+ ]
83
+
84
+ [tool.ruff]
85
+ # Enumerate all fixed violations.
86
+ show-fixes = true
87
+ # Always generate Python 3.11-compatible code.
88
+ target-version = "py311"
89
+ # PEP-8 line length
90
+ line-length = 79
91
+ # Exclude a variety of commonly ignored directories.
92
+ exclude = [
93
+ ".direnv",
94
+ ".eggs",
95
+ ".git",
96
+ ".ipynb_checkpoints",
97
+ ".mypy_cache",
98
+ ".nox",
99
+ ".pyenv",
100
+ ".pytest_cache",
101
+ ".ruff_cache",
102
+ ".tox",
103
+ ".venv",
104
+ ".vscode",
105
+ "__pypackages__",
106
+ ".DS_Store",
107
+ "_build",
108
+ "build",
109
+ "dist",
110
+ "site-packages",
111
+ "venv",
112
+ ".pre-commit-config.yaml",
113
+ "src/dustapprox/data/**"
114
+ ]
115
+
116
+ [tool.ruff.format]
117
+ # Enable reformatting of code snippets in docstrings.
118
+ docstring-code-format = true
119
+ # use double quotes for strings.
120
+ quote-style = "double"
121
+
122
+ [tool.ruff.lint]
123
+ # Allow fix for all enabled rules (when `--fix`) is provided.
124
+ fixable = ["ALL"]
125
+ unfixable = []
126
+
127
+
128
+ [tool.ruff.lint.pydocstyle]
129
+ convention = "numpy"
130
+
131
+ [tool.pytest.ini_options]
132
+ minversion = "7.0"
133
+ testpaths = ["tests"]
134
+ python_files = ["test_*.py"]
135
+ python_classes = ["Test*"]
136
+ python_functions = ["test_*"]
137
+ addopts = [
138
+ "-v",
139
+ "--strict-markers",
140
+ "--tb=short",
141
+ ]
142
+ markers = [
143
+ "slow: marks tests as slow (deselect with '-m \"not slow\"')",
144
+ "integration: marks tests as integration tests",
145
+ "unit: marks tests as unit tests",
146
+ "requires_network: marks tests that require network access",
147
+ "requires_data: marks tests that require external data files",
148
+ ]
149
+ filterwarnings = [
150
+ "ignore::DeprecationWarning",
151
+ "ignore::PendingDeprecationWarning",
152
+ ]
153
+
154
+ [tool.coverage.run]
155
+ source = ["src/dustapprox"]
156
+ omit = [
157
+ "*/tests/*",
158
+ "*/test_*.py",
159
+ "*/__pycache__/*",
160
+ "*/version.py",
161
+ ]
162
+
163
+ [tool.coverage.report]
164
+ exclude_lines = [
165
+ "pragma: no cover",
166
+ "def __repr__",
167
+ "raise AssertionError",
168
+ "raise NotImplementedError",
169
+ "if __name__ == .__main__.:",
170
+ "if TYPE_CHECKING:",
171
+ "@abstractmethod",
172
+ "import",
173
+ ]
@@ -0,0 +1,3 @@
1
+ from .version import __VERSION__
2
+
3
+ __all__ = ["__VERSION__"]
@@ -0,0 +1,87 @@
1
+ """
2
+ Declare missing photometric and spectral units for use with astropy.
3
+ """
4
+
5
+ from typing import Any, Union
6
+ import warnings
7
+
8
+ from astropy.units import Unit, def_unit, add_enabled_units
9
+ from astropy.units import Quantity
10
+ from astropy.units.core import Unit as U
11
+
12
+ __all__ = ["Unit", "Quantity", "has_unit", "val_in_unit", "U"]
13
+
14
+ new_units = dict(
15
+ flam="erg * s ** (-1) * AA ** (-1) * cm **(-2)",
16
+ fnu="erg * s ** (-1) * Hz ** (-1) * cm **(-2)",
17
+ photflam="photon * s ** (-1) * AA ** (-1) * cm **(-2)",
18
+ photfnu="photon * s ** (-1) * Hz ** (-1) * cm **(-2)",
19
+ angstroms="angstrom",
20
+ lsun="Lsun",
21
+ ergs="erg",
22
+ )
23
+
24
+ add_enabled_units(
25
+ [def_unit([k], Unit(v)) for k, v in new_units.items()]
26
+ ).__enter__()
27
+
28
+
29
+ def _warning_on_one_line(
30
+ message: str,
31
+ category: Any,
32
+ filename: str,
33
+ lineno: int,
34
+ file=None,
35
+ line=None,
36
+ ) -> str:
37
+ """Prints a complete warning that includes exactly the code line triggering it from the stack trace."""
38
+ return " {:s}:{:d} {:s}:{:s}".format(
39
+ filename, lineno, category.__name__, str(message)
40
+ )
41
+
42
+
43
+ def has_unit(val: Any) -> bool:
44
+ """Check if a unit is defined in astropy."""
45
+ return hasattr(val, "units") or hasattr(val, "unit")
46
+
47
+
48
+ def val_in_unit(
49
+ varname: str,
50
+ value: Union[Any, Quantity],
51
+ defaultunit: str,
52
+ ) -> Quantity:
53
+ """check units and convert to defaultunit or create the unit information
54
+
55
+ Parameters
56
+ ----------
57
+ varname: str
58
+ name of the variable
59
+ value: object
60
+ value of the variable, which may be unitless
61
+ defaultunit: str
62
+ default units is unitless
63
+
64
+ Returns
65
+ -------
66
+ quantity: Quantity
67
+ value with units
68
+
69
+ Example
70
+ -------
71
+ >>> r = 0.5
72
+ >>> print(val_in_unit("r", r, "degree"))
73
+ # UserWarning: Variable r does not have explicit units. Assuming `degree`
74
+ <Quantity(0.5, 'degree')>
75
+ >>> r = 0.5 * unit["degree"]
76
+ >>> print(val_in_unit("r", r, "degree"))
77
+ <Quantity(0.5, 'degree')>
78
+ """
79
+
80
+ if not has_unit(value):
81
+ warnings.formatwarning = _warning_on_one_line
82
+ msg = "Variable {0:s} does not have explicit units. Assuming `{1:s}`\n"
83
+ # stacklevel makes the correct code reference
84
+ warnings.warn(msg.format(varname, defaultunit), stacklevel=4)
85
+ return value * U(defaultunit)
86
+ else:
87
+ return value.to(defaultunit)
@@ -0,0 +1,5 @@
1
+ # EDR3 extinction coefficients from Riello et al. (2020)
2
+
3
+ see :mod:`dustapprox.literature.edr3`.
4
+
5
+ Data and equations taken from: https://www.cosmos.esa.int/web/gaia/edr3-extinction-law
@@ -0,0 +1,5 @@
1
+ # C1 passbands transmission curves
2
+
3
+ The C1 passbands are available from Jordi et al., 2006.
4
+
5
+ For convenience, we also provide them with this package in dustapprox/data/Gaia2 directory in the pyphot ascii format.
@@ -0,0 +1,50 @@
1
+ # %ECSV 1.0
2
+ # ---
3
+ # delimiter: ','
4
+ # datatype:
5
+ # - name: X
6
+ # datatype: string
7
+ # - name: alpha
8
+ # datatype: float64
9
+ # - name: beta_1
10
+ # datatype: float64
11
+ # - name: beta_2
12
+ # datatype: float64
13
+ # - name: beta_3
14
+ # datatype: float64
15
+ # - name: beta_4
16
+ # datatype: float64
17
+ # - name: gamma_1
18
+ # datatype: float64
19
+ # - name: gamma_2
20
+ # datatype: float64
21
+ # - name: gamma_3
22
+ # datatype: float64
23
+ # - name: delta
24
+ # datatype: float64
25
+ # meta:
26
+ # description: Coefficients of A_X/A_G = alpha + sum_i beta_i (BP-RP)^i + sum_j gamma_j
27
+ # A_G^j + delta (BP-RP) A_G for the Gaia C1 passbands
28
+ # reference: Gaia Collaboration, Montegriffo, Bellazzini et al. 2023, A&A 674, A33
29
+ # (arXiv:2206.06215), Appendix E, Table E.1
30
+ # model: BTSettl SEDs, Fitzpatrick extinction curve
31
+ X,alpha,beta_1,beta_2,beta_3,beta_4,gamma_1,gamma_2,gamma_3,delta
32
+ C1M326,1.710,0.237,0.0131,-0.00325,0.000131,-0.0631,0.000303,-0.0000476,-0.000302
33
+ C1M379,1.533,0.257,0.00999,-0.00315,0.000134,-0.0736,-0.0000418,-0.0000625,0.00168
34
+ C1M395,1.492,0.249,0.00892,-0.00291,0.000124,-0.0716,0.000463,-0.0000892,0.00141
35
+ C1M410,1.442,0.241,0.00985,-0.00301,0.000127,-0.0686,-0.000266,-0.0000432,0.00158
36
+ C1M467,1.233,0.207,0.00768,-0.00251,0.000107,-0.0582,-0.000239,-0.0000369,0.00147
37
+ C1M506,1.117,0.0187,0.00745,-0.00229,0.0000981,-0.0550,0.000577,-0.0000748,0.000623
38
+ C1M515,1.089,0.183,0.00658,-0.00213,0.0000905,-0.0516,0.0000669,-0.0000440,0.000948
39
+ C1M549,1.009,0.169,0.00671,-0.00206,0.0000868,-0.0474,-0.000147,-0.0000277,0.000899
40
+ C1M656,0.825,0.139,0.00519,-0.00167,0.0000708,-0.0412,0.000448,-0.0000675,0.000898
41
+ C1M716,0.733,0.122,0.00438,-0.00143,0.0000614,-0.0363,0.000402,-0.0000608,0.000821
42
+ C1M747,0.683,0.114,0.00438,-0.00137,0.0000583,-0.0336,0.000407,-0.0000535,0.000515
43
+ C1M825,0.567,0.0953,0.00359,-0.00116,0.0000490,-0.0266,-0.000234,-0.00000838,0.000698
44
+ C1M861,0.523,0.0878,0.00310,-0.00105,0.0000449,-0.0264,0.000364,-0.0000513,0.000672
45
+ C1M965,0.433,0.0723,0.00259,-0.000885,0.0000380,-0.0218,0.000238,-0.0000400,0.000679
46
+ C1B431,1.367,0.183,0.0126,-0.00260,0.000101,-0.0486,0.00117,-0.0000154,-0.00372
47
+ C1B556,1.011,0.151,0.00628,-0.00167,0.0000678,-0.0423,0.00116,-0.0000564,-0.00157
48
+ C1B655,0.828,0.138,0.00458,-0.00166,0.0000711,-0.0393,-0.000192,-0.0000291,0.00138
49
+ C1B768,0.661,0.106,0.000155,-0.00101,0.0000480,-0.0306,-0.000148,-0.0000417,0.00226
50
+ C1B916,0.473,0.0789,0.00239,-0.000900,0.0000390,-0.0235,0.000268,-0.0000409,0.000657
@@ -0,0 +1 @@
1
+ Precomputed models per model kind.
@@ -0,0 +1,5 @@
1
+ Photometric grids for dustapprox
2
+ =================================
3
+
4
+ This directory only contains a small example of precomputed grids for the
5
+ dustapprox package. The full grids can be computed using the workflow provided in the documentation.
@@ -0,0 +1,91 @@
1
+ # %ECSV 1.0
2
+ # ---
3
+ # delimiter: ','
4
+ # datatype:
5
+ # - name: passband
6
+ # datatype: object
7
+ # - name: '1'
8
+ # datatype: float64
9
+ # - name: A0
10
+ # datatype: float64
11
+ # - name: R0
12
+ # datatype: float64
13
+ # - name: teffnorm
14
+ # datatype: float64
15
+ # - name: A0^2
16
+ # datatype: float64
17
+ # - name: A0 R0
18
+ # datatype: float64
19
+ # - name: A0 teffnorm
20
+ # datatype: float64
21
+ # - name: R0^2
22
+ # datatype: float64
23
+ # - name: R0 teffnorm
24
+ # datatype: float64
25
+ # - name: teffnorm^2
26
+ # datatype: float64
27
+ # - name: A0^3
28
+ # datatype: float64
29
+ # - name: A0^2 R0
30
+ # datatype: float64
31
+ # - name: A0^2 teffnorm
32
+ # datatype: float64
33
+ # - name: A0 R0^2
34
+ # datatype: float64
35
+ # - name: A0 R0 teffnorm
36
+ # datatype: float64
37
+ # - name: A0 teffnorm^2
38
+ # datatype: float64
39
+ # - name: R0^3
40
+ # datatype: float64
41
+ # - name: R0^2 teffnorm
42
+ # datatype: float64
43
+ # - name: R0 teffnorm^2
44
+ # datatype: float64
45
+ # - name: teffnorm^3
46
+ # datatype: float64
47
+ # - name: mae
48
+ # datatype: float64
49
+ # - name: rmse
50
+ # datatype: float64
51
+ # - name: mean_residuals
52
+ # datatype: float64
53
+ # - name: std_residuals
54
+ # datatype: float64
55
+ # meta:
56
+ # extinction:
57
+ # source: G23
58
+ # R0:
59
+ # - 2.299999952316284
60
+ # - 5.099999904632568
61
+ # A0:
62
+ # - 0.009999999776482582
63
+ # - 20.0
64
+ # atmosphere:
65
+ # source: Kurucz (ODFNEW/NOVER 2003)
66
+ # teff:
67
+ # - 3500.0
68
+ # - 50000.0
69
+ # logg:
70
+ # - 0.0
71
+ # - 5.0
72
+ # feh:
73
+ # - -4.0
74
+ # - 0.5
75
+ # alpha:
76
+ # - 0.0
77
+ # - 0.4
78
+ # comment: teffnorm = teff / 5040; predicts kx = Ax / A0
79
+ # model:
80
+ # kind: polynomial
81
+ # degree: 3
82
+ # interaction_only: false
83
+ # include_bias: true
84
+ # feature_names:
85
+ # - A0
86
+ # - R0
87
+ # - teffnorm
88
+ passband,1,A0,R0,teffnorm,A0^2,A0 R0,A0 teffnorm,R0^2,R0 teffnorm,teffnorm^2,A0^3,A0^2 R0,A0^2 teffnorm,A0 R0^2,A0 R0 teffnorm,A0 teffnorm^2,R0^3,R0^2 teffnorm,R0 teffnorm^2,teffnorm^3,mae,rmse,mean_residuals,std_residuals
89
+ GAIA_GAIA3.G,0.286818848093288,-0.058327272834348964,0.2722043807041391,0.21605162945096584,0.0020213034644503015,0.012792211189743647,-0.005605300749636407,-0.06053151790704727,-0.011031980023020908,-0.03084912784145091,-2.100200067370849e-05,-0.00025134840561963205,4.5910753422654715e-05,-0.0007470752378828345,0.0002643940830614129,0.0003118589853233947,0.00463475187905928,0.0003352151356913553,0.0004835500942913408,0.0014801521653655734,0.009901413952776217,0.017936147451579683,-2.3303860394939563e-12,0.017936147451579683
90
+ GAIA_GAIA3.Gbp,0.9745711671844719,-0.0406363662355236,0.008547579294604623,0.1534629518814823,0.0012808373914858912,0.010168418439270173,-0.003846488801332009,-0.009596743195860333,-0.009884255507048056,-0.021120735478628024,-1.0399864186580088e-05,-0.0001912125618798879,2.986202943212149e-05,-0.0006174571144299244,0.00023952161974882276,0.00019064994645402253,0.0010870406004608035,0.00027339763906189524,0.000447321676027947,0.001001371700656978,0.007470538844783492,0.011939609617010623,6.4916981449661e-14,0.011939609617010623
91
+ GAIA_GAIA3.Grp,-0.035041401153822656,-0.014784460973871438,0.3786615528621297,0.04786759796755482,0.00017654407409218944,0.003620660140262055,-0.0004188313517579791,-0.07377197498538111,-0.0025874890963681835,-0.007481406943362968,9.800003374681028e-07,-3.516512556672179e-05,-2.4622897304317055e-06,-0.00027732864144338926,2.9889108822228177e-05,3.181008708417409e-05,0.005220255804663166,0.00010532597839968115,0.00012306730431124515,0.00038170399689903826,0.002989726608845833,0.005337647178928007,6.072810937434298e-14,0.005337647178928007