pyreduce-astro 0.5.26__tar.gz → 0.6.0__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 (186) hide show
  1. pyreduce_astro-0.6.0/.gitignore +19 -0
  2. pyreduce_astro-0.6.0/PKG-INFO +114 -0
  3. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/README.md +42 -15
  4. pyreduce_astro-0.6.0/hatch_build.py +99 -0
  5. pyreduce_astro-0.6.0/pyproject.toml +209 -0
  6. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/__init__.py +20 -7
  7. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/__main__.py +0 -1
  8. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/clib/build_extract.py +2 -3
  9. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/clib/slit_func_2d_xi_zeta_bd.c +33 -0
  10. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/clib/slit_func_2d_xi_zeta_bd.h +22 -0
  11. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/clipnflip.py +0 -1
  12. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/combine_frames.py +93 -25
  13. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/configuration.py +3 -4
  14. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/continuum_normalization.py +4 -4
  15. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/cwrappers.py +103 -28
  16. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/datasets.py +1 -1
  17. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/echelle.py +49 -21
  18. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/estimate_background_scatter.py +2 -3
  19. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/extract.py +29 -25
  20. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/extraction_width.py +2 -6
  21. pyreduce_astro-0.6.0/pyreduce/instruments/andes.json +61 -0
  22. pyreduce_astro-0.6.0/pyreduce/instruments/andes.py +102 -0
  23. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/instruments/common.py +30 -26
  24. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/instruments/crires_plus.json +1 -1
  25. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/instruments/crires_plus.py +8 -7
  26. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/instruments/filters.py +4 -3
  27. pyreduce_astro-0.6.0/pyreduce/instruments/harpn.json +136 -0
  28. pyreduce_astro-0.6.0/pyreduce/instruments/harpn.py +201 -0
  29. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/instruments/harps.py +5 -3
  30. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/instruments/instrument_info.py +1 -2
  31. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/instruments/instrument_schema.json +154 -57
  32. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/instruments/jwst_miri.py +3 -7
  33. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/instruments/jwst_niriss.py +6 -7
  34. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/instruments/lick_apf.py +3 -8
  35. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/instruments/mcdonald.py +2 -6
  36. pyreduce_astro-0.6.0/pyreduce/instruments/metis_ifu.json +63 -0
  37. pyreduce_astro-0.6.0/pyreduce/instruments/metis_ifu.py +45 -0
  38. pyreduce_astro-0.6.0/pyreduce/instruments/metis_lss.json +65 -0
  39. pyreduce_astro-0.6.0/pyreduce/instruments/metis_lss.py +45 -0
  40. pyreduce_astro-0.6.0/pyreduce/instruments/micado.json +53 -0
  41. pyreduce_astro-0.6.0/pyreduce/instruments/micado.py +45 -0
  42. pyreduce_astro-0.6.0/pyreduce/instruments/neid.json +51 -0
  43. pyreduce_astro-0.6.0/pyreduce/instruments/neid.py +154 -0
  44. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/instruments/nirspec.py +11 -13
  45. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/instruments/nte.py +2 -6
  46. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/instruments/uves.py +2 -6
  47. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/instruments/xshooter.py +3 -7
  48. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/make_shear.py +8 -6
  49. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/rectify.py +2 -5
  50. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/reduce.py +77 -61
  51. pyreduce_astro-0.6.0/pyreduce/settings/settings_ANDES.json +89 -0
  52. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/settings/settings_CRIRES_PLUS.json +3 -2
  53. pyreduce_astro-0.6.0/pyreduce/settings/settings_HARPN.json +73 -0
  54. pyreduce_astro-0.6.0/pyreduce/settings/settings_METIS_IFU.json +77 -0
  55. pyreduce_astro-0.6.0/pyreduce/settings/settings_METIS_LSS.json +77 -0
  56. pyreduce_astro-0.6.0/pyreduce/settings/settings_MICADO.json +78 -0
  57. pyreduce_astro-0.6.0/pyreduce/settings/settings_NEID.json +73 -0
  58. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/settings/settings_UVES.json +2 -2
  59. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/settings/settings_pyreduce.json +2 -0
  60. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/settings/settings_schema.json +5 -0
  61. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/tools/combine.py +1 -2
  62. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/trace_orders.py +58 -25
  63. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/util.py +23 -28
  64. pyreduce_astro-0.6.0/pyreduce/wavecal/MICADO_HK_3arcsec_chip5.npz +0 -0
  65. pyreduce_astro-0.6.0/pyreduce/wavecal/atlas/thar.fits +4946 -13
  66. pyreduce_astro-0.6.0/pyreduce/wavecal/atlas/thar_list.txt +4172 -0
  67. pyreduce_astro-0.6.0/pyreduce/wavecal/atlas/une.fits +0 -0
  68. pyreduce_astro-0.6.0/pyreduce/wavecal/convert.py +38 -0
  69. pyreduce_astro-0.6.0/pyreduce/wavecal/harpn_harpn_2D.npz +0 -0
  70. pyreduce_astro-0.6.0/pyreduce/wavecal/metis_lss_l_2D.npz +0 -0
  71. pyreduce_astro-0.6.0/pyreduce/wavecal/metis_lss_m_2D.npz +0 -0
  72. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/wavelength_calibration.py +58 -44
  73. pyreduce-astro-0.5.26/MANIFEST.in +0 -20
  74. pyreduce-astro-0.5.26/PKG-INFO +0 -52
  75. pyreduce-astro-0.5.26/codemeta.json +0 -53
  76. pyreduce-astro-0.5.26/pyproject.toml +0 -20
  77. pyreduce-astro-0.5.26/pyreduce/_version.py +0 -21
  78. pyreduce-astro-0.5.26/pyreduce_astro.egg-info/PKG-INFO +0 -52
  79. pyreduce-astro-0.5.26/pyreduce_astro.egg-info/SOURCES.txt +0 -155
  80. pyreduce-astro-0.5.26/pyreduce_astro.egg-info/dependency_links.txt +0 -1
  81. pyreduce-astro-0.5.26/pyreduce_astro.egg-info/requires.txt +0 -11
  82. pyreduce-astro-0.5.26/pyreduce_astro.egg-info/top_level.txt +0 -1
  83. pyreduce-astro-0.5.26/requirements.txt +0 -24
  84. pyreduce-astro-0.5.26/setup.cfg +0 -20
  85. pyreduce-astro-0.5.26/setup.py +0 -76
  86. pyreduce-astro-0.5.26/test/test_bias.py +0 -67
  87. pyreduce-astro-0.5.26/test/test_clib_build.py +0 -6
  88. pyreduce-astro-0.5.26/test/test_clipnflip.py +0 -110
  89. pyreduce-astro-0.5.26/test/test_combine.py +0 -145
  90. pyreduce-astro-0.5.26/test/test_configuration.py +0 -69
  91. pyreduce-astro-0.5.26/test/test_continuum.py +0 -75
  92. pyreduce-astro-0.5.26/test/test_cwrappers.py +0 -122
  93. pyreduce-astro-0.5.26/test/test_echelle.py +0 -187
  94. pyreduce-astro-0.5.26/test/test_extract.py +0 -379
  95. pyreduce-astro-0.5.26/test/test_flat.py +0 -79
  96. pyreduce-astro-0.5.26/test/test_instruments.py +0 -105
  97. pyreduce-astro-0.5.26/test/test_mask.py +0 -27
  98. pyreduce-astro-0.5.26/test/test_normflat.py +0 -52
  99. pyreduce-astro-0.5.26/test/test_orders.py +0 -85
  100. pyreduce-astro-0.5.26/test/test_reduce.py +0 -75
  101. pyreduce-astro-0.5.26/test/test_scatter.py +0 -70
  102. pyreduce-astro-0.5.26/test/test_science.py +0 -79
  103. pyreduce-astro-0.5.26/test/test_shear.py +0 -156
  104. pyreduce-astro-0.5.26/test/test_util.py +0 -5
  105. pyreduce-astro-0.5.26/test/test_wavecal.py +0 -60
  106. pyreduce-astro-0.5.26/versioneer.py +0 -1887
  107. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/LICENSE +0 -0
  108. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/clib/__init__.py +0 -0
  109. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/clib/slit_func_bd.c +0 -0
  110. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/clib/slit_func_bd.h +0 -0
  111. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/instruments/__init__.py +0 -0
  112. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/instruments/common.json +0 -0
  113. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/instruments/harps.json +0 -0
  114. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/instruments/jwst_miri.json +0 -0
  115. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/instruments/jwst_niriss.json +0 -0
  116. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/instruments/lick_apf.json +0 -0
  117. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/instruments/mcdonald.json +0 -0
  118. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/instruments/nirspec.json +0 -0
  119. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/instruments/nte.json +0 -0
  120. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/instruments/uves.json +0 -0
  121. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/instruments/xshooter.json +0 -0
  122. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/masks/mask_crires_plus_det1.fits.gz +0 -0
  123. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/masks/mask_crires_plus_det2.fits.gz +0 -0
  124. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/masks/mask_crires_plus_det3.fits.gz +0 -0
  125. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/masks/mask_ctio_chiron.fits.gz +0 -0
  126. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/masks/mask_elodie.fits.gz +0 -0
  127. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/masks/mask_feros3.fits.gz +0 -0
  128. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/masks/mask_flames_giraffe.fits.gz +0 -0
  129. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/masks/mask_harps_blue.fits.gz +0 -0
  130. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/masks/mask_harps_red.fits.gz +0 -0
  131. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/masks/mask_hds_blue.fits.gz +0 -0
  132. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/masks/mask_hds_red.fits.gz +0 -0
  133. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/masks/mask_het_hrs_2x5.fits.gz +0 -0
  134. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/masks/mask_jwst_miri_lrs_slitless.fits.gz +0 -0
  135. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/masks/mask_jwst_niriss_gr700xd.fits.gz +0 -0
  136. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/masks/mask_lick_apf_.fits.gz +0 -0
  137. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/masks/mask_mcdonald.fits.gz +0 -0
  138. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/masks/mask_nes.fits.gz +0 -0
  139. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/masks/mask_nirspec_nirspec.fits.gz +0 -0
  140. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/masks/mask_sarg.fits.gz +0 -0
  141. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/masks/mask_sarg_2x2a.fits.gz +0 -0
  142. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/masks/mask_sarg_2x2b.fits.gz +0 -0
  143. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/masks/mask_subaru_hds_red.fits.gz +0 -0
  144. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/masks/mask_uves_blue.fits.gz +0 -0
  145. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/masks/mask_uves_blue_binned_2_2.fits.gz +0 -0
  146. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/masks/mask_uves_middle.fits.gz +0 -0
  147. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/masks/mask_uves_middle_2x2_split.fits.gz +0 -0
  148. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/masks/mask_uves_middle_binned_2_2.fits.gz +0 -0
  149. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/masks/mask_uves_red.fits.gz +0 -0
  150. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/masks/mask_uves_red_2x2.fits.gz +0 -0
  151. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/masks/mask_uves_red_2x2_split.fits.gz +0 -0
  152. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/masks/mask_uves_red_binned_2_2.fits.gz +0 -0
  153. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/masks/mask_xshooter_nir.fits.gz +0 -0
  154. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/settings/settings_HARPS.json +0 -0
  155. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/settings/settings_JWST_MIRI.json +0 -0
  156. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/settings/settings_JWST_NIRISS.json +0 -0
  157. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/settings/settings_LICK_APF.json +0 -0
  158. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/settings/settings_MCDONALD.json +0 -0
  159. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/settings/settings_NIRSPEC.json +0 -0
  160. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/settings/settings_NTE.json +0 -0
  161. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/settings/settings_XSHOOTER.json +0 -0
  162. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/tools/__init__.py +0 -0
  163. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/wavecal/crires_plus_J1228_Open_det1.npz +0 -0
  164. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/wavecal/crires_plus_J1228_Open_det2.npz +0 -0
  165. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/wavecal/crires_plus_J1228_Open_det3.npz +0 -0
  166. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/wavecal/harps_blue_2D.npz +0 -0
  167. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/wavecal/harps_blue_pol_2D.npz +0 -0
  168. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/wavecal/harps_red_2D.npz +0 -0
  169. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/wavecal/harps_red_pol_2D.npz +0 -0
  170. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/wavecal/mcdonald.npz +0 -0
  171. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/wavecal/nirspec_K2.npz +0 -0
  172. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/wavecal/uves_blue_360nm_2D.npz +0 -0
  173. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/wavecal/uves_blue_390nm_2D.npz +0 -0
  174. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/wavecal/uves_blue_437nm_2D.npz +0 -0
  175. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/wavecal/uves_middle_2x2_2D.npz +0 -0
  176. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/wavecal/uves_middle_565nm_2D.npz +0 -0
  177. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/wavecal/uves_middle_580nm_2D.npz +0 -0
  178. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/wavecal/uves_middle_600nm_2D.npz +0 -0
  179. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/wavecal/uves_middle_665nm_2D.npz +0 -0
  180. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/wavecal/uves_middle_860nm_2D.npz +0 -0
  181. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/wavecal/uves_red_580nm_2D.npz +0 -0
  182. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/wavecal/uves_red_600nm_2D.npz +0 -0
  183. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/wavecal/uves_red_665nm_2D.npz +0 -0
  184. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/wavecal/uves_red_760nm_2D.npz +0 -0
  185. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/wavecal/uves_red_860nm_2D.npz +0 -0
  186. {pyreduce-astro-0.5.26 → pyreduce_astro-0.6.0}/pyreduce/wavecal/xshooter_nir.npz +0 -0
