hyper-py-photometry 0.1.0__py3-none-any.whl → 0.1.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
hyper_py/config.yaml ADDED
@@ -0,0 +1,136 @@
1
+ #--------------------- File Paths ---------------------#
2
+ paths:
3
+ input:
4
+ dir_maps: ./maps # [REQUIRED] Directory containing input map files. Default: ./maps
5
+ output:
6
+ dir_root: ./output # [REQUIRED] Root directory for output data. Default: ./output
7
+ dir_table_out: params # [REQUIRED] Subdirectory of dir_root for params. Default: params
8
+ dir_region_out: regions # [REQUIRED] Subdirectory of dir_root for region files (output). Default: regions
9
+ dir_log_out: logs # [REQUIRED] Subdirectory of dir_root for log files. Default: logs
10
+
11
+
12
+ #--------------------- File Names ---------------------#
13
+ files:
14
+ file_map_name: 'maps_list.txt' # [REQUIRED] Input FITS map(s) for analysis (in dir_maps). Default: 'maps_list.txt'
15
+ file_table_base: "params" # [REQUIRED] Base filename for photometry output tables (in dir_table_out). Default: "params"
16
+ file_region_base: "region_files" # [REQUIRED] Base filename for output ellipse region files (in dir_region_out). Default: "region_files"
17
+ file_log_name: "hyper_py.log" # [REQUIRED] Name of the global log file (in dir_log_out). Default: "hyper_py.log"
18
+
19
+
20
+ #--------------------- Pipeline Control ---------------------#
21
+ control:
22
+ parallel_maps: true # [REQUIRED] Enable parallel execution over multiple maps (True/False). Default: True
23
+ n_cores: 2 # [REQUIRED] Number of CPU cores to use for multiprocessing - better <= tot maps. Default: 2
24
+ detection_only: false # [REQUIRED] Only perform source detection without photometry (True/False). Default: False
25
+ datacube: false # [REQUIRED] Select if the input map is a datacube. Default: False
26
+
27
+ dir_datacube_slices: maps # [OPTIONAL] Subdirectory of dir_root for slices fits files (only if datacube = true). Default: maps
28
+
29
+
30
+ #--------------------- Units Conversion ---------------------#
31
+ units:
32
+ convert_mJy: true # [REQUIRED] Convert fluxes to mJy in the final output (True/False). Default: False (Jy)
33
+
34
+
35
+ #--------------------- Survey Settings ---------------------#
36
+ survey:
37
+ survey_code: 15 # [REQUIRED] Numeric identifier for the survey parameters such as beam size. Default: 15
38
+
39
+ # Survey code reference:
40
+ # -----------------------------------------------
41
+ # | Code | Survey |
42
+ # -----------------------------------------------
43
+ # | 1 | Herschel PACS 70 µm |
44
+ # | 2 | Herschel PACS 100 µm |
45
+ # | 3 | Herschel PACS 160 µm |
46
+ # | 4 | Herschel SPIRE 250 µm |
47
+ # | 5 | Herschel SPIRE 350 µm |
48
+ # | 6 | Herschel SPIRE 500 µm |
49
+ # | 7 | JCMT 450 µm |
50
+ # | 8 | JCMT 850 µm (ATLASGAL) |
51
+ # |
52
+ # | 15 | Dynamic from the header info |
53
+ # -----------------------------------------------
54
+
55
+
56
+ #--------------------- Source Detection ---------------------#
57
+ detection:
58
+ sigma_thres: 4.0 # [REQUIRED] Detection threshold in units of RMS (sigma). Default: 4.0
59
+
60
+ use_manual_rms: false # [OPTIONAL] Use manually provided RMS noise value to identify sources (True/False). Default: False
61
+ rms_value: 1.e-6 # [OPTIONAL] Manual RMS noise value (Jy) (only if use_manual_rms = true). Default: 1.e-6
62
+
63
+ roundlim: [-4.0, 4.0] # [ADVANCED] Allowed source roundness range (min, max for DAOFIND). Default: [-4.0, 4.0]
64
+ sharplim: [-2.0, 2.0] # [ADVANCED] Allowed source sharpness range (min, max for DAOFIND). Default: [-2.0, 2.0]
65
+
66
+ use_fixed_source_table: false # [OPTIONAL] If True, use an external IPAC table for peak + aperture. Default: False
67
+ fixed_source_table_path: "source_table.txt" # [OPTIONAL] IPAC table with 6 columns: ID, RA, DEC, FWHM_1, FWHM_2, PA (in dir_root). Default: "source_table.txt"
68
+ fixed_peaks: false # [OPTIONAL] Use fixed peaks instead of automatic (True/False). Default: False
69
+ xcen_fix: [1.0, 1.0] # [OPTIONAL] Fixed peak coordinates (deg, same unit as in the map header; only if fixed_peaks is true). Default: [1.0, 1.0]
70
+ ycen_fix: [1.0, 1.0] # [OPTIONAL] Fixed peak coordinates (deg, same unit as in the map header; only if fixed_peaks is true). Default: [1.0, 1.0]
71
+
72
+
73
+ #--------------------- Photometry Settings ---------------------#
74
+ photometry:
75
+ aper_inf: 1.0 # [REQUIRED] Minimum size factor for Gaussian FWHM (used as minimum radius). Default: 1.0
76
+ aper_sup: 2.0 # [REQUIRED] Maximum size factor for Gaussian FWHM (used as maximum radius). Default: 2.0
77
+
78
+ fixed_radius: false # [OPTIONAL] Use fixed aperture radii instead of Gaussian fitting (True/False). Default: False
79
+ fwhm_1: [0.0] # [OPTIONAL] Fixed FWHM aperture radius major axis (arcsec; only if radius_fix = true). Default: [0.0]
80
+ fwhm_2: [0.0] # [OPTIONAL] Fixed FWHM aperture radius minor axis (arcsec; only if radius_fix = true). Default: [0.0]
81
+ PA_val: [0.0] # [OPTIONAL] Fixed aperture position angle (deg East of North; only if radius_fix = true). Default: [0.0]
82
+
83
+
84
+ #---------------------- Model fit Settings ----------------------#
85
+ fit_options:
86
+ fit_method: "least_squares" # [REQUIRED] Optimization algorithm for Gaussian fitting ('least_squares'). Default: "least_squares"
87
+
88
+ loss: linear # [ADVANCED] "soft_l1", "huber", "cauchy", "linear". Default: "linear"
89
+ f_scale: 0.1 # [ADVANCED] Relevant for soft_l1, huber, cauchy. Default: 0.1
90
+ max_nfev: 50000 # [ADVANCED] Maximum number of function evaluations. Default: 50000
91
+ xtol: 1e-8 # [ADVANCED] Tolerance on parameter change for convergence. Default: 1e-8
92
+ ftol: 1e-8 # [ADVANCED] Tolerance on cost function change for convergence. Default: 1e-8
93
+ gtol: 1e-8 # [ADVANCED] Tolerance on gradient orthogonality. Default: 1e-8
94
+
95
+ weights: "snr" # [REQUIRED] Weighting scheme: 'null', 'inverse_rms', 'snr', 'power_snr', 'map', or 'mask'. Default: "snr"
96
+ power_snr: 5 # [OPTIONAL] SNR**power_snr - this value gives more weight to the bright pixels (only if weights = "power_snr"). Default: 5
97
+
98
+ calc_covar: false # [ADVANCED] Estimate parameter covariance matrix. Default: False
99
+ min_method: "nmse" # [ADVANCED] Criterion to select best fit: 'nmse', 'redchi', or 'bic'. Default: "nmse"
100
+ verbose: false # [ADVANCED] Print full fit report. Default: False
101
+ use_l2_regularization: true # [ADVANCED] Enable L2 regularization on background terms (only in Gaussian+background fitting). Default: True
102
+ lambda_l2: 1e-4 # [ADVANCED] Regularization strength. Default: 1e-4
103
+ vary: false # [ADVANCED] Allow source peak to vary during Gaussian fit. Default: False
104
+ bg_fitters: ['least_squares'] # [ADVANCED] Background fitting methods to try: 'least_squares', 'huber', 'theilsen'. Default: ['least_squares']
105
+ huber_epsilons: [1.1, 1.35, 1.7, 2.0] # [ADVANCED] List of epsilon values for HuberRegressor (used only if 'huber' is in bg_fitters). Default: [1.1, 1.35, 1.7, 2.0]
106
+
107
+
108
+ #--------------------- Background Estimation ---------------------#
109
+ background:
110
+ fit_gauss_and_bg_separately: true # [REQUIRED] Estimate Gaussian components and background separately. Default: True
111
+ pol_orders_separate: [0, 1, 2] # [OPTIONAL] For initial separated background subtraction /only if fit_gauss_and_bg_separately = true, orders: 0,1,2,3, etc. Default: [0, 1, 2]
112
+ fix_min_box: 3 # [OPTIONAL] Minimum box size as multiple of FWHMs for variable-size background fitting (half-size increment). If = 0 estimate background on the whole map
113
+ fix_max_box: 5 # [OPTIONAL] Maximum box size as multiple of FWHMs for variable-size background fitting (half-size increment). Default: 5
114
+
115
+ fit_gauss_and_bg_together: false # [REQUIRED] Enable polynomial background subtraction and Gaussian fit simultaneously (True/False). Default: False
116
+ polynomial_orders: [0] # [OPTIONAL] Polynomial background orders for the main Gaussian + background fitting (0,1,2,3, etc.). Default: [0]
117
+
118
+
119
+ #--------------------- Fits output Options ---------------------#
120
+ fits_output: # Save Fits files for best fits
121
+ fits_fitting: false # [OPTIONAL] Best fit model group fits files. Default: False
122
+ fits_deblended: false # [OPTIONAL] Deblended per-source fits files. Default: False
123
+ fits_bg_separate: false # [OPTIONAL] Best fit background separated model group fits files (only if fit_gauss_and_bg_separately = true). Default: False
124
+ fits_output_dir_fitting: fits/fitting # [OPTIONAL] Subdirectory of dir_root. Default: fits/fitting
125
+ fits_output_dir_deblended: fits/deblended # [OPTIONAL] Subdirectory of dir_root. Default: fits/deblended
126
+ fits_output_dir_bg_separate: fits/bg_separate # [OPTIONAL] Subdirectory of dir_root. Default: fits/bg_separate
127
+
128
+
129
+ #--------------------- Visualization Options ---------------------#
130
+ visualization: # Plot and save PNGs for the best Gaussian+background fit. Default: False
131
+ visualize_fitting: false # [OPTIONAL] Visualize final Gaussian+background fit. Default: False
132
+ visualize_deblended: false # [OPTIONAL] For per-source blended maps. Default: False
133
+ visualize_bg_separate: false # [OPTIONAL] Visualize background model from masked fit (only if fit_gauss_and_bg_separately = true). Default: False
134
+ output_dir_fitting: plots/fitting # [OPTIONAL] Subdirectory of dir_root. Default: plots/fitting
135
+ output_dir_deblended: plots/deblended # [OPTIONAL] Subdirectory of dir_root. Default: plots/deblended
136
+ output_dir_bg_separate: plots/bg_separate # [OPTIONAL] Subdirectory of dir_root. Default: plots/bg_separate
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hyper-py-photometry
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: HYPER: Hybrid Photometry Photometry and Extraction Routine
5
5
  Author-email: Alessio Traficante <alessio.traficante@inaf.it>
