PyDIET 0.9.3__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 (180) hide show
  1. pydiet-0.9.3/LICENSE +21 -0
  2. pydiet-0.9.3/PKG-INFO +118 -0
  3. pydiet-0.9.3/README.md +52 -0
  4. pydiet-0.9.3/pyproject.toml +119 -0
  5. pydiet-0.9.3/src/pydiet/__init__.py +12 -0
  6. pydiet-0.9.3/src/pydiet/api_client/__init__.py +6 -0
  7. pydiet-0.9.3/src/pydiet/api_client/client.py +57 -0
  8. pydiet-0.9.3/src/pydiet/cmd/__init__.py +9 -0
  9. pydiet-0.9.3/src/pydiet/cmd/start.py +107 -0
  10. pydiet-0.9.3/src/pydiet/data/data_config.toml +242 -0
  11. pydiet-0.9.3/src/pydiet/data/description.txt +1 -0
  12. pydiet-0.9.3/src/pydiet/data/instruments/description.txt +1 -0
  13. pydiet-0.9.3/src/pydiet/data/instruments/megacam/default +0 -0
  14. pydiet-0.9.3/src/pydiet/data/instruments/megacam/description.txt +1 -0
  15. pydiet-0.9.3/src/pydiet/data/instruments/megacam/detector/description.txt +1 -0
  16. pydiet-0.9.3/src/pydiet/data/instruments/megacam/detector/qe/MegaCam_QE.average.fits +0 -0
  17. pydiet-0.9.3/src/pydiet/data/instruments/megacam/detector/qe/description.txt +2 -0
  18. pydiet-0.9.3/src/pydiet/data/instruments/megacam/filters/CaHK.MP9303.fits +0 -0
  19. pydiet-0.9.3/src/pydiet/data/instruments/megacam/filters/Ha.MP9603.fits +0 -0
  20. pydiet-0.9.3/src/pydiet/data/instruments/megacam/filters/HaOFF.MP9604.fits +0 -0
  21. pydiet-0.9.3/src/pydiet/data/instruments/megacam/filters/M4112.MP9403.fits +0 -0
  22. pydiet-0.9.3/src/pydiet/data/instruments/megacam/filters/M4376.MP9404.fits +0 -0
  23. pydiet-0.9.3/src/pydiet/data/instruments/megacam/filters/OIII.MP9501.fits +0 -0
  24. pydiet-0.9.3/src/pydiet/data/instruments/megacam/filters/OIIIOFF.MP9502.fits +0 -0
  25. pydiet-0.9.3/src/pydiet/data/instruments/megacam/filters/description.txt +1 -0
  26. pydiet-0.9.3/src/pydiet/data/instruments/megacam/filters/g.MP9402.fits +0 -0
  27. pydiet-0.9.3/src/pydiet/data/instruments/megacam/filters/gri.MP9605.fits +0 -0
  28. pydiet-0.9.3/src/pydiet/data/instruments/megacam/filters/i.MP9703.fits +0 -0
  29. pydiet-0.9.3/src/pydiet/data/instruments/megacam/filters/r.MP9602.fits +0 -0
  30. pydiet-0.9.3/src/pydiet/data/instruments/megacam/filters/u.MP9302.fits +0 -0
  31. pydiet-0.9.3/src/pydiet/data/instruments/megacam/filters/z.MP9901.fits +0 -0
  32. pydiet-0.9.3/src/pydiet/data/instruments/megacam/optics/description.txt +2 -0
  33. pydiet-0.9.3/src/pydiet/data/instruments/megacam/optics/transmission/MegaPrime_transmission.fits +0 -0
  34. pydiet-0.9.3/src/pydiet/data/instruments/megacam/optics/transmission/description.txt +2 -0
  35. pydiet-0.9.3/src/pydiet/data/instruments/wircam/description.txt +1 -0
  36. pydiet-0.9.3/src/pydiet/data/instruments/wircam/detector/description.txt +1 -0
  37. pydiet-0.9.3/src/pydiet/data/instruments/wircam/detector/qe/WIRCam_QE.average.fits +0 -0
  38. pydiet-0.9.3/src/pydiet/data/instruments/wircam/detector/qe/description.txt +2 -0
  39. pydiet-0.9.3/src/pydiet/data/instruments/wircam/filters/BrG.WC8305.fits +0 -0
  40. pydiet-0.9.3/src/pydiet/data/instruments/wircam/filters/CH4Off.WC8204.fits +0 -0
  41. pydiet-0.9.3/src/pydiet/data/instruments/wircam/filters/CH4On.WC8203.fits +0 -0
  42. pydiet-0.9.3/src/pydiet/data/instruments/wircam/filters/CO.WC8306.fits +0 -0
  43. pydiet-0.9.3/src/pydiet/data/instruments/wircam/filters/H.WC8201.fits +0 -0
  44. pydiet-0.9.3/src/pydiet/data/instruments/wircam/filters/H.WC8202.fits +0 -0
  45. pydiet-0.9.3/src/pydiet/data/instruments/wircam/filters/H2.WC8304.fits +0 -0
  46. pydiet-0.9.3/src/pydiet/data/instruments/wircam/filters/J.WC8101.fits +0 -0
  47. pydiet-0.9.3/src/pydiet/data/instruments/wircam/filters/J.WC8103.fits +0 -0
  48. pydiet-0.9.3/src/pydiet/data/instruments/wircam/filters/Kcont.WC8303.fits +0 -0
  49. pydiet-0.9.3/src/pydiet/data/instruments/wircam/filters/Ks.WC8301.fits +0 -0
  50. pydiet-0.9.3/src/pydiet/data/instruments/wircam/filters/Ks.WC8302.fits +0 -0
  51. pydiet-0.9.3/src/pydiet/data/instruments/wircam/filters/LowOH1.WC8104.fits +0 -0
  52. pydiet-0.9.3/src/pydiet/data/instruments/wircam/filters/LowOH2.WC8102.fits +0 -0
  53. pydiet-0.9.3/src/pydiet/data/instruments/wircam/filters/W.WC8105.fits +0 -0
  54. pydiet-0.9.3/src/pydiet/data/instruments/wircam/filters/Y.WC8002.fits +0 -0
  55. pydiet-0.9.3/src/pydiet/data/instruments/wircam/filters/description.txt +1 -0
  56. pydiet-0.9.3/src/pydiet/data/instruments/wircam/optics/description.txt +2 -0
  57. pydiet-0.9.3/src/pydiet/data/instruments/wircam/optics/transmission/WIRCam_transmission.fits +0 -0
  58. pydiet-0.9.3/src/pydiet/data/instruments/wircam/optics/transmission/description.txt +2 -0
  59. pydiet-0.9.3/src/pydiet/data/sites/description.txt +1 -0
  60. pydiet-0.9.3/src/pydiet/data/sites/mko/default +0 -0
  61. pydiet-0.9.3/src/pydiet/data/sites/mko/description.txt +2 -0
  62. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.bright.AM1.0.fits +0 -0
  63. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.bright.AM1.1.fits +0 -0
  64. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.bright.AM1.2.fits +0 -0
  65. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.bright.AM1.3.fits +0 -0
  66. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.bright.AM1.4.fits +0 -0
  67. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.bright.AM1.5.fits +0 -0
  68. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.bright.AM1.6.fits +0 -0
  69. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.bright.AM1.7.fits +0 -0
  70. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.bright.AM1.8.fits +0 -0
  71. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.bright.AM1.9.fits +0 -0
  72. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.bright.AM2.0.fits +0 -0
  73. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.bright.AM2.5.fits +0 -0
  74. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.bright.AM3.0.fits +0 -0
  75. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.dark.AM1.0.fits +0 -0
  76. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.dark.AM1.1.fits +0 -0
  77. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.dark.AM1.2.fits +0 -0
  78. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.dark.AM1.3.fits +0 -0
  79. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.dark.AM1.4.fits +0 -0
  80. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.dark.AM1.5.fits +0 -0
  81. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.dark.AM1.6.fits +0 -0
  82. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.dark.AM1.7.fits +0 -0
  83. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.dark.AM1.8.fits +0 -0
  84. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.dark.AM1.9.fits +0 -0
  85. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.dark.AM2.0.fits +0 -0
  86. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.dark.AM2.5.fits +0 -0
  87. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.dark.AM3.0.fits +0 -0
  88. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.grey.AM1.0.fits +0 -0
  89. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.grey.AM1.1.fits +0 -0
  90. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.grey.AM1.2.fits +0 -0
  91. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.grey.AM1.3.fits +0 -0
  92. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.grey.AM1.4.fits +0 -0
  93. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.grey.AM1.5.fits +0 -0
  94. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.grey.AM1.6.fits +0 -0
  95. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.grey.AM1.7.fits +0 -0
  96. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.grey.AM1.8.fits +0 -0
  97. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.grey.AM1.9.fits +0 -0
  98. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.grey.AM2.0.fits +0 -0
  99. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.grey.AM2.5.fits +0 -0
  100. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/MKO_emission.grey.AM3.0.fits +0 -0
  101. pydiet-0.9.3/src/pydiet/data/sites/mko/emission/description.txt +5 -0
  102. pydiet-0.9.3/src/pydiet/data/sites/mko/transmission/MKO_transmission.AM1.0.fits +0 -0
  103. pydiet-0.9.3/src/pydiet/data/sites/mko/transmission/MKO_transmission.AM1.1.fits +0 -0
  104. pydiet-0.9.3/src/pydiet/data/sites/mko/transmission/MKO_transmission.AM1.2.fits +0 -0
  105. pydiet-0.9.3/src/pydiet/data/sites/mko/transmission/MKO_transmission.AM1.3.fits +0 -0
  106. pydiet-0.9.3/src/pydiet/data/sites/mko/transmission/MKO_transmission.AM1.4.fits +0 -0
  107. pydiet-0.9.3/src/pydiet/data/sites/mko/transmission/MKO_transmission.AM1.5.fits +0 -0
  108. pydiet-0.9.3/src/pydiet/data/sites/mko/transmission/MKO_transmission.AM1.6.fits +0 -0
  109. pydiet-0.9.3/src/pydiet/data/sites/mko/transmission/MKO_transmission.AM1.7.fits +0 -0
  110. pydiet-0.9.3/src/pydiet/data/sites/mko/transmission/MKO_transmission.AM1.8.fits +0 -0
  111. pydiet-0.9.3/src/pydiet/data/sites/mko/transmission/MKO_transmission.AM1.9.fits +0 -0
  112. pydiet-0.9.3/src/pydiet/data/sites/mko/transmission/MKO_transmission.AM2.0.fits +0 -0
  113. pydiet-0.9.3/src/pydiet/data/sites/mko/transmission/MKO_transmission.AM2.5.fits +0 -0
  114. pydiet-0.9.3/src/pydiet/data/sites/mko/transmission/MKO_transmission.AM3.0.fits +0 -0
  115. pydiet-0.9.3/src/pydiet/data/sites/mko/transmission/MKO_transmission.AM3.5.fits +0 -0
  116. pydiet-0.9.3/src/pydiet/data/sites/mko/transmission/MKO_transmission.AM4.0.fits +0 -0
  117. pydiet-0.9.3/src/pydiet/data/sites/mko/transmission/MKO_transmission.AM4.5.fits +0 -0
  118. pydiet-0.9.3/src/pydiet/data/sites/mko/transmission/MKO_transmission.AM5.0.fits +0 -0
  119. pydiet-0.9.3/src/pydiet/data/sites/mko/transmission/description.txt +5 -0
  120. pydiet-0.9.3/src/pydiet/data/telescopes/cfht/default +0 -0
  121. pydiet-0.9.3/src/pydiet/data/telescopes/cfht/description.txt +1 -0
  122. pydiet-0.9.3/src/pydiet/data/telescopes/cfht/emission/description.txt +2 -0
  123. pydiet-0.9.3/src/pydiet/data/telescopes/cfht/transmission/CFHT_M1_transmission.fits +0 -0
  124. pydiet-0.9.3/src/pydiet/data/telescopes/cfht/transmission/description.txt +1 -0
  125. pydiet-0.9.3/src/pydiet/data/telescopes/description.txt +1 -0
  126. pydiet-0.9.3/src/pydiet/package.py +55 -0
  127. pydiet-0.9.3/src/pydiet/py.typed +0 -0
  128. pydiet-0.9.3/src/pydiet/server/__init__.py +9 -0
  129. pydiet-0.9.3/src/pydiet/server/app.py +369 -0
  130. pydiet-0.9.3/src/pydiet/server/config/__init__.py +51 -0
  131. pydiet-0.9.3/src/pydiet/server/config/config.py +330 -0
  132. pydiet-0.9.3/src/pydiet/server/config/fields.py +49 -0
  133. pydiet-0.9.3/src/pydiet/server/config/settings.py +166 -0
  134. pydiet-0.9.3/src/pydiet/server/data.py +31 -0
  135. pydiet-0.9.3/src/pydiet/server/datafiles.py +367 -0
  136. pydiet-0.9.3/src/pydiet/server/image.py +342 -0
  137. pydiet-0.9.3/src/pydiet/server/models/__init__.py +34 -0
  138. pydiet-0.9.3/src/pydiet/server/models/dataconfig.py +195 -0
  139. pydiet-0.9.3/src/pydiet/server/models/default.py +9 -0
  140. pydiet-0.9.3/src/pydiet/server/models/exceptions.py +9 -0
  141. pydiet-0.9.3/src/pydiet/server/models/instrument.py +314 -0
  142. pydiet-0.9.3/src/pydiet/server/models/query.py +172 -0
  143. pydiet-0.9.3/src/pydiet/server/models/response.py +97 -0
  144. pydiet-0.9.3/src/pydiet/server/models/types.py +35 -0
  145. pydiet-0.9.3/src/pydiet/server/photsys.py +71 -0
  146. pydiet-0.9.3/src/pydiet/server/response.py +237 -0
  147. pydiet-0.9.3/src/pydiet/server/types/__init__.py +8 -0
  148. pydiet-0.9.3/src/pydiet/server/types/quantity.py +532 -0
  149. pydiet-0.9.3/src/pydiet/server/types/string.py +318 -0
  150. pydiet-0.9.3/src/pydiet/templates/common/base.html +80 -0
  151. pydiet-0.9.3/src/pydiet/templates/common/plot_filter.html +17 -0
  152. pydiet-0.9.3/src/pydiet/templates/common/privacy.html +132 -0
  153. pydiet-0.9.3/src/pydiet/templates/common/settings.html +23 -0
  154. pydiet-0.9.3/src/pydiet/templates/common/terms.html +101 -0
  155. pydiet-0.9.3/src/pydiet/templates/megacam/etc_form.html +319 -0
  156. pydiet-0.9.3/src/pydiet/templates/megacam/etc_results.html +190 -0
  157. pydiet-0.9.3/src/pydiet/templates/wircam/etc_form.html +319 -0
  158. pydiet-0.9.3/src/pydiet/templates/wircam/etc_results.html +190 -0
  159. pydiet-0.9.3/src/pydiet/web_client/css/style.css +221 -0
  160. pydiet-0.9.3/src/pydiet/web_client/dist/pydiet.js +31 -0
  161. pydiet-0.9.3/src/pydiet/web_client/images/logo.svg +6 -0
  162. pydiet-0.9.3/src/pydiet/web_client/images/megacam/background.jpg +0 -0
  163. pydiet-0.9.3/src/pydiet/web_client/images/megacam/logo.png +0 -0
  164. pydiet-0.9.3/src/pydiet/web_client/images/wircam/background.jpg +0 -0
  165. pydiet-0.9.3/src/pydiet/web_client/images/wircam/logo.png +0 -0
  166. pydiet-0.9.3/src/pydiet/web_client/js/dom.js +51 -0
  167. pydiet-0.9.3/src/pydiet/web_client/js/etc.js +63 -0
  168. pydiet-0.9.3/src/pydiet/web_client/js/fetch.js +49 -0
  169. pydiet-0.9.3/src/pydiet/web_client/js/instrument.js +62 -0
  170. pydiet-0.9.3/src/pydiet/web_client/js/main.js +15 -0
  171. pydiet-0.9.3/src/pydiet/web_client/js/plot.js +88 -0
  172. pydiet-0.9.3/src/pydiet/web_client/js/settings.js +57 -0
  173. pydiet-0.9.3/src/pydiet/web_client/js/theme.js +43 -0
  174. pydiet-0.9.3/src/pydiet/web_client/js/url.js +12 -0
  175. pydiet-0.9.3/src/pydiet/web_client/jsdoc.json +20 -0
  176. pydiet-0.9.3/src/pydiet/web_client/package.json +83 -0
  177. pydiet-0.9.3/tests/__init__.py +0 -0
  178. pydiet-0.9.3/tests/fixures.py +25 -0
  179. pydiet-0.9.3/tests/test_config.py +35 -0
  180. pydiet-0.9.3/tests/test_quantity.py +91 -0