@@ -0,0 +1,19 @@
1
+ datasets
2
+ DATA
3
+ __pycache__
4
+ *.sw[op]
5
+ .coverage
6
+ cov.xml
7
+ *.so
8
+ *.o
9
+ pyreduce/clib/_slitfunc_2d.c
10
+ pyreduce/clib/_slitfunc_bd.c
11
+ pyreduce_astro.egg*
12
+ .vscode
13
+ *.py[cod]
14
+ .venv
15
+ .uv
16
+ esorex.log
17
+ pyesorex.log
18
+ test/test_outputs
19
+ docs/_build/
@@ -0,0 +1,114 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyreduce-astro
3
+ Version: 0.6.0
4
+ Summary: A data reduction package for echelle spectrographs
5
+ Project-URL: Homepage, https://github.com/ivh/PyReduce
6
+ Project-URL: Documentation, https://pyreduce-astro.readthedocs.io
7
+ Project-URL: Repository, https://github.com/ivh/PyReduce
8
+ Project-URL: Issues, https://github.com/ivh/PyReduce/issues
9
+ Author: Nikolai Piskunov, Thomas Marquart, Ansgar Wehrhahn
10
+ Maintainer-email: Thomas Marquart <thomas.marquart@astro.uu.se>
11
+ License: GPL-3.0-or-later
12
+ License-File: LICENSE
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
16
+ Classifier: Programming Language :: C
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Classifier: Topic :: Scientific/Engineering :: Astronomy
23
+ Requires-Python: >=3.11
24
+ Requires-Dist: astropy>=5.3.0
25
+ Requires-Dist: cffi>=1.17.1
26
+ Requires-Dist: colorlog>=6.8.0
27
+ Requires-Dist: corner>=2.2.0
28
+ Requires-Dist: emcee>=3.1.0
29
+ Requires-Dist: joblib>=1.3.0
30
+ Requires-Dist: jsonschema>=4.20.0
31
+ Requires-Dist: matplotlib>=3.8.0
32
+ Requires-Dist: numpy>=1.26.0
33
+ Requires-Dist: pillow>=10.0.0
34
+ Requires-Dist: python-dateutil>=2.8.0
35
+ Requires-Dist: scikit-image>=0.22.0
36
+ Requires-Dist: scipy>=1.11.0
37
+ Requires-Dist: spectres>=2.2.0
38
+ Requires-Dist: tqdm>=4.66.0
39
+ Requires-Dist: wget>=3.2
40
+ Provides-Extra: dev
41
+ Requires-Dist: pre-commit>=3.5.0; extra == 'dev'
42
+ Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
43
+ Requires-Dist: pytest>=7.4.0; extra == 'dev'
44
+ Requires-Dist: ruff>=0.8.0; extra == 'dev'
45
+ Requires-Dist: setuptools; extra == 'dev'
46
+ Requires-Dist: sphinx>=7.2.0; extra == 'dev'
47
+ Description-Content-Type: text/markdown
48
+
49
+ [![CI](https://github.com/ivh/PyReduce/actions/workflows/python-publish.yml/badge.svg)](https://github.com/ivh/PyReduce/actions/workflows/python-publish.yml)
50
+ [![Documentation Status](https://readthedocs.org/projects/pyreduce-astro/badge/?version=latest)](https://pyreduce-astro.readthedocs.io/en/latest/?badge=latest)
51
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
52
+
53
+ # PyReduce
54
+
55
+ PyReduce is a port of the [REDUCE](http://www.astro.uu.se/~piskunov/RESEARCH/REDUCE/) package to Python.
56
+ It is a complete data reduction pipeline for the echelle spectrographs, e.g. HARPS or UVES.
57
+
58
+ The methods are descibed in the papers
59
+ * Original REDUCE: Piskunov & Valenti (2001) [doi:10.1051/0004-6361:20020175](https://doi.org/10.1051/0004-6361:20020175)
60
+ * Updates to curved slit extraction and PyReduce: Piskunov, Wehrhahn & Marquart (2021) [10.1051/0004-6361/202038293](https://doi.org/10.1051/0004-6361/202038293)
61
+
62
+ Some documentation on how to use PyReduce is available at [ReadTheDocs](https://pyreduce-astro.readthedocs.io/en/latest/index.html).
63
+
64
+ Installation
65
+ ------------
66
+
67
+ ### For Users
68
+
69
+ The latest version can be installed with pip:
70
+
71
+ ```bash
72
+ pip install git+https://github.com/ivh/PyReduce
73
+ ```
74
+
75
+ The version available from PyPI is slightly outdated, but functional: ``pip install pyreduce-astro``.
76
+
77
+ ### For Development
78
+
79
+ If you foresee making changes to PyReduce itself, clone the repository and use [uv](https://docs.astral.sh/uv/) for fast, modern package management:
80
+
81
+ ```bash
82
+ git clone <your fork url>
83
+ cd PyReduce/
84
+ uv sync
85
+ ```
86
+
87
+ This will automatically:
88
+ - Create a virtual environment
89
+ - Install all dependencies
90
+ - Build the CFFI C extensions
91
+ - Install PyReduce in editable mode
92
+
93
+ To run commands, use `uv run`:
94
+ ```bash
95
+ uv run pytest # Run tests
96
+ uv run python examples/uves_example.py # Run example
97
+ ```
98
+
99
+ **Note:** PyReduce uses CFFI to link to C code. On non-Linux platforms you might need to install libffi.
100
+ See https://cffi.readthedocs.io/en/latest/installation.html#platform-specific-instructions for details.
101
+
102
+ Output Format
103
+ -------------
104
+ PyReduce will create ``.ech`` files when run. Despite the name those are just regular ``.fits`` files and can be opened with any programm that can read ``.fits``. The data is contained in a table extension. The header contains all the keywords of the input science file, plus some extra PyReduce specific keyword, all of which start with ``e_``.
105
+
106
+ How To
107
+ ------
108
+ PyReduce is designed to be easy to use, but still be flexible.
109
+ ``examples/uves_example.py`` is a good starting point, to understand how it works.
110
+ First we define the instrument, target, night, and instrument mode (if applicable) of our reduction. Then we tell PyReduce where to find the data, and lastly we define all the specific settings of the reduction (e.g. polynomial degrees of various fits) in a json configuration file.
111
+ We also define which steps of the reduction to perform. Steps that are not specified, but are still required, will be loaded from previous runs if possible, or executed otherwise.
112
+ All of this is then passed to pyreduce.reduce.main to start the reduction.
113
+
114
+ In this example, PyReduce will plot all intermediary results, and also plot the progres during some of the steps. Close them to continue calculations, if it seems nothing is happening. Once you are statisified with the results you can disable them in settings_UVES.json (with "plot":false in each step) to speed up the computation.
@@ -1,22 +1,55 @@
1
- ![Python application](https://github.com/AWehrhahn/PyReduce/workflows/Python%20application/badge.svg)
1
+ [![CI](https://github.com/ivh/PyReduce/actions/workflows/python-publish.yml/badge.svg)](https://github.com/ivh/PyReduce/actions/workflows/python-publish.yml)
2
2
  [![Documentation Status](https://readthedocs.org/projects/pyreduce-astro/badge/?version=latest)](https://pyreduce-astro.readthedocs.io/en/latest/?badge=latest)
3
- [![Updates](https://pyup.io/repos/github/AWehrhahn/PyReduce/shield.svg)](https://pyup.io/repos/github/AWehrhahn/PyReduce/)
3
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
4
4
 
5
- # PyREDUCE
5
+ # PyReduce
6
6
 
7
- PyReduce is a port of the [REDUCE](http://www.astro.uu.se/~piskunov/RESEARCH/REDUCE/) package to Python3.
7
+ PyReduce is a port of the [REDUCE](http://www.astro.uu.se/~piskunov/RESEARCH/REDUCE/) package to Python.
8
8
  It is a complete data reduction pipeline for the echelle spectrographs, e.g. HARPS or UVES.
9
9
 
10
- Detailed documentation is available at [ReadTheDocs](https://pyreduce-astro.readthedocs.io/en/latest/index.html).
10
+ The methods are descibed in the papers
11
+ * Original REDUCE: Piskunov & Valenti (2001) [doi:10.1051/0004-6361:20020175](https://doi.org/10.1051/0004-6361:20020175)
12
+ * Updates to curved slit extraction and PyReduce: Piskunov, Wehrhahn & Marquart (2021) [10.1051/0004-6361/202038293](https://doi.org/10.1051/0004-6361/202038293)
13
+
14
+ Some documentation on how to use PyReduce is available at [ReadTheDocs](https://pyreduce-astro.readthedocs.io/en/latest/index.html).
11
15
 
12
16
  Installation
13
17
  ------------
14
- PyReduce can be installed using pip using the following command: ``pip install pyreduce-astro``
15
18
 
16
- The most up-to-date version can be installed using ``pip install git+https://github.com/AWehrhahn/PyReduce`` instead. However this may be more buggy than the stable version.
19
+ ### For Users
20
+
21
+ The latest version can be installed with pip:
22
+
23
+ ```bash
24
+ pip install git+https://github.com/ivh/PyReduce
25
+ ```
26
+
27
+ The version available from PyPI is slightly outdated, but functional: ``pip install pyreduce-astro``.
28
+
29
+ ### For Development
30
+
31
+ If you foresee making changes to PyReduce itself, clone the repository and use [uv](https://docs.astral.sh/uv/) for fast, modern package management:
17
32
 
18
- PyReduce uses CFFI to link to the C code, on non-linux platforms you might have to install libffi.
19
- See also https://cffi.readthedocs.io/en/latest/installation.html#platform-specific-instructions for details.
33
+ ```bash
34
+ git clone <your fork url>
35
+ cd PyReduce/
36
+ uv sync
37
+ ```
38
+
39
+ This will automatically:
40
+ - Create a virtual environment
41
+ - Install all dependencies
42
+ - Build the CFFI C extensions
43
+ - Install PyReduce in editable mode
44
+
45
+ To run commands, use `uv run`:
46
+ ```bash
47
+ uv run pytest # Run tests
48
+ uv run python examples/uves_example.py # Run example
49
+ ```
50
+
51
+ **Note:** PyReduce uses CFFI to link to C code. On non-Linux platforms you might need to install libffi.
52
+ See https://cffi.readthedocs.io/en/latest/installation.html#platform-specific-instructions for details.
20
53
 
21
54
  Output Format
22
55
  -------------
@@ -31,9 +64,3 @@ We also define which steps of the reduction to perform. Steps that are not speci
31
64
  All of this is then passed to pyreduce.reduce.main to start the reduction.
32
65
 
33
66
  In this example, PyReduce will plot all intermediary results, and also plot the progres during some of the steps. Close them to continue calculations, if it seems nothing is happening. Once you are statisified with the results you can disable them in settings_UVES.json (with "plot":false in each step) to speed up the computation.
34
-
35
- Papers
36
- ------
37
- The original REDUCE paper: [doi:10.1051/0004-6361:20020175](https://doi.org/10.1051/0004-6361:20020175)
38
-
39
- A paper describing the changes and updates of PyReduce can be found here: [https://ui.adsabs.harvard.edu/abs/2021A%26A...646A..32P/abstract](https://ui.adsabs.harvard.edu/abs/2021A%26A...646A..32P/abstract)
@@ -0,0 +1,99 @@
1
+ """
2
+ Hatch build hook for compiling CFFI extensions.
3
+
4
+ This hook runs during the build process to compile the CFFI C extensions
5
+ before the wheel is created.
6
+ """
7
+
8
+ import os
9
+ import sys
10
+ from pathlib import Path
11
+
12
+ from hatchling.builders.hooks.plugin.interface import BuildHookInterface
13
+
14
+
15
+ class CustomBuildHook(BuildHookInterface):
16
+ """Build hook that compiles CFFI extensions."""
17
+
18
+ def initialize(self, version, build_data):
19
+ """
20
+ Initialize the build hook and compile CFFI extensions.
21
+
22
+ This method is called by hatchling during the build process.
23
+ """
24
+ # Mark wheel as platform-specific (not py3-none-any)
25
+ build_data["pure_python"] = False
26
+ build_data["infer_tag"] = True
27
+
28
+ print("=" * 60)
29
+ print("Building CFFI extensions for PyReduce")
30
+ print("=" * 60)
31
+
32
+ # Get paths
33
+ project_root = Path(self.root)
34
+ clib_dir = project_root / "pyreduce" / "clib"
35
+
36
+ # Add project root to sys.path so we can import
37
+ if str(project_root) not in sys.path:
38
+ sys.path.insert(0, str(project_root))
39
+
40
+ try:
41
+ # Import the CFFI FFI builder
42
+ from cffi import FFI
43
+
44
+ # Build vertical extraction
45
+ print("\n[1/2] Building vertical extraction extension...")
46
+ ffibuilder_vertical = FFI()
47
+
48
+ with open(clib_dir / "slit_func_bd.h") as f:
49
+ ffibuilder_vertical.cdef(f.read())
50
+
51
+ with open(clib_dir / "slit_func_bd.c") as f:
52
+ ffibuilder_vertical.set_source(
53
+ "_slitfunc_bd",
54
+ f.read(),
55
+ include_dirs=[str(clib_dir), str(clib_dir / "Release")],
56
+ depends=["slit_func_bd.h"],
57
+ )
58
+
59
+ old_cwd = os.getcwd()
60
+ try:
61
+ os.chdir(clib_dir)
62
+ ffibuilder_vertical.compile(verbose=True)
63
+ print("[OK] Vertical extraction extension built successfully\n")
64
+ finally:
65
+ os.chdir(old_cwd)
66
+
67
+ # Build curved extraction
68
+ print("[2/2] Building curved extraction extension...")
69
+ ffibuilder_curved = FFI()
70
+
71
+ with open(clib_dir / "slit_func_2d_xi_zeta_bd.h") as f:
72
+ ffibuilder_curved.cdef(f.read())
73
+
74
+ with open(clib_dir / "slit_func_2d_xi_zeta_bd.c") as f:
75
+ ffibuilder_curved.set_source(
76
+ "_slitfunc_2d",
77
+ f.read(),
78
+ include_dirs=[str(clib_dir), str(clib_dir / "Release")],
79
+ depends=["slit_func_2d_xi_zeta_bd.h"],
80
+ )
81
+
82
+ old_cwd = os.getcwd()
83
+ try:
84
+ os.chdir(clib_dir)
85
+ ffibuilder_curved.compile(verbose=True)
86
+ print("[OK] Curved extraction extension built successfully\n")
87
+ finally:
88
+ os.chdir(old_cwd)
89
+
90
+ print("=" * 60)
91
+ print("All CFFI extensions built successfully!")
92
+ print("=" * 60)
93
+
94
+ except Exception as e:
95
+ print(f"ERROR: Failed to build CFFI extensions: {e}", file=sys.stderr)
96
+ import traceback
97
+
98
+ traceback.print_exc()
99
+ raise
@@ -0,0 +1,209 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.25.0", "cffi>=1.17.1", "setuptools"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "pyreduce-astro"
7
+ version = "0.6.0"
8
+ requires-python = ">=3.11"
9
+ description = "A data reduction package for echelle spectrographs"
10
+ readme = "README.md"
11
+ authors = [
12
+ {name = "Nikolai Piskunov"},
13
+ {name = "Thomas Marquart"},
14
+ {name = "Ansgar Wehrhahn"}
15
+ ]
16
+ maintainers = [
17
+ {name = "Thomas Marquart", email = "thomas.marquart@astro.uu.se"}
18
+ ]
19
+ license = {text = "GPL-3.0-or-later"}
20
+ classifiers = [
21
+ "Development Status :: 4 - Beta",
22
+ "Intended Audience :: Science/Research",
23
+ "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
24
+ "Programming Language :: C",
25
+ "Programming Language :: Python :: 3",
26
+ "Programming Language :: Python :: 3.11",
27
+ "Programming Language :: Python :: 3.12",
28
+ "Programming Language :: Python :: 3.13",
29
+ "Programming Language :: Python :: 3.14",
30
+ "Topic :: Scientific/Engineering :: Astronomy",
31
+ ]
32
+
33
+ dependencies = [
34
+ "cffi>=1.17.1",
35
+ "numpy>=1.26.0",
36
+ "matplotlib>=3.8.0",
37
+ "scipy>=1.11.0",
38
+ "astropy>=5.3.0",
39
+ "colorlog>=6.8.0",
40
+ "corner>=2.2.0",
41
+ "emcee>=3.1.0",
42
+ "joblib>=1.3.0",
43
+ "jsonschema>=4.20.0",
44
+ "spectres>=2.2.0",
45
+ "python-dateutil>=2.8.0",
46
+ "scikit-image>=0.22.0",
47
+ "tqdm>=4.66.0",
48
+ "wget>=3.2",
49
+ "Pillow>=10.0.0",
50
+ ]
51
+
52
+ [project.optional-dependencies]
53
+ dev = [
54
+ "ruff>=0.8.0",
55
+ "pre-commit>=3.5.0",
56
+ "pytest>=7.4.0",
57
+ "pytest-cov>=4.1.0",
58
+ "sphinx>=7.2.0",
59
+ "setuptools", # Required for CFFI compilation in tests (Python 3.12+)
60
+ ]
61
+
62
+ [project.urls]
63
+ Homepage = "https://github.com/ivh/PyReduce"
64
+ Documentation = "https://pyreduce-astro.readthedocs.io"
65
+ Repository = "https://github.com/ivh/PyReduce"
66
+ Issues = "https://github.com/ivh/PyReduce/issues"
67
+
68
+ # Hatch build configuration
69
+ [tool.hatch.build]
70
+ packages = ["pyreduce"]
71
+ exclude = [
72
+ "/.git",
73
+ "/.github",
74
+ "/docs",
75
+ "/tests",
76
+ "*.pyc",
77
+ "__pycache__",
78
+ ]
79
+
80
+ # Include C source files and headers in the package
81
+ [tool.hatch.build.targets.wheel]
82
+ packages = ["pyreduce"]
83
+ include = [
84
+ "pyreduce/**/*.py",
85
+ "pyreduce/**/*.c",
86
+ "pyreduce/**/*.h",
87
+ "pyreduce/**/*.so", # Linux/macOS compiled extensions
88
+ "pyreduce/**/*.pyd", # Windows compiled extensions
89
+ "pyreduce/**/*.json",
90
+ "pyreduce/**/*.npz",
91
+ "pyreduce/**/*.sav",
92
+ ]
93
+ artifacts = [
94
+ "pyreduce/clib/*.so", # Linux/macOS compiled extensions
95
+ "pyreduce/clib/*.pyd", # Windows compiled extensions
96
+ ]
97
+
98
+ # Build CFFI extensions via build hook
99
+ [tool.hatch.build.hooks.custom]
100
+ path = "hatch_build.py"
101
+
102
+ # Ruff - Modern Python linter and formatter
103
+ [tool.ruff]
104
+ line-length = 88
105
+ target-version = "py313"
106
+ extend-exclude = [
107
+ ".git",
108
+ ".hg",
109
+ ".mypy_cache",
110
+ ".tox",
111
+ ".venv",
112
+ "_build",
113
+ "buck-out",
114
+ "build",
115
+ "dist",
116
+ ".eggs",
117
+ "__pycache__",
118
+ ]
119
+
120
+ [tool.ruff.format]
121
+ quote-style = "double"
122
+ indent-style = "space"
123
+ skip-magic-trailing-comma = false
124
+ line-ending = "auto"
125
+
126
+ [tool.ruff.lint]
127
+ select = [
128
+ "E", # pycodestyle errors
129
+ "W", # pycodestyle warnings
130
+ "F", # pyflakes
131
+ "I", # isort
132
+ "B", # flake8-bugbear
133
+ "C4", # flake8-comprehensions
134
+ "UP", # pyupgrade
135
+ ]
136
+ ignore = [
137
+ "E501", # line too long (handled by formatter)
138
+ "E402", # module import not at top (legitimate cases in __init__.py, conf.py)
139
+ "E722", # bare except (many legacy cases, would require significant refactoring)
140
+ "UP031", # printf-style formatting (many cases in tools/ and examples/, low priority)
141
+ ]
142
+
143
+ # Per-file ignores for specific cases
144
+ [tool.ruff.lint.per-file-ignores]
145
+ "__init__.py" = ["F401"] # unused imports are intentional for re-exports
146
+ "docs/conf.py" = ["E402"] # imports after sys.path modification
147
+ "tools/**" = ["UP031", "B904"] # legacy tools, lower priority
148
+ "examples/**" = ["UP031"] # examples can use simpler syntax
149
+
150
+ [tool.ruff.lint.isort]
151
+ known-first-party = ["pyreduce"]
152
+
153
+ # pytest configuration
154
+ [tool.pytest.ini_options]
155
+ minversion = "7.0"
156
+ addopts = "-ra -q --strict-markers"
157
+ testpaths = ["test"]
158
+ python_files = ["test_*.py", "*_test.py"]
159
+ python_classes = ["Test*"]
160
+ python_functions = ["test_*"]
161
+ markers = [
162
+ "unit: Fast unit tests with synthetic data (no downloads)",
163
+ "instrument: Integration tests using real instrument datasets",
164
+ "slow: Tests taking >5 seconds",
165
+ "downloads: Tests that download sample datasets",
166
+ ]
167
+
168
+ # Coverage configuration
169
+ [tool.coverage.run]
170
+ source = ["pyreduce"]
171
+ omit = ["*/tests/*", "*/test_*.py"]
172
+
173
+ [tool.coverage.report]
174
+ exclude_lines = [
175
+ "pragma: no cover",
176
+ "def __repr__",
177
+ "raise AssertionError",
178
+ "raise NotImplementedError",
179
+ "if __name__ == .__main__.:",
180
+ "if TYPE_CHECKING:",
181
+ "class .*\\bProtocol\\):",
182
+ "@(abc\\.)?abstractmethod",
183
+ ]
184
+
185
+ # Development dependency groups
186
+ [dependency-groups]
187
+ dev = [
188
+ "ruff>=0.8.0",
189
+ "pre-commit>=3.5.0",
190
+ "pytest>=7.4.0",
191
+ "pytest-cov>=4.1.0",
192
+ "sphinx>=7.2.0",
193
+ ]
194
+
195
+ # cibuildwheel configuration for building platform-specific wheels
196
+ [tool.cibuildwheel]
197
+ build = "cp311-* cp312-* cp313-* cp314-*"
198
+ skip = "*-musllinux_* *-win32 *-manylinux_i686"
199
+ test-command = "pytest {project}/test -m unit"
200
+ test-requires = ["pytest"]
201
+
202
+ [tool.cibuildwheel.linux]
203
+ archs = ["x86_64"]
204
+
205
+ [tool.cibuildwheel.macos]
206
+ archs = ["arm64"]
207
+
208
+ [tool.cibuildwheel.windows]
209
+ archs = ["AMD64"]
@@ -1,9 +1,13 @@
1
- # -*- coding: utf-8 -*-
2
- # Define Version
3
- from ._version import get_versions
1
+ try:
2
+ from importlib.metadata import PackageNotFoundError, version
3
+ except ImportError: # for Python<3.8
4
+ from importlib_metadata import PackageNotFoundError, version
5
+
6
+ try:
7
+ __version__ = version("pyreduce-astro")
8
+ except PackageNotFoundError:
9
+ __version__ = "unknown"
4
10
 
5
- __version__ = get_versions()["version"]
6
- del get_versions
7
11
 
8
12
  # add logger to console
9
13
  import logging
@@ -50,5 +54,14 @@ logger.addHandler(console)
50
54
  del logging
51
55
  # do not del tqdm, it is needed in the Log Handler
52
56
 
53
- # Load externally available modules
54
- from . import configuration, datasets, reduce, util
57
+
58
+ # Lazy loading for faster imports
59
+ def __getattr__(name):
60
+ """Lazy load submodules on first access."""
61
+ if name in ("configuration", "datasets", "reduce", "util"):
62
+ import importlib
63
+
64
+ module = importlib.import_module(f".{name}", __name__)
65
+ globals()[name] = module
66
+ return module
67
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  This is used when pyreduce is used as a script
4
3
  """
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env python3
2
- # -*- coding: utf-8 -*-
3
2
  """Builds the C library that contains the extraction algorithm
4
3
 
5
4
  This module prepares and builds the C libary containing the curved
@@ -38,7 +37,7 @@ print("Release dir: ", release_path)
38
37
  ffibuilder_vertical = FFI()
39
38
  with open(os.path.join(CWD, "slit_func_bd.h")) as f:
40
39
  ffibuilder_vertical.cdef(f.read())
41
- with open(os.path.join(CWD, "slit_func_bd.c"), "r") as f:
40
+ with open(os.path.join(CWD, "slit_func_bd.c")) as f:
42
41
  ffibuilder_vertical.set_source(
43
42
  "_slitfunc_bd",
44
43
  f.read(),
@@ -49,7 +48,7 @@ with open(os.path.join(CWD, "slit_func_bd.c"), "r") as f:
49
48
  ffibuilder_curved = FFI()
50
49
  with open(os.path.join(CWD, "slit_func_2d_xi_zeta_bd.h")) as f:
51
50
  ffibuilder_curved.cdef(f.read())
52
- with open(os.path.join(CWD, "slit_func_2d_xi_zeta_bd.c"), "r") as f:
51
+ with open(os.path.join(CWD, "slit_func_2d_xi_zeta_bd.c")) as f:
53
52
  ffibuilder_curved.set_source(
54
53
  "_slitfunc_2d",
55
54
  f.read(),
@@ -1278,3 +1278,36 @@ int slit_func_curved(int ncols,
1278
1278
 
1279
1279
  return 0;
1280
1280
  }
1281
+
1282
+ int create_spectral_model(int ncols, int nrows, int osample, xi_ref* xi, double* spec, double* slitfunc, double* img){
1283
+ int ny, pix_x, pix_y, x, iy, m;
1284
+ double pix_w;
1285
+
1286
+ ny = (nrows + 1) * osample + 1;
1287
+
1288
+ for (x = 0; x < ncols; x++)
1289
+ {
1290
+ for (iy = 0; iy < nrows+1; iy++)
1291
+ {
1292
+ img[im_index(x, iy)] = 0;
1293
+ }
1294
+
1295
+ }
1296
+
1297
+ for (x = 0; x < ncols; x++)
1298
+ {
1299
+ for (iy = 0; iy < ny; iy++)
1300
+ {
1301
+ for (m = 0; m < 4; m++)
1302
+ {
1303
+ pix_x = xi[xi_index(x, iy, m)].x;
1304
+ pix_y = xi[xi_index(x, iy, m)].y;
1305
+ pix_w = xi[xi_index(x, iy, m)].w;
1306
+ if ((pix_x != -1) && (pix_y != -1) && (pix_w != 0)){
1307
+ img[im_index(pix_x, pix_y)] += pix_w * spec[x] * slitfunc[iy];
1308
+ }
1309
+ }
1310
+ }
1311
+ }
1312
+ return 0;
1313
+ }
@@ -31,3 +31,25 @@ int slit_func_curved(int ncols,
31
31
  double *model,
32
32
  double *unc,
33
33
  double *info);
34
+
35
+ int xi_zeta_tensors(
36
+ int ncols,
37
+ int nrows,
38
+ int ny,
39
+ double *ycen,
40
+ int *ycen_offset,
41
+ int y_lower_lim,
42
+ int osample,
43
+ double *PSF_curve,
44
+ xi_ref *xi,
45
+ zeta_ref *zeta,
46
+ int *m_zeta);
47
+
48
+ int create_spectral_model(
49
+ int ncols,
50
+ int nrows,
51
+ int osample,
52
+ xi_ref* xi,
53
+ double* spec,
54
+ double* slitfunc,
55
+ double* img);
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Module that
4
3
  - Clips remove pre- and overscan regions