6
6
  Project-URL: Homepage, https://github.com/alessio-traficante/hyper-py
@@ -80,6 +80,10 @@ Before using `Hyper-py`, make sure you have all the necessary Python dependencie
80
80
  • photutils
81
81
  • matplotlib
82
82
  • lmfit
83
+ • pyyaml
84
+ • numpy
85
+ • scipy
86
+ • scikit-learn>=1.4,<1.6
83
87
 
84
88
  This will install the necessary packages using `pip`:
85
89
 
@@ -96,7 +100,6 @@ You can install and use `Hyper-py` in two different ways, depending on your need
96
100
  If you want to modify, extend, or integrate `Hyper-py` in your own projects:
97
101
 
98
102
  1. Clone the repository or download the source code.
99
-
100
103
  ```bash
101
104
  git clone https://github.com/Alessio-Traficante/hyper-py.git
102
105
  ```
@@ -113,14 +116,10 @@ import sys
113
116
  sys.path.insert(0, "/absolute/path/to/hyper_py/src")
114
117
  ```
115
118
  ### Option 2: Install via `pip` (for direct usage)
116
- 1. Build or download the .whl package (e.g., dist/hyper_py-X.X.X-py3-none-any.whl).
117
- 2. Install the wheel file using `pip`:
118
-
119
+ Install via PyPI:
119
120
  ```bash