pydiet-0.9.3/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Emmanuel Bertin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
pydiet-0.9.3/PKG-INFO ADDED
@@ -0,0 +1,118 @@
1
+ Metadata-Version: 2.1
2
+ Name: PyDIET
3
+ Version: 0.9.3
4
+ Summary: CFHT's Direct Imaging Exposure Time calculator (DIET)
5
+ Keywords: astronomy,CFHT,imaging
6
+ Author-Email: Emmanuel Bertin <bertin@cfht.hawaii.edu>
7
+ License: MIT License
8
+
9
+ Copyright (c) 2024 Emmanuel Bertin
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be included in all
19
+ copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ SOFTWARE.
28
+
29
+ Classifier: Programming Language :: Python :: 3
30
+ Classifier: Programming Language :: Python :: 3.10
31
+ Classifier: Programming Language :: Python :: 3.11
32
+ Classifier: Programming Language :: Python :: 3.12
33
+ Classifier: Programming Language :: Python :: 3.13
34
+ Classifier: Programming Language :: Python :: 3.14
35
+ Project-URL: Repository, https://github.com/astromatic/pydiet
36
+ Project-URL: Homepage, https://www.cfht.hawaii.edu
37
+ Project-URL: Documentation, https://astromatic.github.io/pydiet
38
+ Requires-Python: >=3.10
39
+ Requires-Dist: astropy>=5.0
40
+ Requires-Dist: backports.strenum
41
+ Requires-Dist: fastapi>=0.74
42
+ Requires-Dist: httpx<0.29,>=0.28
43
+ Requires-Dist: jinja2>=3.1.2
44
+ Requires-Dist: numpy<2.0
45
+ Requires-Dist: pillow>=11.0
46
+ Requires-Dist: platformdirs>=3.4.0
47
+ Requires-Dist: pydantic>=2.2
48
+ Requires-Dist: pydantic-settings>=2.2
49
+ Requires-Dist: python-multipart
50
+ Requires-Dist: scipy>=1.15
51
+ Requires-Dist: setuptools
52
+ Requires-Dist: specutils>=1.18.0
53
+ Requires-Dist: synphot>=1.5.0
54
+ Requires-Dist: tomli>=1.1.0; python_version < "3.11"
55
+ Requires-Dist: uvicorn[standard]>=0.30
56
+ Provides-Extra: test
57
+ Requires-Dist: mypy; extra == "test"
58
+ Requires-Dist: pytest-cov; extra == "test"
59
+ Provides-Extra: doc
60
+ Requires-Dist: autodoc_pydantic>=2.2.0; extra == "doc"
61
+ Requires-Dist: sphinx>=7.0; extra == "doc"
62
+ Requires-Dist: sphinx-rtd-theme>=1.2; extra == "doc"
63
+ Requires-Dist: sphinxcontrib-bibtex>=2.4.0; extra == "doc"
64
+ Requires-Dist: sphinx-js>=3.2.2; extra == "doc"
65
+ Description-Content-Type: text/markdown
66
+
67
+ # PyDIET
68
+
69
+ [![Documentation](https://github.com/astromatic/pydiet/actions/workflows/doc.yml/badge.svg)](https://astromatic.github.io/pydiet/)
70
+ [![Tests](https://github.com/astromatic/pydiet/actions/workflows/tests.yml/badge.svg)](https://github.com/astromatic/pydiet/actions/workflows/tests.yml)
71
+ [![codecov](https://codecov.io/gh/astromatic/pydiet/graph/badge.svg?token=t3ZeGLnWTD)](https://codecov.io/gh/astromatic/pydiet)
72
+
73
+ PyDIET is [CFHT](https://www.cfht.hawaii.edu)'s new [Direct Imaging Exposure Time calculator](https://pydiet.cfht.hawaii.edu).
74
+
75
+ <p>
76
+ <img src="https://github.com/astromatic/pydiet/blob/main/docs/src/figures/pydiet.jpg" alt="Screenshot" width="640"/>
77
+ </p>
78
+
79
+ ## Important
80
+ PyDIET is still in testing phase.
81
+ The authors reserve the right to modify, update, or discontinue any aspect of the package at any time without notice.
82
+ This includes, but is not limited to, changes in instrument models, calibration data, algorithms, or implementation details, which may result in differences in the outputs produced by PyDIET over time.
83
+
84
+ The authors shall not be liable for any direct, indirect, incidental, consequential, or special damages arising out of or in connection with the use of, or inability to use PyDIET including but not limited to errors in calculations, scientific results, or observational planning.
85
+
86
+ ## Installing
87
+
88
+ ### pip/pipx
89
+
90
+ ```
91
+ git clone https://github.com/astromatic/pydiet
92
+ cd pydiet
93
+ pip install .
94
+ ```
95
+
96
+ ### Docker
97
+ To build a Dockerfile for installing pyDiet:
98
+ ```
99
+ docker build -t pydiet:latest -f docker/Dockerfile .
100
+ ```
101
+ Run, get a shell, and python venv
102
+ ```
103
+ docker run -tid --name pydiet pydiet
104
+ docker exec -ti pydiet "/bin/bash"
105
+ source venv_pydiet/bin/activate
106
+ ```
107
+ ## Executing (locally)
108
+
109
+ ```
110
+ pydiet -b
111
+ ```
112
+
113
+ ## Customizing
114
+ PyDIET can easily be adapted to other astronomical imagers by simply editing the [``data/data_config.toml``](https://github.com/astromatic/pydiet/blob/main/src/pydiet/data/data_config.toml) file in [TOML](https://toml.io) format, and supplying [pysynphot-compliant](https://pysynphot.readthedocs.io/en/latest/using_pysynphot.html#pysynphot-io) transmission/emission [FITS](https://en.wikipedia.org/wiki/FITS) files for the various parts of the instrument chain.
115
+ Use the provided [``utils/extract_filter.py`` script](https://github.com/astromatic/pydiet/blob/main/utils/extract_filter.py) to convert ASCII tables to pysynphot-compliant FITS format.
116
+
117
+ The web interface can easily be customized to accomodate one or several instruments through query form and result display [templates](https://github.com/astromatic/pydiet/tree/main/src/pydiet/templates).
118
+
pydiet-0.9.3/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # PyDIET
2
+
3
+ [![Documentation](https://github.com/astromatic/pydiet/actions/workflows/doc.yml/badge.svg)](https://astromatic.github.io/pydiet/)
4
+ [![Tests](https://github.com/astromatic/pydiet/actions/workflows/tests.yml/badge.svg)](https://github.com/astromatic/pydiet/actions/workflows/tests.yml)
5
+ [![codecov](https://codecov.io/gh/astromatic/pydiet/graph/badge.svg?token=t3ZeGLnWTD)](https://codecov.io/gh/astromatic/pydiet)
6
+
7
+ PyDIET is [CFHT](https://www.cfht.hawaii.edu)'s new [Direct Imaging Exposure Time calculator](https://pydiet.cfht.hawaii.edu).
8
+
9
+ <p>
10
+ <img src="https://github.com/astromatic/pydiet/blob/main/docs/src/figures/pydiet.jpg" alt="Screenshot" width="640"/>
11
+ </p>
12
+
13
+ ## Important
14
+ PyDIET is still in testing phase.
15
+ The authors reserve the right to modify, update, or discontinue any aspect of the package at any time without notice.
16
+ This includes, but is not limited to, changes in instrument models, calibration data, algorithms, or implementation details, which may result in differences in the outputs produced by PyDIET over time.
17
+
18
+ The authors shall not be liable for any direct, indirect, incidental, consequential, or special damages arising out of or in connection with the use of, or inability to use PyDIET including but not limited to errors in calculations, scientific results, or observational planning.
19
+
20
+ ## Installing
21
+
22
+ ### pip/pipx
23
+
24
+ ```
25
+ git clone https://github.com/astromatic/pydiet
26
+ cd pydiet
27
+ pip install .
28
+ ```
29
+
30
+ ### Docker
31
+ To build a Dockerfile for installing pyDiet:
32
+ ```
33
+ docker build -t pydiet:latest -f docker/Dockerfile .
34
+ ```
35
+ Run, get a shell, and python venv
36
+ ```
37
+ docker run -tid --name pydiet pydiet
38
+ docker exec -ti pydiet "/bin/bash"
39
+ source venv_pydiet/bin/activate
40
+ ```
41
+ ## Executing (locally)
42
+
43
+ ```
44
+ pydiet -b
45
+ ```
46
+
47
+ ## Customizing
48
+ PyDIET can easily be adapted to other astronomical imagers by simply editing the [``data/data_config.toml``](https://github.com/astromatic/pydiet/blob/main/src/pydiet/data/data_config.toml) file in [TOML](https://toml.io) format, and supplying [pysynphot-compliant](https://pysynphot.readthedocs.io/en/latest/using_pysynphot.html#pysynphot-io) transmission/emission [FITS](https://en.wikipedia.org/wiki/FITS) files for the various parts of the instrument chain.
49
+ Use the provided [``utils/extract_filter.py`` script](https://github.com/astromatic/pydiet/blob/main/utils/extract_filter.py) to convert ASCII tables to pysynphot-compliant FITS format.
50
+
51
+ The web interface can easily be customized to accomodate one or several instruments through query form and result display [templates](https://github.com/astromatic/pydiet/tree/main/src/pydiet/templates).
52
+
@@ -0,0 +1,119 @@
1
+ [build-system]
2
+ requires = [
3
+ "pdm-backend",
4
+ ]
5
+ build-backend = "pdm.backend"
6
+
7
+ [project]
8
+ name = "PyDIET"
9
+ version = "0.9.3"
10
+ description = "CFHT's Direct Imaging Exposure Time calculator (DIET)"
11
+ authors = [
12
+ { name = "Emmanuel Bertin", email = "bertin@cfht.hawaii.edu" },
13
+ ]
14
+ keywords = [
15
+ "astronomy",
16
+ "CFHT",
17
+ "imaging",
18
+ ]
19
+ readme = "README.md"
20
+ dependencies = [
21
+ "astropy >= 5.0",
22
+ "backports.strenum",
23
+ "fastapi >= 0.74",
24
+ "httpx >=0.28,<0.29",
25
+ "jinja2 >= 3.1.2",
26
+ "numpy < 2.0",
27
+ "pillow >= 11.0",
28
+ "platformdirs >= 3.4.0",
29
+ "pydantic >= 2.2",
30
+ "pydantic-settings >= 2.2",
31
+ "python-multipart",
32
+ "scipy >= 1.15",
33
+ "setuptools",
34
+ "specutils >= 1.18.0",
35
+ "synphot >= 1.5.0",
36
+ "tomli >= 1.1.0 ; python_version < '3.11'",
37
+ "uvicorn[standard] >= 0.30",
38
+ ]
39
+ requires-python = ">=3.10"
40
+ classifiers = [
41
+ "Programming Language :: Python :: 3",
42
+ "Programming Language :: Python :: 3.10",
43
+ "Programming Language :: Python :: 3.11",
44
+ "Programming Language :: Python :: 3.12",
45
+ "Programming Language :: Python :: 3.13",
46
+ "Programming Language :: Python :: 3.14",
47
+ ]
48
+
49
+ [project.license]
50
+ file = "LICENSE"
51
+
52
+ [project.optional-dependencies]
53
+ test = [
54
+ "mypy",
55
+ "pytest-cov",
56
+ ]
57
+ doc = [
58
+ "autodoc_pydantic >= 2.2.0",
59
+ "sphinx >= 7.0",
60
+ "sphinx-rtd-theme >= 1.2",
61
+ "sphinxcontrib-bibtex >= 2.4.0",
62
+ "sphinx-js >= 3.2.2",
63
+ ]
64
+
65
+ [project.scripts]
66
+ pydiet = "pydiet.cmd.start:main"
67
+
68
+ [project.urls]
69
+ Repository = "https://github.com/astromatic/pydiet"
70
+ Homepage = "https://www.cfht.hawaii.edu"
71
+ Documentation = "https://astromatic.github.io/pydiet"
72
+
73
+ [tool.pdm.build]
74
+ excludes = [
75
+ "src/pydiet/web_client/node_modules",
76
+ "src/pydiet/doc/doctrees",
77
+ ]
78
+
79
+ [tool.pdm.scripts]
80
+ mypy = "mypy src"
81
+
82
+ [tool.pdm.scripts.doc]
83
+ cmd = "make inline"
84
+ working_dir = "docs"
85
+
86
+ [tool.pdm.scripts.pre_build]
87
+ composite = [
88
+ "doc",
89
+ "mypy",
90
+ ]
91
+
92
+ [tool.pdm.scripts.pre_install]
93
+ composite = [
94
+ "doc",
95
+ "mypy",
96
+ ]
97
+
98
+ [tool.mypy]
99
+ exclude = [
100
+ "docs",
101
+ "tests",
102
+ ]
103
+
104
+ [tool.pytest.ini_options]
105
+ norecursedirs = [
106
+ "src/pydiet/web_client",
107
+ ]
108
+ addopts = "--doctest-modules --doctest-continue-on-failure"
109
+ doctest_optionflags = "NORMALIZE_WHITESPACE IGNORE_EXCEPTION_DETAIL ELLIPSIS"
110
+ filterwarnings = [
111
+ "ignore::DeprecationWarning",
112
+ ]
113
+ tmp_path_retention_policy = "none"
114
+
115
+ [tool.coverage.run]
116
+ source_pkgs = [
117
+ "pydiet",
118
+ ]
119
+ command_line = "-m pytest tests"
@@ -0,0 +1,12 @@
1
+ """
2
+ PyDIET
3
+ ======
4
+
5
+ [CFHT](https://www.cfht.hawaii.edu)'s new Direct Imaging Exposure Time calculator.
6
+ """
7
+ # Copyright CFHT/CNRS
8
+ # Licensed under the MIT license
9
+
10
+ from .api_client.client import Client
11
+ from .server.models import ETCQueryModel, ETCResponseModel
12
+
@@ -0,0 +1,6 @@
1
+ """
2
+ PyDIET API client subpackage
3
+ """
4
+ # Copyright (c) 2024 - 2026 DAp/CEA/AIM/OSUPS/UParisSaclay
5
+ # Licensed under the MIT licence
6
+
@@ -0,0 +1,57 @@
1
+ #! /usr/bin/python3
2
+ """
3
+ Python client functions for harvesting results from the PyDIET ETC
4
+ """
5
+ # Copyright (c) 2024 - 2026 CFHT/CNRS/CEA-AIM/OSUPS-UParisSaclay
6
+ # Licensed under the MIT licence
7
+
8
+ from typing import Optional
9
+
10
+ import httpx
11
+ from pydantic import ValidationError
12
+
13
+ from ..server.models.query import ETCQueryModel
14
+ from ..server.models.response import ETCResponseModel
15
+ from ..server.config import settings
16
+
17
+
18
+ class Client:
19
+ def __init__(self, api_url: Optional[str]=None) -> None:
20
+ self.api_url = f"http://{settings['host']}" \
21
+ f":{settings['port']}{settings['api_path']}" if api_url is None \
22
+ else api_url
23
+
24
+
25
+ def query(
26
+ self,
27
+ query: ETCQueryModel,
28
+ timeout: float=10.) -> ETCResponseModel:
29
+ headers: dict[str, str] = {"Accept": "application/json"}
30
+ print(f"{self.api_url}/{query.instrument.value}")
31
+ try:
32
+ with httpx.Client(timeout=timeout, headers=headers) as client:
33
+ response = client.get(
34
+ f"{self.api_url}/{query.instrument.value}",
35
+ params=query.model_dump(
36
+ exclude={"instrument"},
37
+ exclude_none=True,
38
+ mode="json"
39
+ )
40
+ )
41
+ response.raise_for_status()
42
+ payload = response.json()
43
+ except httpx.HTTPStatusError as exc:
44
+ raise RuntimeError(
45
+ f"HTTP error {exc.response.status_code}: {exc.response.text}"
46
+ ) from exc
47
+ except httpx.HTTPError as exc:
48
+ raise RuntimeError(f"Transport error: {exc}") from exc
49
+ except ValueError as exc:
50
+ raise RuntimeError("Response was not valid JSON") from exc
51
+
52
+ try:
53
+ return ETCResponseModel.model_validate(payload)
54
+ except ValidationError as exc:
55
+ raise RuntimeError(f"Invalid response schema: {exc}") from exc
56
+
57
+
@@ -0,0 +1,9 @@
1
+ """
2
+ PyDIET
3
+ ======
4
+
5
+ [CFHT](https://www.cfht.hawaii.edu)'s new Direct Imaging Exposure Time calculator.
6
+ """
7
+ # Copyright CFHT/CNRS
8
+ # Licensed under the MIT license
9
+
@@ -0,0 +1,107 @@
1
+ #! /usr/bin/python3
2
+ """
3
+ Start script (renamed as :program:`pydiet`).
4
+ """
5
+ # Copyright CFHT/CNRS/CEA/UParisSaclay
6
+ # Licensed under the MIT licence
7
+ from sys import exit
8
+ from threading import Thread
9
+ from time import sleep
10
+ from urllib.request import urlopen
11
+ from urllib.error import URLError
12
+ import webbrowser
13
+
14
+ from uvicorn import run
15
+
16
+ from pydiet.server import config
17
+
18
+
19
+ def start_server(
20
+ app: str="pydiet.server.app:create_app",
21
+ host: str="localhost",
22
+ port: int=8009,
23
+ root_path: str="",
24
+ workers: int=4,
25
+ access_log: bool=False,
26
+ reload: bool=True
27
+ ):
28
+ """
29
+ Start the Uvicorn server in application factory mode.
30
+
31
+ Parameters
32
+ ----------
33
+ app: str, optional
34
+ Name of the ASGI app callable.
35
+ host: str, optional
36
+ Host name or IP address.
37
+ port: int, optional
38
+ Port.
39
+ root_path: str | ~pathlib.Path, optional
40
+ ASGI root_path.
41
+ workers: int, optional
42
+ Number of workers.
43
+ access_log: bool, optional
44
+ Display access log.
45
+ reload: bool, optional
46
+ Enable auto-reload (turns off multiple workers).
47
+ """
48
+ run(
49
+ app,
50
+ host=host,
51
+ port=port,
52
+ root_path=root_path,
53
+ access_log=access_log,
54
+ workers=workers,
55
+ reload=reload,
56
+ factory=True
57
+ )
58
+ return
59
+
60
+
61
+ def open_browser_when_ready(host: str, port: int, root_path: str, api_path: str):
62
+ """
63
+ Start a browser session once the server is up and running.
64
+ """
65
+ link = f"http://{host}:{port}{root_path or ''}"
66
+ f"{config.settings['root_path'] or ''}"
67
+ while True:
68
+ try:
69
+ # succeeds only when server is actually up
70
+ urlopen(f"{link}{api_path}/health", timeout=2)
71
+ break
72
+ except URLError:
73
+ sleep(0.5)
74
+ webbrowser.open(link)
75
+
76
+
77
+ def main() -> int:
78
+ """
79
+ Set up configuration and start the PyDIET server.
80
+ """
81
+ if config.settings["browser"]:
82
+ # Start watcher thread to open browser when server is ready
83
+ Thread(
84
+ target=open_browser_when_ready,
85
+ args=(
86
+ config.settings["host"],
87
+ config.settings["port"],
88
+ config.settings["root_path"],
89
+ config.settings["api_path"]
90
+ ),
91
+ daemon=True,
92
+ ).start()
93
+
94
+ # Start the server itself
95
+ start_server(
96
+ host=config.settings["host"],
97
+ port=config.settings["port"],
98
+ root_path=config.settings["root_path"],
99
+ access_log=config.settings["access_log"],
100
+ reload=config.settings["reload"],
101
+ workers=config.settings["workers"]
102
+ )
103
+ return 0
104
+
105
+ if __name__ == "__main__":
106
+ exit(main())
107
+