120
- pip install hyper_py-X.X.X-py3-none-any.whl
121
+ pip install hyper-py-photometry
121
122
  ```
122
- Use the current file version in dist folder.
123
-
124
123
 
125
124
 
126
125
  ## 🎯 Usage
@@ -131,7 +130,7 @@ You can use `Hyper-py` either by importing and running it directly from Python,
131
130
 
132
131
  ### 1. From Python
133
132
 
134
- Import and run the `cli` function, passing the path to your YAML configuration file.
133
+ Import and run the `start_hyper` function, passing the path to your YAML configuration file.
135
134
 
136
135
  ```python
137
136
  from hyper_py import run_hyper
@@ -156,6 +155,14 @@ Once the .whl package is installed (e.g., via pip install hyper_py-X.X.X-py3-non
156
155
  ```bash
157
156
  hyper_py path/to/config.yaml
158
157
  ```
158
+ OR
159
+ ```bash
160
+ hyper-py path/to/config.yaml
161
+ ```
162
+ OR
163
+ ```bash
164
+ hyper path/to/config.yaml
165
+ ```
159
166
 
160
167
  ## Using the Source Code in Visual Studio Code
161
168
  To run or debug the source code using Visual Studio Code:
@@ -168,10 +175,10 @@ To run or debug the source code using Visual Studio Code:
168
175
  ### 2. Run and debug the code
169
176
 
170
177
  To debug:
171
- - Open src/hyper_py/hyper.py or cli.py.
178
+ - Open src/hyper_py/hyper.py or run_hyper.py.
172
179
  - Set breakpoints as needed.
173
180
  - Press F5 or click the "Run and Debug" button in the sidebar.
174
- - In the launch configuration, set the entry script to src/hyper_py/cli.py.
181
+ - In the launch configuration, set the entry script to src/hyper_py/run_hyper.py.
175
182
 
176
183
  Optional: You can add this to `.vscode/launch.json` for convenience:
177
184
 
@@ -184,7 +191,7 @@ Optional: You can add this to `.vscode/launch.json` for convenience:
184
191
  "name": "Python Debugger:Run Hyper",
185
192
  "type": "debugpy",
186
193
  "request": "launch",
187
- "program": "${workspaceFolder}/src/hyper_py/cli.py",
194
+ "program": "${workspaceFolder}/src/hyper_py/run_hyper.py",
188
195
  "console": "integratedTerminal",
189
196
  "args": ["path/to/config.yaml"], // Specify a different config file
190
197
  }
@@ -355,7 +362,7 @@ All entries can be customized in your `config.yaml`. If an entry is omitted, the
355
362
 
356
363
  | File | Description |
357
364
  |-------------------------------|-------------|
358
- | `cli.py` | Main launcher for multi-map analysis (parallel or serial)
365
+ | `run_hyper.py` | Main launcher for multi-map analysis (parallel or serial)
359
366
  | `hyper.py` | Core logic for initializing the code run
360
367
  | `single_map.py` | Core logic for running detection + photometry on one map
361
368
  | `config.py` | YAML parser with access interface
@@ -2,6 +2,7 @@ hyper_py/__init__.py,sha256=BXdlhYa5Z_wBk1fo-L50xblSZF-vepSqz9kXWkewCdw,38
2
2
  hyper_py/bkg_multigauss.py,sha256=SuVlEMkPOccqOuATCaoEBU_WpQARAlHJa2qwAkglHII,22778
3
3
  hyper_py/bkg_single.py,sha256=stGiZIAFabOW3QHxakA2pJ0__HjgyvcPD2TnB3ARbZc,20269
4
4
  hyper_py/config.py,sha256=evafwkxft8YK4vbAjOlBdB796gYd4zNnHt8wJbOabPs,1473
5
+ hyper_py/config.yaml,sha256=64DJtYhwHX6XkbOyuGMmn51WwjK0uJpNafRe8CwkkO4,10616
5
6
  hyper_py/create_background_slices.py,sha256=VjR_cwRYWFFmEkpcJ8fXcnc6oSAbtY2DPjGWvbs5ecc,6090
6
7
  hyper_py/data_output.py,sha256=VKtYPBdez3N2imZFE4Ugwa9JmFFUC28J7XdVFmqhGYE,5532
7
8
  hyper_py/detection.py,sha256=txnEjnBBL0aX_Fz9Fa7ks_6AKtgbCBs15WHgF1ZBX9s,4738
@@ -18,9 +19,9 @@ hyper_py/run_hyper.py,sha256=nQwMvwggvno6PYxl06wCBXF-Rm1oftI4OzS-qNa-WbA,1873
18
19
  hyper_py/single_map.py,sha256=YXlMiixK-CLfiFjmLiqP8RkKu6JkekEDjVi-3bQu05w,28831
19
20
  hyper_py/survey.py,sha256=ymOJk-H4Bf515OwSNFkmODKk7x3MteT6l51ylaYy9Cg,2807
20
21
  hyper_py/visualization.py,sha256=AJRuR_Y-_AaZ2NwX1w07lRABV0C2-w8QP1tSqs9_kvk,5662
21
- hyper_py_photometry-0.1.0.dist-info/licenses/LICENSE,sha256=aB7cqE2-X_8mxy-EmQuVMkKmP8DQA2BnQaqD5k5C5nE,584
22
- hyper_py_photometry-0.1.0.dist-info/METADATA,sha256=xst0gBLEhLsz7NC2mvKEZtsR2xobQSM_iXN77BaiQw0,32370
23
- hyper_py_photometry-0.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
24
- hyper_py_photometry-0.1.0.dist-info/entry_points.txt,sha256=0AVwuatL0ri5juy_Ccgt_9Bd4V0McpOrWSSnNX8cCzs,120
25
- hyper_py_photometry-0.1.0.dist-info/top_level.txt,sha256=Pw-Iuf0SQwcibLdOwx4RkmEas3I6s0Ym_D0_oUnXEr4,9
26
- hyper_py_photometry-0.1.0.dist-info/RECORD,,
22
+ hyper_py_photometry-0.1.2.dist-info/licenses/LICENSE,sha256=aB7cqE2-X_8mxy-EmQuVMkKmP8DQA2BnQaqD5k5C5nE,584
23
+ hyper_py_photometry-0.1.2.dist-info/METADATA,sha256=-7jNFNFdOfWTf839S2RtV5WVsH196b8q_a6EFj34gNE,32379
24
+ hyper_py_photometry-0.1.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
25
+ hyper_py_photometry-0.1.2.dist-info/entry_points.txt,sha256=0AVwuatL0ri5juy_Ccgt_9Bd4V0McpOrWSSnNX8cCzs,120
26
+ hyper_py_photometry-0.1.2.dist-info/top_level.txt,sha256=Pw-Iuf0SQwcibLdOwx4RkmEas3I6s0Ym_D0_oUnXEr4,9
27
+ hyper_py_photometry-0.1.2.dist-info/RECORD,,