hyper-py-photometry 0.1.4__tar.gz → 0.1.5__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.
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/.github/workflows/Hyper-py_paper.yml +4 -4
- {hyper_py_photometry-0.1.4/src/hyper_py_photometry.egg-info → hyper_py_photometry-0.1.5}/PKG-INFO +87 -37
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/README.md +87 -37
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/environment.yml +2 -1
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/paper/paper.md +5 -3
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/src/hyper_py/run_hyper.py +6 -2
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5/src/hyper_py_photometry.egg-info}/PKG-INFO +87 -37
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/.github/workflows/pypi-publish.yml +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/.gitignore +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/.vscode/launch.json +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/IDL_comparison/Gaussian_comparison_Hyper_py_IDL_ALL.py +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/IDL_comparison/ellipses_map_500_Gaussians_1_centroids.reg +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/IDL_comparison/ellipses_map_500_Gaussians_1_ellipses.reg +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/IDL_comparison/ellipses_map_500_Gaussians_2_centroids.reg +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/IDL_comparison/ellipses_map_500_Gaussians_2_ellipses.reg +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/IDL_comparison/hyper_output_map_500_Gaussians_1.txt +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/IDL_comparison/hyper_output_map_500_Gaussians_2.txt +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/IDL_comparison/map_500_Gaussians_1.fits +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/IDL_comparison/map_500_Gaussians_2.fits +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/IDL_comparison/matched_flux_comparison_table.txt +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/IDL_comparison/output/Flux_Comparison_Hyper_IDL_Int_1.png +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/IDL_comparison/output/Flux_Comparison_Hyper_IDL_Int_2.png +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/IDL_comparison/output/Flux_Comparison_Hyper_IDL_Peak_1.png +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/IDL_comparison/output/Flux_Comparison_Hyper_IDL_Peak_2.png +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/IDL_comparison/output/Flux_Comparison_Hyper_IDL_vs_py_Int_1.png +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/IDL_comparison/output/Flux_Comparison_Hyper_IDL_vs_py_Int_2.png +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/IDL_comparison/output/Flux_Comparison_Hyper_IDL_vs_py_Peak_1.png +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/IDL_comparison/output/Flux_Comparison_Hyper_IDL_vs_py_Peak_2.png +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/IDL_comparison/output/Flux_Comparison_Hyper_py_Int_1.png +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/IDL_comparison/output/Flux_Comparison_Hyper_py_Int_2.png +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/IDL_comparison/output/Flux_Comparison_Hyper_py_Peak_1.png +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/IDL_comparison/output/Flux_Comparison_Hyper_py_Peak_2.png +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/IDL_comparison/output/Flux_Diff_Histogram_Int.png +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/IDL_comparison/output/Flux_Diff_Histogram_Peak.png +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/IDL_comparison/output/combined_source_counts_comparison.txt +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/IDL_comparison/output/matched_flux_comparison_table.txt +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/IDL_comparison/photometry_sources_1300_ellipses_1300_polynomial_background_4sigma_ipac_1.txt +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/IDL_comparison/photometry_sources_1300_ellipses_1300_polynomial_background_4sigma_ipac_2.txt +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/IDL_comparison/table_500_Gaussians_1.txt +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/IDL_comparison/table_500_Gaussians_2.txt +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/LICENSE +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/paper/Figures/Flux_Diff_Histogram_Int.png +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/paper/Figures/Flux_Diff_Histogram_Peak.png +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/paper/paper.bib +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/pyproject.toml +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/requirements.txt +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/setup.cfg +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/src/hyper_py/__init__.py +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/src/hyper_py/__main__.py +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/src/hyper_py/assets/default_config.yaml +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/src/hyper_py/bkg_multigauss.py +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/src/hyper_py/bkg_single.py +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/src/hyper_py/config.py +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/src/hyper_py/create_background_slices.py +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/src/hyper_py/data_output.py +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/src/hyper_py/detection.py +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/src/hyper_py/extract_cubes.py +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/src/hyper_py/fitting.py +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/src/hyper_py/gaussfit.py +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/src/hyper_py/groups.py +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/src/hyper_py/hyper.py +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/src/hyper_py/logger.py +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/src/hyper_py/map_io.py +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/src/hyper_py/paths_io.py +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/src/hyper_py/photometry.py +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/src/hyper_py/single_map.py +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/src/hyper_py/survey.py +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/src/hyper_py/visualization.py +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/src/hyper_py_photometry.egg-info/SOURCES.txt +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/src/hyper_py_photometry.egg-info/dependency_links.txt +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/src/hyper_py_photometry.egg-info/entry_points.txt +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/src/hyper_py_photometry.egg-info/requires.txt +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/src/hyper_py_photometry.egg-info/top_level.txt +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/test/maps/test_2d_map_1.fits +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/test/maps/test_2d_map_2.fits +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/test/maps/test_2dmap.txt +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/test/maps/test_datacube.fits +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/test/maps/test_datacube.txt +0 -0
- {hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/test/test_hyper.py +0 -0
{hyper_py_photometry-0.1.4/src/hyper_py_photometry.egg-info → hyper_py_photometry-0.1.5}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hyper-py-photometry
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.5
|
|
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
|
|
@@ -21,6 +21,7 @@ Dynamic: license-file
|
|
|
21
21
|
# 💫 `Hyper-py`: Hybrid Photometry Photometry and Extraction Routine in Python
|
|
22
22
|
|
|
23
23
|
**Authors:** Alessio Traficante; Fabrizio De Angelis; Alice Nucara; Milena Benedettini
|
|
24
|
+
|
|
24
25
|
**Original reference:** Traficante et al. (2015), *MNRAS, 451, 3089*
|
|
25
26
|
|
|
26
27
|
---
|
|
@@ -72,7 +73,17 @@ control:
|
|
|
72
73
|
|
|
73
74
|
If `parallel_maps` is set to `false`, the pipeline will run in serial mode.
|
|
74
75
|
|
|
76
|
+
### 💡 Tips & Tricks
|
|
75
77
|
|
|
78
|
+
- **Create a virtual environment before installation**
|
|
79
|
+
For convenience, you could set up a Python virtual environment before working with the code.
|
|
80
|
+
<br>Eg.
|
|
81
|
+
```bash
|
|
82
|
+
python -m venv .venv
|
|
83
|
+
source .venv/bin/activate # Linux / macOS
|
|
84
|
+
.venv\Scripts\activate # Windows
|
|
85
|
+
```
|
|
86
|
+
P.S.: Remember to activate it every time you work with the code! :)
|
|
76
87
|
## 🛠️ Installation
|
|
77
88
|
You can install and use `Hyper-py` in two different ways, depending on your needs:
|
|
78
89
|
|
|
@@ -120,12 +131,12 @@ pip install -r requirements.txt
|
|
|
120
131
|
|
|
121
132
|
`Hyper-py` requires a configuration file named **`hyper_config.yaml`** in order to run.
|
|
122
133
|
|
|
123
|
-
>The first time you run `Hyper-py` a new hyper_config.yaml will be created automatically in the CWD, then you must setup all paths and
|
|
134
|
+
>The first time you run `Hyper-py` a new hyper_config.yaml will be created automatically in the Current Working Directory (CWD), then you must setup all paths and parameters.<br>
|
|
124
135
|
>If you already have a configuration file ready or you have moved the new configuration file to a different folder, provide the path as argument.
|
|
125
136
|
|
|
126
137
|
If no path is provided, the application will look for it in this order:
|
|
127
|
-
1. Path passed as CLI argument
|
|
128
|
-
2. `hyper_config.yaml` in the
|
|
138
|
+
1. Path passed as Command Line Interface (CLI) argument
|
|
139
|
+
2. `hyper_config.yaml` in the CWD
|
|
129
140
|
3. User configuration directory
|
|
130
141
|
- Linux/macOS: `~/.config/hyper-py/hyper_config.yaml`
|
|
131
142
|
- Windows: `%APPDATA%\HyperPy\hyper_config.yaml`
|
|
@@ -140,7 +151,7 @@ If no path is provided, the application will look for it in this order:
|
|
|
140
151
|
| Priority | Location | Description |
|
|
141
152
|
|----------|--------------------------------------------|-----------------------------------------------------------------------------|
|
|
142
153
|
| 1 | CLI argument | Path explicitly provided by the user, e.g. `hyper-py /path/to/hyper_config.yaml`. |
|
|
143
|
-
| 2 |
|
|
154
|
+
| 2 | CWD | Looks for `./hyper_config.yaml` in the folder where the command is executed. |
|
|
144
155
|
| 3 | User configuration directory | - **Linux/macOS:** `~/.config/hyper-py/hyper_config.yaml`<br> - **Windows:** `%APPDATA%\HyperPy\hyper_config.yaml` |
|
|
145
156
|
| 4 | Auto-generated in CWD if none is found | A new `hyper_config.yaml` is created, copied from the package template (`assets/default_config.yaml`). |
|
|
146
157
|
|
|
@@ -180,9 +191,7 @@ python -m hyper_py path/to/hyper_config.yaml
|
|
|
180
191
|
```
|
|
181
192
|
This runs the main process using the configuration file specified.
|
|
182
193
|
|
|
183
|
-
II) If installed via pip:
|
|
184
|
-
|
|
185
|
-
Once the .whl package is installed (e.g., via pip install hyper_py-X.X.X-py3-none-any.whl), you can run it directly:
|
|
194
|
+
II) If installed via pip you can run it directly:
|
|
186
195
|
```bash
|
|
187
196
|
hyper_py path/to/hyper_config.yaml
|
|
188
197
|
```
|
|
@@ -201,7 +210,7 @@ To run or debug the source code using Visual Studio Code:
|
|
|
201
210
|
- Open the project folder in VS Code.
|
|
202
211
|
- Make sure the Python extension is installed.
|
|
203
212
|
- Press Ctrl+Shift+P (or Cmd+Shift+P on macOS) and run Python: Select Interpreter.
|
|
204
|
-
-
|
|
213
|
+
- If you have set up an environment, choose the one where the dependencies are installed.
|
|
205
214
|
|
|
206
215
|
### 2. Run and debug the code
|
|
207
216
|
|
|
@@ -243,8 +252,8 @@ The `hyper_config.yaml` file controls all aspects of the Hyper-py pipeline. Belo
|
|
|
243
252
|
|----------------------|-----------------------------------------------------------------------------|-----------------|-----------|
|
|
244
253
|
| `paths.input.dir_maps` | Directory containing input map files. | `./maps` | REQUIRED |
|
|
245
254
|
| `paths.output.dir_root` | Root directory for output data. | `./output` | REQUIRED |
|
|
246
|
-
| `paths.output.dir_table_out`| Subdirectory of `dir_root` for photometry
|
|
247
|
-
| `paths.output.dir_region_out`| Subdirectory of `dir_root` for region files
|
|
255
|
+
| `paths.output.dir_table_out`| Subdirectory of `dir_root` for photometry tables. | `params` | REQUIRED |
|
|
256
|
+
| `paths.output.dir_region_out`| Subdirectory of `dir_root` for region files. | `regions` | REQUIRED |
|
|
248
257
|
| `paths.output.dir_log_out` | Subdirectory of `dir_root` for log files. | `logs` | REQUIRED |
|
|
249
258
|
|
|
250
259
|
### File Names
|
|
@@ -252,8 +261,8 @@ The `hyper_config.yaml` file controls all aspects of the Hyper-py pipeline. Belo
|
|
|
252
261
|
| Entry | Description | Default | Type |
|
|
253
262
|
|----------------------|-----------------------------------------------------------------------------|-----------------|-----------|
|
|
254
263
|
| `files.file_map_name` | Input FITS map(s) list for analysis (in `dir_maps`). | `maps_list.txt` | REQUIRED |
|
|
255
|
-
| `files.file_table_base` | Base filename for photometry
|
|
256
|
-
| `files.file_region_base` | Base filename for
|
|
264
|
+
| `files.file_table_base` | Base filename for photometry tables (in `dir_table_out`). | `params` | REQUIRED |
|
|
265
|
+
| `files.file_region_base` | Base filename for ellipse region files (in `dir_region_out`). | `region_files` | REQUIRED |
|
|
257
266
|
| `files.file_log_name` | Name of the global log file (in `dir_log_out`). | `hyper_py.log` | REQUIRED |
|
|
258
267
|
|
|
259
268
|
### Pipeline Control
|
|
@@ -288,17 +297,21 @@ The `hyper_config.yaml` file controls all aspects of the Hyper-py pipeline. Belo
|
|
|
288
297
|
| `detection.roundlim` | Allowed source roundness range (min, max for DAOFIND). | `[-4.0, 4.0]` | ADVANCED |
|
|
289
298
|
| `detection.sharplim` | Allowed source sharpness range (min, max for DAOFIND). | `[-2.0, 2.0]` | ADVANCED |
|
|
290
299
|
| `detection.use_fixed_source_table`| Use external IPAC table for peak/aperture (`True`/`False`). | `False` | OPTIONAL |
|
|
291
|
-
| `detection.fixed_source_table_path` | Path to an external IPAC table with source information (in `dir_root`). The table must have **6 columns
|
|
300
|
+
| `detection.fixed_source_table_path` | Path to an external IPAC table with source information (in `dir_root`). The table must have **6 columns**| `source_table.txt` | OPTIONAL |
|
|
301
|
+
| `detection.fixed_peaks` | Use fixed peaks instead of automatic (`True`/`False`). | `False` | OPTIONAL |
|
|
302
|
+
| `detection.xcen_fix` | Fixed peak X coordinates (deg; used if `fixed_peaks` is `True`). | `[1.0, 1.0]` | OPTIONAL |
|
|
303
|
+
| `detection.ycen_fix` | Fixed peak Y coordinates (deg; used if `fixed_peaks` is `True`). | `[1.0, 1.0]` | OPTIONAL |
|
|
304
|
+
|
|
305
|
+
Columns description for the external IPAC table with source information (only if detection.use_fixed_source_table is `True`):
|
|
306
|
+
|
|
292
307
|
- **ID**: Source identifier
|
|
293
308
|
- **xcen**: X coordinate (in map units, e.g. degrees or pixels)
|
|
294
309
|
- **ycen**: Y coordinate (in map units, e.g. degrees or pixels)
|
|
295
|
-
- **fwhm_1**: Major axis FWHM (arcsec)
|
|
296
|
-
- **fwhm_2**: Minor axis FWHM (arcsec)
|
|
310
|
+
- **fwhm_1**: Major axis FWHM (arcsec, used as minimum radius for aperture photometry)
|
|
311
|
+
- **fwhm_2**: Minor axis FWHM (arcsec, used as minimum radius for aperture photometry)
|
|
297
312
|
- **PA**: Position angle (degrees, East of North)
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
| `detection.xcen_fix` | Fixed peak X coordinates (deg; used if `fixed_peaks` is `True`). | `[1.0, 1.0]` | OPTIONAL |
|
|
301
|
-
| `detection.ycen_fix` | Fixed peak Y coordinates (deg; used if `fixed_peaks` is `True`). | `[1.0, 1.0]` | OPTIONAL |
|
|
313
|
+
|
|
314
|
+
The code will use only `xcen` and `ycen` if `detection.fixed_peaks = true`, only `fwhm_1`, `fwhm_2`, and `PA` if `photometry.fixed_radius = true`, or both sets of parameters if both options are enabled.
|
|
302
315
|
|
|
303
316
|
### Photometry Settings
|
|
304
317
|
|
|
@@ -316,32 +329,47 @@ The `hyper_config.yaml` file controls all aspects of the Hyper-py pipeline. Belo
|
|
|
316
329
|
| Entry | Description | Default | Type |
|
|
317
330
|
|----------------------|-----------------------------------------------------------------------------|-----------------|-----------|
|
|
318
331
|
| `fit_options.fit_method` | Optimization algorithm for Gaussian fitting. | `"least_squares"`| ADVANCED |
|
|
319
|
-
| `fit_options.loss` | Specifies the loss function used during Gaussian fitting optimization.
|
|
332
|
+
| `fit_options.loss` | Specifies the loss function used during Gaussian fitting optimization. | `"linear"` | ADVANCED |
|
|
333
|
+
|
|
334
|
+
Loss function options:
|
|
320
335
|
- `"linear"`: Standard least-squares loss (minimizes squared residuals; most common for well-behaved data).
|
|
321
336
|
- `"soft_l1"`: Soft L1 loss, less sensitive to outliers than linear; combines properties of L1 and L2 norms.
|
|
322
337
|
- `"huber"`: Huber loss, robust to outliers; behaves like linear for small residuals and like L1 for large residuals.
|
|
323
338
|
- `"cauchy"`: Cauchy loss, strongly suppresses the influence of outliers.
|
|
324
|
-
Choose a robust loss (e.g., `"huber"` or `"cauchy"`) if your data contains significant outliers or non-Gaussian noise.
|
|
339
|
+
Choose a robust loss (e.g., `"huber"` or `"cauchy"`) if your data contains significant outliers or non-Gaussian noise.
|
|
340
|
+
|
|
341
|
+
| Entry | Description | Default | Type |
|
|
342
|
+
|----------------------|-----------------------------------------------------------------------------|-----------------|-----------|
|
|
325
343
|
| `fit_options.f_scale` | Relevant for `soft_l1`, `huber`, `cauchy` loss functions. | `0.1` | ADVANCED |
|
|
326
344
|
| `fit_options.max_nfev` | Maximum number of function evaluations. | `50000` | ADVANCED |
|
|
327
345
|
| `fit_options.xtol` | Tolerance on parameter change for convergence. | `1e-8` | ADVANCED |
|
|
328
346
|
| `fit_options.ftol` | Tolerance on cost function change for convergence. | `1e-8` | ADVANCED |
|
|
329
347
|
| `fit_options.gtol` | Tolerance on gradient orthogonality. | `1e-8` | ADVANCED |
|
|
330
|
-
| `fit_options.weights` | Specifies the weighting scheme used during Gaussian fitting.
|
|
348
|
+
| `fit_options.weights` | Specifies the weighting scheme used during Gaussian fitting. | `"snr"` | OPTIONAL |
|
|
349
|
+
|
|
350
|
+
Weighting scheme options:
|
|
331
351
|
- `"null"`: No weighting; all pixels are treated equally.
|
|
332
352
|
- `"inverse_rms"`: Weights are set as the inverse of the RMS noise, giving less weight to noisier pixels.
|
|
333
353
|
- `"snr"`: Weights are proportional to the signal-to-noise ratio (SNR) of each pixel.
|
|
334
354
|
- `"power_snr"`: Weights are proportional to the SNR raised to a user-defined power (`fit_options.power_snr`).
|
|
335
355
|
- `"map"`: Weights are set equal to the user-provided input map.
|
|
336
356
|
- `"mask"`: Weights are set to zero for masked pixels and one elsewhere, effectively ignoring masked regions.
|
|
337
|
-
Choose the scheme that best matches your data quality and analysis goals.
|
|
357
|
+
Choose the scheme that best matches your data quality and analysis goals.
|
|
358
|
+
|
|
359
|
+
| Entry | Description | Default | Type |
|
|
360
|
+
|----------------------|-----------------------------------------------------------------------------|-----------------|-----------|
|
|
338
361
|
| `fit_options.power_snr` | SNR exponent for weighting (if `weights` is `"power_snr"`). | `5` | OPTIONAL |
|
|
339
362
|
| `fit_options.calc_covar` | Estimate parameter covariance matrix (`True`/`False`). | `False` | ADVANCED |
|
|
340
|
-
| `fit_options.min_method` | Criterion used to select the best fit among multiple solutions
|
|
363
|
+
| `fit_options.min_method` | Criterion used to select the best fit among multiple solutions | `"nmse"` | ADVANCED |
|
|
364
|
+
|
|
365
|
+
Selection criterion to identify the best fit:
|
|
341
366
|
- `"nmse"`: Normalized Mean Squared Error; selects the fit with the lowest mean squared residuals normalized by the data variance.
|
|
342
367
|
- `"redchi"`: Reduced Chi-Squared; selects the fit with the lowest reduced chi-squared statistic, accounting for the number of degrees of freedom.
|
|
343
368
|
- `"bic"`: Bayesian Information Criterion; selects the fit with the lowest BIC value, which penalizes model complexity to avoid overfitting.
|
|
344
|
-
Choose the method that best matches your scientific goals and data characteristics.
|
|
369
|
+
Choose the method that best matches your scientific goals and data characteristics.
|
|
370
|
+
|
|
371
|
+
| Entry | Description | Default | Type |
|
|
372
|
+
|----------------------|-----------------------------------------------------------------------------|-----------------|-----------|
|
|
345
373
|
| `fit_options.verbose` | Print full fit report (`True`/`False`). | `False` | ADVANCED |
|
|
346
374
|
| `fit_options.use_l2_regularization`| Enable L2 regularization on background terms (`True`/`False`). | `True` | ADVANCED |
|
|
347
375
|
| `fit_options.lambda_l2` | Regularization strength. | `1e-4` | ADVANCED |
|
|
@@ -353,7 +381,7 @@ The `hyper_config.yaml` file controls all aspects of the Hyper-py pipeline. Belo
|
|
|
353
381
|
|
|
354
382
|
| Entry | Description | Default | Type |
|
|
355
383
|
|----------------------|-----------------------------------------------------------------------------|-----------------|-----------|
|
|
356
|
-
| `background.fit_gauss_and_bg_separately`| Estimate Gaussian and background separately (`True`/`False`). | `True` |
|
|
384
|
+
| `background.fit_gauss_and_bg_separately`| Estimate Gaussian and background separately (`True`/`False`). | `True` | REQUIRED |
|
|
357
385
|
| `background.pol_orders_separate` | Polynomial orders for separated background subtraction. | `[0, 1, 2]` | OPTIONAL |
|
|
358
386
|
| `background.fix_min_box` | Minimum box size for variable-size background fitting, expressed as a multiple of the source FWHM (half-size increment). **If set to `0`, the background is estimated over the entire map.** | `3` | OPTIONAL |
|
|
359
387
|
| `background.fix_max_box` | Maximum box size (multiple of FWHMs) for background fitting. | `5` | OPTIONAL |
|
|
@@ -364,10 +392,10 @@ The `hyper_config.yaml` file controls all aspects of the Hyper-py pipeline. Belo
|
|
|
364
392
|
|
|
365
393
|
| Entry | Description | Default | Type |
|
|
366
394
|
|----------------------|-----------------------------------------------------------------------------|-----------------|-----------|
|
|
367
|
-
| `fits_output.fits_fitting` | Save best fit model group FITS files (`True`/`False`). | `False` | OPTIONAL |
|
|
395
|
+
| `fits_output.fits_fitting` | Save best fit model and original group FITS files (`True`/`False`). | `False` | OPTIONAL |
|
|
368
396
|
| `fits_output.fits_deblended` | Save deblended per-source FITS files (`True`/`False`). | `False` | OPTIONAL |
|
|
369
397
|
| `fits_output.fits_bg_separate` | Save best fit background separated model group FITS files (`True`/`False`).| `False` | OPTIONAL |
|
|
370
|
-
| `fits_output.fits_output_dir_fitting`| Subdirectory of `dir_root` for
|
|
398
|
+
| `fits_output.fits_output_dir_fitting`| Subdirectory of `dir_root` for best model and original FITS files. | `fits/fitting` | OPTIONAL |
|
|
371
399
|
| `fits_output.fits_output_dir_deblended`| Subdirectory of `dir_root` for deblended FITS files. | `fits/deblended`| OPTIONAL |
|
|
372
400
|
| `fits_output.fits_output_dir_bg_separate`| Subdirectory of `dir_root` for background FITS files. | `fits/bg_separate`| OPTIONAL |
|
|
373
401
|
|
|
@@ -377,8 +405,8 @@ The `hyper_config.yaml` file controls all aspects of the Hyper-py pipeline. Belo
|
|
|
377
405
|
|----------------------|-----------------------------------------------------------------------------|-----------------|-----------|
|
|
378
406
|
| `visualization.visualize_fitting` | Visualize final Gaussian+background fit (`True`/`False`). | `False` | OPTIONAL |
|
|
379
407
|
| `visualization.visualize_deblended` | Visualize per-source blended maps (`True`/`False`). | `False` | OPTIONAL |
|
|
380
|
-
| `visualization.visualize_bg_separate` | Visualize background model
|
|
381
|
-
| `visualization.output_dir_fitting` | Subdirectory of `dir_root` for
|
|
408
|
+
| `visualization.visualize_bg_separate` | Visualize background separated model (`True`/`False`). | `False` | OPTIONAL |
|
|
409
|
+
| `visualization.output_dir_fitting` | Subdirectory of `dir_root` for best model and original FITS plots. | `plots/fitting` | OPTIONAL |
|
|
382
410
|
| `visualization.output_dir_deblended` | Subdirectory of `dir_root` for deblended plots. | `plots/deblended`| OPTIONAL |
|
|
383
411
|
| `visualization.output_dir_bg_separate` | Subdirectory of `dir_root` for background plots. | `plots/bg_separate`| OPTIONAL |
|
|
384
412
|
|
|
@@ -395,7 +423,7 @@ All entries can be customized in your `hyper_config.yaml`. If an entry is omitte
|
|
|
395
423
|
|-------------------------------|-------------|
|
|
396
424
|
| `run_hyper.py` | Main launcher for multi-map analysis (parallel or serial)
|
|
397
425
|
| `hyper.py` | Core logic for initializing the code run
|
|
398
|
-
| `single_map.py` | Core logic for running detection + photometry on
|
|
426
|
+
| `single_map.py` | Core logic for running detection + photometry on each map
|
|
399
427
|
| `config.py` | YAML parser with access interface
|
|
400
428
|
| `logger.py` | Custom logger supporting log file + screen separation
|
|
401
429
|
| `paths_io.py` | Handles file path construction for input/output files
|
|
@@ -483,12 +511,12 @@ To ensure compatibility with Hyper-py, each input FITS file (2D map or 3D datacu
|
|
|
483
511
|
- Common values for `CTYPE1`/`CTYPE2` are `'RA---SIN'`, `'RA---TAN'`, `'DEC--SIN'`, `'DEC--TAN'`, `'GLON--CAR'`, `'GLAT--CAR'`.
|
|
484
512
|
- For cubes, `CTYPE3` can be `'VRAD'` (velocity), `'VELO-LSR'`, or `'FREQ'` (frequency).
|
|
485
513
|
- **Units:**
|
|
486
|
-
- `CUNIT1`/`CUNIT2`: `'deg'` (degrees), `'arcsec'` (arcseconds)
|
|
487
|
-
- `CUNIT3`: `'km s-1'` (velocity), `'Hz'` (frequency)
|
|
488
|
-
- `BUNIT`: `'Jy'`, `'Jy/beam'`, `'beam-1 Jy'`, `'MJy/sr'` (must match your science case)
|
|
514
|
+
- `CUNIT1`/`CUNIT2`: `'deg'` (degrees), `'arcsec'` (arcseconds).
|
|
515
|
+
- `CUNIT3`: `'km s-1'` (velocity), `'Hz'` (frequency).
|
|
516
|
+
- `BUNIT`: `'Jy'`, `'Jy/beam'`, `'beam-1 Jy'`, `'MJy/sr'` (must match your science case).
|
|
489
517
|
- **Beam Parameters:**
|
|
490
|
-
- `BMAJ`, `BMIN`: Beam size in degrees (convert from arcsec if needed: 1 arcsec = 1/3600 deg)
|
|
491
|
-
- `BPA`: Beam position angle in degrees
|
|
518
|
+
- `BMAJ`, `BMIN`: Beam size in degrees (convert from arcsec if needed: 1 arcsec = 1/3600 deg).
|
|
519
|
+
- `BPA`: Beam position angle in degrees.
|
|
492
520
|
- **Other:**
|
|
493
521
|
- Additional header keywords may be present, but the above are required for Hyper-py to interpret the map/cube correctly.
|
|
494
522
|
|
|
@@ -550,3 +578,25 @@ BPA = 0.0
|
|
|
550
578
|
OBJECT = 'Datacube for Hyper-py test'
|
|
551
579
|
END
|
|
552
580
|
```
|
|
581
|
+
|
|
582
|
+
## 🔬 Test Mode
|
|
583
|
+
|
|
584
|
+
In order to quickly test the full functionality of **Hyper_py**, a dedicated **test mode** is available.
|
|
585
|
+
|
|
586
|
+
You can run the code in test mode by executing the `test_hyper.py` script located in the `test/` folder:
|
|
587
|
+
|
|
588
|
+
```bash
|
|
589
|
+
python test/test_hyper.py
|
|
590
|
+
```
|
|
591
|
+
|
|
592
|
+
When launched, the script will:
|
|
593
|
+
- Automatically generate a minimal working config.yaml file;
|
|
594
|
+
- Analyze two synthetic 2D maps and one synthetic datacube with 4 slices;
|
|
595
|
+
- Run the analysis using 2 parallel cores (if available);
|
|
596
|
+
- Generate all intermediate and final FITS files and diagnostic plots, including:
|
|
597
|
+
- Background models;
|
|
598
|
+
- Gaussian + background fits;
|
|
599
|
+
- Residual maps;
|
|
600
|
+
- Photometric results.
|
|
601
|
+
|
|
602
|
+
This mode is designed to validate the installation and ensure that all the core functionalities of the pipeline are working properly. It is particularly useful for new users, developers, or during CI testing.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# 💫 `Hyper-py`: Hybrid Photometry Photometry and Extraction Routine in Python
|
|
2
2
|
|
|
3
3
|
**Authors:** Alessio Traficante; Fabrizio De Angelis; Alice Nucara; Milena Benedettini
|
|
4
|
+
|
|
4
5
|
**Original reference:** Traficante et al. (2015), *MNRAS, 451, 3089*
|
|
5
6
|
|
|
6
7
|
---
|
|
@@ -52,7 +53,17 @@ control:
|
|
|
52
53
|
|
|
53
54
|
If `parallel_maps` is set to `false`, the pipeline will run in serial mode.
|
|
54
55
|
|
|
56
|
+
### 💡 Tips & Tricks
|
|
55
57
|
|
|
58
|
+
- **Create a virtual environment before installation**
|
|
59
|
+
For convenience, you could set up a Python virtual environment before working with the code.
|
|
60
|
+
<br>Eg.
|
|
61
|
+
```bash
|
|
62
|
+
python -m venv .venv
|
|
63
|
+
source .venv/bin/activate # Linux / macOS
|
|
64
|
+
.venv\Scripts\activate # Windows
|
|
65
|
+
```
|
|
66
|
+
P.S.: Remember to activate it every time you work with the code! :)
|
|
56
67
|
## 🛠️ Installation
|
|
57
68
|
You can install and use `Hyper-py` in two different ways, depending on your needs:
|
|
58
69
|
|
|
@@ -100,12 +111,12 @@ pip install -r requirements.txt
|
|
|
100
111
|
|
|
101
112
|
`Hyper-py` requires a configuration file named **`hyper_config.yaml`** in order to run.
|
|
102
113
|
|
|
103
|
-
>The first time you run `Hyper-py` a new hyper_config.yaml will be created automatically in the CWD, then you must setup all paths and
|
|
114
|
+
>The first time you run `Hyper-py` a new hyper_config.yaml will be created automatically in the Current Working Directory (CWD), then you must setup all paths and parameters.<br>
|
|
104
115
|
>If you already have a configuration file ready or you have moved the new configuration file to a different folder, provide the path as argument.
|
|
105
116
|
|
|
106
117
|
If no path is provided, the application will look for it in this order:
|
|
107
|
-
1. Path passed as CLI argument
|
|
108
|
-
2. `hyper_config.yaml` in the
|
|
118
|
+
1. Path passed as Command Line Interface (CLI) argument
|
|
119
|
+
2. `hyper_config.yaml` in the CWD
|
|
109
120
|
3. User configuration directory
|
|
110
121
|
- Linux/macOS: `~/.config/hyper-py/hyper_config.yaml`
|
|
111
122
|
- Windows: `%APPDATA%\HyperPy\hyper_config.yaml`
|
|
@@ -120,7 +131,7 @@ If no path is provided, the application will look for it in this order:
|
|
|
120
131
|
| Priority | Location | Description |
|
|
121
132
|
|----------|--------------------------------------------|-----------------------------------------------------------------------------|
|
|
122
133
|
| 1 | CLI argument | Path explicitly provided by the user, e.g. `hyper-py /path/to/hyper_config.yaml`. |
|
|
123
|
-
| 2 |
|
|
134
|
+
| 2 | CWD | Looks for `./hyper_config.yaml` in the folder where the command is executed. |
|
|
124
135
|
| 3 | User configuration directory | - **Linux/macOS:** `~/.config/hyper-py/hyper_config.yaml`<br> - **Windows:** `%APPDATA%\HyperPy\hyper_config.yaml` |
|
|
125
136
|
| 4 | Auto-generated in CWD if none is found | A new `hyper_config.yaml` is created, copied from the package template (`assets/default_config.yaml`). |
|
|
126
137
|
|
|
@@ -160,9 +171,7 @@ python -m hyper_py path/to/hyper_config.yaml
|
|
|
160
171
|
```
|
|
161
172
|
This runs the main process using the configuration file specified.
|
|
162
173
|
|
|
163
|
-
II) If installed via pip:
|
|
164
|
-
|
|
165
|
-
Once the .whl package is installed (e.g., via pip install hyper_py-X.X.X-py3-none-any.whl), you can run it directly:
|
|
174
|
+
II) If installed via pip you can run it directly:
|
|
166
175
|
```bash
|
|
167
176
|
hyper_py path/to/hyper_config.yaml
|
|
168
177
|
```
|
|
@@ -181,7 +190,7 @@ To run or debug the source code using Visual Studio Code:
|
|
|
181
190
|
- Open the project folder in VS Code.
|
|
182
191
|
- Make sure the Python extension is installed.
|
|
183
192
|
- Press Ctrl+Shift+P (or Cmd+Shift+P on macOS) and run Python: Select Interpreter.
|
|
184
|
-
-
|
|
193
|
+
- If you have set up an environment, choose the one where the dependencies are installed.
|
|
185
194
|
|
|
186
195
|
### 2. Run and debug the code
|
|
187
196
|
|
|
@@ -223,8 +232,8 @@ The `hyper_config.yaml` file controls all aspects of the Hyper-py pipeline. Belo
|
|
|
223
232
|
|----------------------|-----------------------------------------------------------------------------|-----------------|-----------|
|
|
224
233
|
| `paths.input.dir_maps` | Directory containing input map files. | `./maps` | REQUIRED |
|
|
225
234
|
| `paths.output.dir_root` | Root directory for output data. | `./output` | REQUIRED |
|
|
226
|
-
| `paths.output.dir_table_out`| Subdirectory of `dir_root` for photometry
|
|
227
|
-
| `paths.output.dir_region_out`| Subdirectory of `dir_root` for region files
|
|
235
|
+
| `paths.output.dir_table_out`| Subdirectory of `dir_root` for photometry tables. | `params` | REQUIRED |
|
|
236
|
+
| `paths.output.dir_region_out`| Subdirectory of `dir_root` for region files. | `regions` | REQUIRED |
|
|
228
237
|
| `paths.output.dir_log_out` | Subdirectory of `dir_root` for log files. | `logs` | REQUIRED |
|
|
229
238
|
|
|
230
239
|
### File Names
|
|
@@ -232,8 +241,8 @@ The `hyper_config.yaml` file controls all aspects of the Hyper-py pipeline. Belo
|
|
|
232
241
|
| Entry | Description | Default | Type |
|
|
233
242
|
|----------------------|-----------------------------------------------------------------------------|-----------------|-----------|
|
|
234
243
|
| `files.file_map_name` | Input FITS map(s) list for analysis (in `dir_maps`). | `maps_list.txt` | REQUIRED |
|
|
235
|
-
| `files.file_table_base` | Base filename for photometry
|
|
236
|
-
| `files.file_region_base` | Base filename for
|
|
244
|
+
| `files.file_table_base` | Base filename for photometry tables (in `dir_table_out`). | `params` | REQUIRED |
|
|
245
|
+
| `files.file_region_base` | Base filename for ellipse region files (in `dir_region_out`). | `region_files` | REQUIRED |
|
|
237
246
|
| `files.file_log_name` | Name of the global log file (in `dir_log_out`). | `hyper_py.log` | REQUIRED |
|
|
238
247
|
|
|
239
248
|
### Pipeline Control
|
|
@@ -268,17 +277,21 @@ The `hyper_config.yaml` file controls all aspects of the Hyper-py pipeline. Belo
|
|
|
268
277
|
| `detection.roundlim` | Allowed source roundness range (min, max for DAOFIND). | `[-4.0, 4.0]` | ADVANCED |
|
|
269
278
|
| `detection.sharplim` | Allowed source sharpness range (min, max for DAOFIND). | `[-2.0, 2.0]` | ADVANCED |
|
|
270
279
|
| `detection.use_fixed_source_table`| Use external IPAC table for peak/aperture (`True`/`False`). | `False` | OPTIONAL |
|
|
271
|
-
| `detection.fixed_source_table_path` | Path to an external IPAC table with source information (in `dir_root`). The table must have **6 columns
|
|
280
|
+
| `detection.fixed_source_table_path` | Path to an external IPAC table with source information (in `dir_root`). The table must have **6 columns**| `source_table.txt` | OPTIONAL |
|
|
281
|
+
| `detection.fixed_peaks` | Use fixed peaks instead of automatic (`True`/`False`). | `False` | OPTIONAL |
|
|
282
|
+
| `detection.xcen_fix` | Fixed peak X coordinates (deg; used if `fixed_peaks` is `True`). | `[1.0, 1.0]` | OPTIONAL |
|
|
283
|
+
| `detection.ycen_fix` | Fixed peak Y coordinates (deg; used if `fixed_peaks` is `True`). | `[1.0, 1.0]` | OPTIONAL |
|
|
284
|
+
|
|
285
|
+
Columns description for the external IPAC table with source information (only if detection.use_fixed_source_table is `True`):
|
|
286
|
+
|
|
272
287
|
- **ID**: Source identifier
|
|
273
288
|
- **xcen**: X coordinate (in map units, e.g. degrees or pixels)
|
|
274
289
|
- **ycen**: Y coordinate (in map units, e.g. degrees or pixels)
|
|
275
|
-
- **fwhm_1**: Major axis FWHM (arcsec)
|
|
276
|
-
- **fwhm_2**: Minor axis FWHM (arcsec)
|
|
290
|
+
- **fwhm_1**: Major axis FWHM (arcsec, used as minimum radius for aperture photometry)
|
|
291
|
+
- **fwhm_2**: Minor axis FWHM (arcsec, used as minimum radius for aperture photometry)
|
|
277
292
|
- **PA**: Position angle (degrees, East of North)
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
| `detection.xcen_fix` | Fixed peak X coordinates (deg; used if `fixed_peaks` is `True`). | `[1.0, 1.0]` | OPTIONAL |
|
|
281
|
-
| `detection.ycen_fix` | Fixed peak Y coordinates (deg; used if `fixed_peaks` is `True`). | `[1.0, 1.0]` | OPTIONAL |
|
|
293
|
+
|
|
294
|
+
The code will use only `xcen` and `ycen` if `detection.fixed_peaks = true`, only `fwhm_1`, `fwhm_2`, and `PA` if `photometry.fixed_radius = true`, or both sets of parameters if both options are enabled.
|
|
282
295
|
|
|
283
296
|
### Photometry Settings
|
|
284
297
|
|
|
@@ -296,32 +309,47 @@ The `hyper_config.yaml` file controls all aspects of the Hyper-py pipeline. Belo
|
|
|
296
309
|
| Entry | Description | Default | Type |
|
|
297
310
|
|----------------------|-----------------------------------------------------------------------------|-----------------|-----------|
|
|
298
311
|
| `fit_options.fit_method` | Optimization algorithm for Gaussian fitting. | `"least_squares"`| ADVANCED |
|
|
299
|
-
| `fit_options.loss` | Specifies the loss function used during Gaussian fitting optimization.
|
|
312
|
+
| `fit_options.loss` | Specifies the loss function used during Gaussian fitting optimization. | `"linear"` | ADVANCED |
|
|
313
|
+
|
|
314
|
+
Loss function options:
|
|
300
315
|
- `"linear"`: Standard least-squares loss (minimizes squared residuals; most common for well-behaved data).
|
|
301
316
|
- `"soft_l1"`: Soft L1 loss, less sensitive to outliers than linear; combines properties of L1 and L2 norms.
|
|
302
317
|
- `"huber"`: Huber loss, robust to outliers; behaves like linear for small residuals and like L1 for large residuals.
|
|
303
318
|
- `"cauchy"`: Cauchy loss, strongly suppresses the influence of outliers.
|
|
304
|
-
Choose a robust loss (e.g., `"huber"` or `"cauchy"`) if your data contains significant outliers or non-Gaussian noise.
|
|
319
|
+
Choose a robust loss (e.g., `"huber"` or `"cauchy"`) if your data contains significant outliers or non-Gaussian noise.
|
|
320
|
+
|
|
321
|
+
| Entry | Description | Default | Type |
|
|
322
|
+
|----------------------|-----------------------------------------------------------------------------|-----------------|-----------|
|
|
305
323
|
| `fit_options.f_scale` | Relevant for `soft_l1`, `huber`, `cauchy` loss functions. | `0.1` | ADVANCED |
|
|
306
324
|
| `fit_options.max_nfev` | Maximum number of function evaluations. | `50000` | ADVANCED |
|
|
307
325
|
| `fit_options.xtol` | Tolerance on parameter change for convergence. | `1e-8` | ADVANCED |
|
|
308
326
|
| `fit_options.ftol` | Tolerance on cost function change for convergence. | `1e-8` | ADVANCED |
|
|
309
327
|
| `fit_options.gtol` | Tolerance on gradient orthogonality. | `1e-8` | ADVANCED |
|
|
310
|
-
| `fit_options.weights` | Specifies the weighting scheme used during Gaussian fitting.
|
|
328
|
+
| `fit_options.weights` | Specifies the weighting scheme used during Gaussian fitting. | `"snr"` | OPTIONAL |
|
|
329
|
+
|
|
330
|
+
Weighting scheme options:
|
|
311
331
|
- `"null"`: No weighting; all pixels are treated equally.
|
|
312
332
|
- `"inverse_rms"`: Weights are set as the inverse of the RMS noise, giving less weight to noisier pixels.
|
|
313
333
|
- `"snr"`: Weights are proportional to the signal-to-noise ratio (SNR) of each pixel.
|
|
314
334
|
- `"power_snr"`: Weights are proportional to the SNR raised to a user-defined power (`fit_options.power_snr`).
|
|
315
335
|
- `"map"`: Weights are set equal to the user-provided input map.
|
|
316
336
|
- `"mask"`: Weights are set to zero for masked pixels and one elsewhere, effectively ignoring masked regions.
|
|
317
|
-
Choose the scheme that best matches your data quality and analysis goals.
|
|
337
|
+
Choose the scheme that best matches your data quality and analysis goals.
|
|
338
|
+
|
|
339
|
+
| Entry | Description | Default | Type |
|
|
340
|
+
|----------------------|-----------------------------------------------------------------------------|-----------------|-----------|
|
|
318
341
|
| `fit_options.power_snr` | SNR exponent for weighting (if `weights` is `"power_snr"`). | `5` | OPTIONAL |
|
|
319
342
|
| `fit_options.calc_covar` | Estimate parameter covariance matrix (`True`/`False`). | `False` | ADVANCED |
|
|
320
|
-
| `fit_options.min_method` | Criterion used to select the best fit among multiple solutions
|
|
343
|
+
| `fit_options.min_method` | Criterion used to select the best fit among multiple solutions | `"nmse"` | ADVANCED |
|
|
344
|
+
|
|
345
|
+
Selection criterion to identify the best fit:
|
|
321
346
|
- `"nmse"`: Normalized Mean Squared Error; selects the fit with the lowest mean squared residuals normalized by the data variance.
|
|
322
347
|
- `"redchi"`: Reduced Chi-Squared; selects the fit with the lowest reduced chi-squared statistic, accounting for the number of degrees of freedom.
|
|
323
348
|
- `"bic"`: Bayesian Information Criterion; selects the fit with the lowest BIC value, which penalizes model complexity to avoid overfitting.
|
|
324
|
-
Choose the method that best matches your scientific goals and data characteristics.
|
|
349
|
+
Choose the method that best matches your scientific goals and data characteristics.
|
|
350
|
+
|
|
351
|
+
| Entry | Description | Default | Type |
|
|
352
|
+
|----------------------|-----------------------------------------------------------------------------|-----------------|-----------|
|
|
325
353
|
| `fit_options.verbose` | Print full fit report (`True`/`False`). | `False` | ADVANCED |
|
|
326
354
|
| `fit_options.use_l2_regularization`| Enable L2 regularization on background terms (`True`/`False`). | `True` | ADVANCED |
|
|
327
355
|
| `fit_options.lambda_l2` | Regularization strength. | `1e-4` | ADVANCED |
|
|
@@ -333,7 +361,7 @@ The `hyper_config.yaml` file controls all aspects of the Hyper-py pipeline. Belo
|
|
|
333
361
|
|
|
334
362
|
| Entry | Description | Default | Type |
|
|
335
363
|
|----------------------|-----------------------------------------------------------------------------|-----------------|-----------|
|
|
336
|
-
| `background.fit_gauss_and_bg_separately`| Estimate Gaussian and background separately (`True`/`False`). | `True` |
|
|
364
|
+
| `background.fit_gauss_and_bg_separately`| Estimate Gaussian and background separately (`True`/`False`). | `True` | REQUIRED |
|
|
337
365
|
| `background.pol_orders_separate` | Polynomial orders for separated background subtraction. | `[0, 1, 2]` | OPTIONAL |
|
|
338
366
|
| `background.fix_min_box` | Minimum box size for variable-size background fitting, expressed as a multiple of the source FWHM (half-size increment). **If set to `0`, the background is estimated over the entire map.** | `3` | OPTIONAL |
|
|
339
367
|
| `background.fix_max_box` | Maximum box size (multiple of FWHMs) for background fitting. | `5` | OPTIONAL |
|
|
@@ -344,10 +372,10 @@ The `hyper_config.yaml` file controls all aspects of the Hyper-py pipeline. Belo
|
|
|
344
372
|
|
|
345
373
|
| Entry | Description | Default | Type |
|
|
346
374
|
|----------------------|-----------------------------------------------------------------------------|-----------------|-----------|
|
|
347
|
-
| `fits_output.fits_fitting` | Save best fit model group FITS files (`True`/`False`). | `False` | OPTIONAL |
|
|
375
|
+
| `fits_output.fits_fitting` | Save best fit model and original group FITS files (`True`/`False`). | `False` | OPTIONAL |
|
|
348
376
|
| `fits_output.fits_deblended` | Save deblended per-source FITS files (`True`/`False`). | `False` | OPTIONAL |
|
|
349
377
|
| `fits_output.fits_bg_separate` | Save best fit background separated model group FITS files (`True`/`False`).| `False` | OPTIONAL |
|
|
350
|
-
| `fits_output.fits_output_dir_fitting`| Subdirectory of `dir_root` for
|
|
378
|
+
| `fits_output.fits_output_dir_fitting`| Subdirectory of `dir_root` for best model and original FITS files. | `fits/fitting` | OPTIONAL |
|
|
351
379
|
| `fits_output.fits_output_dir_deblended`| Subdirectory of `dir_root` for deblended FITS files. | `fits/deblended`| OPTIONAL |
|
|
352
380
|
| `fits_output.fits_output_dir_bg_separate`| Subdirectory of `dir_root` for background FITS files. | `fits/bg_separate`| OPTIONAL |
|
|
353
381
|
|
|
@@ -357,8 +385,8 @@ The `hyper_config.yaml` file controls all aspects of the Hyper-py pipeline. Belo
|
|
|
357
385
|
|----------------------|-----------------------------------------------------------------------------|-----------------|-----------|
|
|
358
386
|
| `visualization.visualize_fitting` | Visualize final Gaussian+background fit (`True`/`False`). | `False` | OPTIONAL |
|
|
359
387
|
| `visualization.visualize_deblended` | Visualize per-source blended maps (`True`/`False`). | `False` | OPTIONAL |
|
|
360
|
-
| `visualization.visualize_bg_separate` | Visualize background model
|
|
361
|
-
| `visualization.output_dir_fitting` | Subdirectory of `dir_root` for
|
|
388
|
+
| `visualization.visualize_bg_separate` | Visualize background separated model (`True`/`False`). | `False` | OPTIONAL |
|
|
389
|
+
| `visualization.output_dir_fitting` | Subdirectory of `dir_root` for best model and original FITS plots. | `plots/fitting` | OPTIONAL |
|
|
362
390
|
| `visualization.output_dir_deblended` | Subdirectory of `dir_root` for deblended plots. | `plots/deblended`| OPTIONAL |
|
|
363
391
|
| `visualization.output_dir_bg_separate` | Subdirectory of `dir_root` for background plots. | `plots/bg_separate`| OPTIONAL |
|
|
364
392
|
|
|
@@ -375,7 +403,7 @@ All entries can be customized in your `hyper_config.yaml`. If an entry is omitte
|
|
|
375
403
|
|-------------------------------|-------------|
|
|
376
404
|
| `run_hyper.py` | Main launcher for multi-map analysis (parallel or serial)
|
|
377
405
|
| `hyper.py` | Core logic for initializing the code run
|
|
378
|
-
| `single_map.py` | Core logic for running detection + photometry on
|
|
406
|
+
| `single_map.py` | Core logic for running detection + photometry on each map
|
|
379
407
|
| `config.py` | YAML parser with access interface
|
|
380
408
|
| `logger.py` | Custom logger supporting log file + screen separation
|
|
381
409
|
| `paths_io.py` | Handles file path construction for input/output files
|
|
@@ -463,12 +491,12 @@ To ensure compatibility with Hyper-py, each input FITS file (2D map or 3D datacu
|
|
|
463
491
|
- Common values for `CTYPE1`/`CTYPE2` are `'RA---SIN'`, `'RA---TAN'`, `'DEC--SIN'`, `'DEC--TAN'`, `'GLON--CAR'`, `'GLAT--CAR'`.
|
|
464
492
|
- For cubes, `CTYPE3` can be `'VRAD'` (velocity), `'VELO-LSR'`, or `'FREQ'` (frequency).
|
|
465
493
|
- **Units:**
|
|
466
|
-
- `CUNIT1`/`CUNIT2`: `'deg'` (degrees), `'arcsec'` (arcseconds)
|
|
467
|
-
- `CUNIT3`: `'km s-1'` (velocity), `'Hz'` (frequency)
|
|
468
|
-
- `BUNIT`: `'Jy'`, `'Jy/beam'`, `'beam-1 Jy'`, `'MJy/sr'` (must match your science case)
|
|
494
|
+
- `CUNIT1`/`CUNIT2`: `'deg'` (degrees), `'arcsec'` (arcseconds).
|
|
495
|
+
- `CUNIT3`: `'km s-1'` (velocity), `'Hz'` (frequency).
|
|
496
|
+
- `BUNIT`: `'Jy'`, `'Jy/beam'`, `'beam-1 Jy'`, `'MJy/sr'` (must match your science case).
|
|
469
497
|
- **Beam Parameters:**
|
|
470
|
-
- `BMAJ`, `BMIN`: Beam size in degrees (convert from arcsec if needed: 1 arcsec = 1/3600 deg)
|
|
471
|
-
- `BPA`: Beam position angle in degrees
|
|
498
|
+
- `BMAJ`, `BMIN`: Beam size in degrees (convert from arcsec if needed: 1 arcsec = 1/3600 deg).
|
|
499
|
+
- `BPA`: Beam position angle in degrees.
|
|
472
500
|
- **Other:**
|
|
473
501
|
- Additional header keywords may be present, but the above are required for Hyper-py to interpret the map/cube correctly.
|
|
474
502
|
|
|
@@ -529,4 +557,26 @@ BMIN = 0.00015
|
|
|
529
557
|
BPA = 0.0
|
|
530
558
|
OBJECT = 'Datacube for Hyper-py test'
|
|
531
559
|
END
|
|
532
|
-
```
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
## 🔬 Test Mode
|
|
563
|
+
|
|
564
|
+
In order to quickly test the full functionality of **Hyper_py**, a dedicated **test mode** is available.
|
|
565
|
+
|
|
566
|
+
You can run the code in test mode by executing the `test_hyper.py` script located in the `test/` folder:
|
|
567
|
+
|
|
568
|
+
```bash
|
|
569
|
+
python test/test_hyper.py
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
When launched, the script will:
|
|
573
|
+
- Automatically generate a minimal working config.yaml file;
|
|
574
|
+
- Analyze two synthetic 2D maps and one synthetic datacube with 4 slices;
|
|
575
|
+
- Run the analysis using 2 parallel cores (if available);
|
|
576
|
+
- Generate all intermediate and final FITS files and diagnostic plots, including:
|
|
577
|
+
- Background models;
|
|
578
|
+
- Gaussian + background fits;
|
|
579
|
+
- Residual maps;
|
|
580
|
+
- Photometric results.
|
|
581
|
+
|
|
582
|
+
This mode is designed to validate the installation and ensure that all the core functionalities of the pipeline are working properly. It is particularly useful for new users, developers, or during CI testing.
|
|
@@ -19,7 +19,8 @@ authors:
|
|
|
19
19
|
affiliations:
|
|
20
20
|
- name: INAF-IAPS, Via Fosso del Cavaliere, 100, 00133 Rome (IT)
|
|
21
21
|
index: 1
|
|
22
|
-
date:
|
|
22
|
+
date: 02 September 2025
|
|
23
|
+
repository: https://github.com/Alessio-Traficante/hyper-py
|
|
23
24
|
bibliography: paper.bib
|
|
24
25
|
---
|
|
25
26
|
|
|
@@ -27,7 +28,7 @@ bibliography: paper.bib
|
|
|
27
28
|
|
|
28
29
|
# Summary
|
|
29
30
|
|
|
30
|
-
Source extraction and photometry of compact objects are fundamental tasks in observational astronomy. Over the years, various tools have been developed to address the inherent complexity of astronomical data—particularly for accurate background estimation and removal, and for deblending nearby sources to ensure reliable flux measurements across multiple wavelengths (e.g. Cutex: @Molinari11; getsources: @Menshinkov12; Fellwalker: @Berry15; [Astrodendro
|
|
31
|
+
Source extraction and photometry of compact objects are fundamental tasks in observational astronomy. Over the years, various tools have been developed to address the inherent complexity of astronomical data—particularly for accurate background estimation and removal, and for deblending nearby sources to ensure reliable flux measurements across multiple wavelengths (e.g. Cutex: @Molinari11; getsources: @Menshinkov12; Fellwalker: @Berry15; [Astrodendro](http://www.dendrograms.org/)). These challenges are especially pronounced in star-forming regions, which are best observed in the far-infrared (FIR), sub-millimeter, and millimeter regimes, where the cold, dense envelopes of compact sources emit most strongly.
|
|
31
32
|
To address these needs, several software packages have been designed to handle the structured backgrounds and blended source populations typical of observations with instruments such as Herschel (70–500 μm) and ALMA (1–3 mm). These packages differ significantly in their detection strategies and flux estimation methods. Among them, we developed **HYPER** (HYbrid Photometry and Extraction Routine, @Traficante15), originally implemented in Interactive Data Language (IDL), with the goal of providing robust and reproducible photometry of compact sources in FIR/sub-mm/mm maps. **HYPER** combines: (1) source detection via high-pass filtering; (2) background estimation and removal through local polynomial fitting; and (3) source modeling using 2D elliptical Gaussians. For blended regions, HYPER fits multiple Gaussians simultaneously to deblend overlapping sources, subtracting companions before performing photometry.
|
|
32
33
|
Aperture photometry in **HYPER** is then carried out on the background-subtracted, companion-subtracted images, using the footprint defined by each source’s 2D Gaussian model. This ensures a consistent and robust integrated flux measurement, even in crowded or strongly structured environments @Traficante15; @Traficante23.
|
|
33
34
|
The hybrid nature of **HYPER** lies in this combined approach: using 2D Gaussian modeling, while retaining classical aperture photometry techniques.
|
|
@@ -53,7 +54,7 @@ Specifically, we adopt a robust loss function, setting loss = "cauchy". This cho
|
|
|
53
54
|
|
|
54
55
|
**Improved user configurability**. *Hyper-Py* is designed to be more user-friendly, featuring a clear and well-documented configuration file. This allows users to adapt the full photometric workflow to a wide range of observational conditions and scientific goals by modifying only a minimal set of parameters. The modular structure of the configuration also enhances transparency and reproducibility in all stages of the analysis.
|
|
55
56
|
|
|
56
|
-
We assessed the performance of the *Hyper-Py* pipeline using a dedicated suite of simulations. Specifically, we adopted a noise-only map derived from the ALMA program #2022.1.0917.S and produced two maps with this reference header. In each of those maps we injected a variable background and 500 synthetic 2D Gaussian sources into it. These sources were designed to emulate the properties of real compact astronomical objects: integrated fluxes ranged between 8 and 20 times the map *rms* (corresponding to peak fluxes of approximately 1–1.5 times the *rms*), and FWHMs spanned from 0.5 to 1.5 times the beam size, as computed from the FITS header, to simulate both unresolved and moderately extended sources
|
|
57
|
+
We assessed the performance of the *Hyper-Py* pipeline using a dedicated suite of simulations. Specifically, we adopted a noise-only map derived from the ALMA program #2022.1.0917.S and produced two maps with this reference header. In each of those maps we injected a variable background and 500 synthetic 2D Gaussian sources into it. These sources were designed to emulate the properties of real compact astronomical objects: integrated fluxes ranged between 8 and 20 times the map *rms* (corresponding to peak fluxes of approximately 1–1.5 times the *rms*), and FWHMs spanned from 0.5 to 1.5 times the beam size, as computed from the FITS header, to simulate both unresolved and moderately extended sources @Elia21. The source position angles were randomly assigned, and a minimum overlap fraction of 30% was imposed to ensure a significant level of blending, thus providing a rigorous test of the code under realistic and challenging conditions.We then compared the performance of the original IDL implementation of **HYPER** with the new Python-based *Hyper-Py* version. Both codes were run using equivalent configurations, with *Hyper-Py* additionally benefiting from its extended capabilities—such as improved background estimation, optional L2 regularization, and multi-core parallel processing. The main results of this comparison are presented in **Table 1**, where we show the differences between the number of identified sources and the false positives by *Hyper-Py* and **HYPER**, respectively.
|
|
57
58
|
|
|
58
59
|
| Catalog | Source Type | Total | Matched | False | False Percentage |
|
|
59
60
|
|--------:|:------------|------:|--------:|------:|------------------:|
|
|
@@ -64,6 +65,7 @@ We assessed the performance of the *Hyper-Py* pipeline using a dedicated suite o
|
|
|
64
65
|
|
|
65
66
|
In addition, Figure 1 and Figure 2 show the differences between the peak fluxes and the integrated fluxes of the sources with respect to the reference values of the simulated input sources as estimated by *Hyper-Py* and HYPER, respectively.
|
|
66
67
|
|
|
68
|
+
*Hyper-Py* is freely available for download via its [GitHub repository](https://github.com/Alessio-Traficante/hyper-py), and can also be installed using pip, as described in the accompanying README file.
|
|
67
69
|
|
|
68
70
|

|
|
69
71
|
|
|
@@ -13,8 +13,12 @@ warnings.filterwarnings("ignore", message=".*more axes \\(4\\) than the image it
|
|
|
13
13
|
warnings.filterwarnings("ignore", message=".*Set MJD-OBS to.*")
|
|
14
14
|
|
|
15
15
|
# Import the main entry point of the package
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
try:
|
|
17
|
+
from hyper_py.hyper import start_hyper
|
|
18
|
+
except ModuleNotFoundError:
|
|
19
|
+
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
|
20
|
+
from hyper_py.hyper import start_hyper
|
|
21
|
+
|
|
18
22
|
# importlib.resources for packaged data (fallback to importlib_resources on older Python)
|
|
19
23
|
try:
|
|
20
24
|
from importlib.resources import files as ir_files
|
{hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5/src/hyper_py_photometry.egg-info}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hyper-py-photometry
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.5
|
|
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
|
|
@@ -21,6 +21,7 @@ Dynamic: license-file
|
|
|
21
21
|
# 💫 `Hyper-py`: Hybrid Photometry Photometry and Extraction Routine in Python
|
|
22
22
|
|
|
23
23
|
**Authors:** Alessio Traficante; Fabrizio De Angelis; Alice Nucara; Milena Benedettini
|
|
24
|
+
|
|
24
25
|
**Original reference:** Traficante et al. (2015), *MNRAS, 451, 3089*
|
|
25
26
|
|
|
26
27
|
---
|
|
@@ -72,7 +73,17 @@ control:
|
|
|
72
73
|
|
|
73
74
|
If `parallel_maps` is set to `false`, the pipeline will run in serial mode.
|
|
74
75
|
|
|
76
|
+
### 💡 Tips & Tricks
|
|
75
77
|
|
|
78
|
+
- **Create a virtual environment before installation**
|
|
79
|
+
For convenience, you could set up a Python virtual environment before working with the code.
|
|
80
|
+
<br>Eg.
|
|
81
|
+
```bash
|
|
82
|
+
python -m venv .venv
|
|
83
|
+
source .venv/bin/activate # Linux / macOS
|
|
84
|
+
.venv\Scripts\activate # Windows
|
|
85
|
+
```
|
|
86
|
+
P.S.: Remember to activate it every time you work with the code! :)
|
|
76
87
|
## 🛠️ Installation
|
|
77
88
|
You can install and use `Hyper-py` in two different ways, depending on your needs:
|
|
78
89
|
|
|
@@ -120,12 +131,12 @@ pip install -r requirements.txt
|
|
|
120
131
|
|
|
121
132
|
`Hyper-py` requires a configuration file named **`hyper_config.yaml`** in order to run.
|
|
122
133
|
|
|
123
|
-
>The first time you run `Hyper-py` a new hyper_config.yaml will be created automatically in the CWD, then you must setup all paths and
|
|
134
|
+
>The first time you run `Hyper-py` a new hyper_config.yaml will be created automatically in the Current Working Directory (CWD), then you must setup all paths and parameters.<br>
|
|
124
135
|
>If you already have a configuration file ready or you have moved the new configuration file to a different folder, provide the path as argument.
|
|
125
136
|
|
|
126
137
|
If no path is provided, the application will look for it in this order:
|
|
127
|
-
1. Path passed as CLI argument
|
|
128
|
-
2. `hyper_config.yaml` in the
|
|
138
|
+
1. Path passed as Command Line Interface (CLI) argument
|
|
139
|
+
2. `hyper_config.yaml` in the CWD
|
|
129
140
|
3. User configuration directory
|
|
130
141
|
- Linux/macOS: `~/.config/hyper-py/hyper_config.yaml`
|
|
131
142
|
- Windows: `%APPDATA%\HyperPy\hyper_config.yaml`
|
|
@@ -140,7 +151,7 @@ If no path is provided, the application will look for it in this order:
|
|
|
140
151
|
| Priority | Location | Description |
|
|
141
152
|
|----------|--------------------------------------------|-----------------------------------------------------------------------------|
|
|
142
153
|
| 1 | CLI argument | Path explicitly provided by the user, e.g. `hyper-py /path/to/hyper_config.yaml`. |
|
|
143
|
-
| 2 |
|
|
154
|
+
| 2 | CWD | Looks for `./hyper_config.yaml` in the folder where the command is executed. |
|
|
144
155
|
| 3 | User configuration directory | - **Linux/macOS:** `~/.config/hyper-py/hyper_config.yaml`<br> - **Windows:** `%APPDATA%\HyperPy\hyper_config.yaml` |
|
|
145
156
|
| 4 | Auto-generated in CWD if none is found | A new `hyper_config.yaml` is created, copied from the package template (`assets/default_config.yaml`). |
|
|
146
157
|
|
|
@@ -180,9 +191,7 @@ python -m hyper_py path/to/hyper_config.yaml
|
|
|
180
191
|
```
|
|
181
192
|
This runs the main process using the configuration file specified.
|
|
182
193
|
|
|
183
|
-
II) If installed via pip:
|
|
184
|
-
|
|
185
|
-
Once the .whl package is installed (e.g., via pip install hyper_py-X.X.X-py3-none-any.whl), you can run it directly:
|
|
194
|
+
II) If installed via pip you can run it directly:
|
|
186
195
|
```bash
|
|
187
196
|
hyper_py path/to/hyper_config.yaml
|
|
188
197
|
```
|
|
@@ -201,7 +210,7 @@ To run or debug the source code using Visual Studio Code:
|
|
|
201
210
|
- Open the project folder in VS Code.
|
|
202
211
|
- Make sure the Python extension is installed.
|
|
203
212
|
- Press Ctrl+Shift+P (or Cmd+Shift+P on macOS) and run Python: Select Interpreter.
|
|
204
|
-
-
|
|
213
|
+
- If you have set up an environment, choose the one where the dependencies are installed.
|
|
205
214
|
|
|
206
215
|
### 2. Run and debug the code
|
|
207
216
|
|
|
@@ -243,8 +252,8 @@ The `hyper_config.yaml` file controls all aspects of the Hyper-py pipeline. Belo
|
|
|
243
252
|
|----------------------|-----------------------------------------------------------------------------|-----------------|-----------|
|
|
244
253
|
| `paths.input.dir_maps` | Directory containing input map files. | `./maps` | REQUIRED |
|
|
245
254
|
| `paths.output.dir_root` | Root directory for output data. | `./output` | REQUIRED |
|
|
246
|
-
| `paths.output.dir_table_out`| Subdirectory of `dir_root` for photometry
|
|
247
|
-
| `paths.output.dir_region_out`| Subdirectory of `dir_root` for region files
|
|
255
|
+
| `paths.output.dir_table_out`| Subdirectory of `dir_root` for photometry tables. | `params` | REQUIRED |
|
|
256
|
+
| `paths.output.dir_region_out`| Subdirectory of `dir_root` for region files. | `regions` | REQUIRED |
|
|
248
257
|
| `paths.output.dir_log_out` | Subdirectory of `dir_root` for log files. | `logs` | REQUIRED |
|
|
249
258
|
|
|
250
259
|
### File Names
|
|
@@ -252,8 +261,8 @@ The `hyper_config.yaml` file controls all aspects of the Hyper-py pipeline. Belo
|
|
|
252
261
|
| Entry | Description | Default | Type |
|
|
253
262
|
|----------------------|-----------------------------------------------------------------------------|-----------------|-----------|
|
|
254
263
|
| `files.file_map_name` | Input FITS map(s) list for analysis (in `dir_maps`). | `maps_list.txt` | REQUIRED |
|
|
255
|
-
| `files.file_table_base` | Base filename for photometry
|
|
256
|
-
| `files.file_region_base` | Base filename for
|
|
264
|
+
| `files.file_table_base` | Base filename for photometry tables (in `dir_table_out`). | `params` | REQUIRED |
|
|
265
|
+
| `files.file_region_base` | Base filename for ellipse region files (in `dir_region_out`). | `region_files` | REQUIRED |
|
|
257
266
|
| `files.file_log_name` | Name of the global log file (in `dir_log_out`). | `hyper_py.log` | REQUIRED |
|
|
258
267
|
|
|
259
268
|
### Pipeline Control
|
|
@@ -288,17 +297,21 @@ The `hyper_config.yaml` file controls all aspects of the Hyper-py pipeline. Belo
|
|
|
288
297
|
| `detection.roundlim` | Allowed source roundness range (min, max for DAOFIND). | `[-4.0, 4.0]` | ADVANCED |
|
|
289
298
|
| `detection.sharplim` | Allowed source sharpness range (min, max for DAOFIND). | `[-2.0, 2.0]` | ADVANCED |
|
|
290
299
|
| `detection.use_fixed_source_table`| Use external IPAC table for peak/aperture (`True`/`False`). | `False` | OPTIONAL |
|
|
291
|
-
| `detection.fixed_source_table_path` | Path to an external IPAC table with source information (in `dir_root`). The table must have **6 columns
|
|
300
|
+
| `detection.fixed_source_table_path` | Path to an external IPAC table with source information (in `dir_root`). The table must have **6 columns**| `source_table.txt` | OPTIONAL |
|
|
301
|
+
| `detection.fixed_peaks` | Use fixed peaks instead of automatic (`True`/`False`). | `False` | OPTIONAL |
|
|
302
|
+
| `detection.xcen_fix` | Fixed peak X coordinates (deg; used if `fixed_peaks` is `True`). | `[1.0, 1.0]` | OPTIONAL |
|
|
303
|
+
| `detection.ycen_fix` | Fixed peak Y coordinates (deg; used if `fixed_peaks` is `True`). | `[1.0, 1.0]` | OPTIONAL |
|
|
304
|
+
|
|
305
|
+
Columns description for the external IPAC table with source information (only if detection.use_fixed_source_table is `True`):
|
|
306
|
+
|
|
292
307
|
- **ID**: Source identifier
|
|
293
308
|
- **xcen**: X coordinate (in map units, e.g. degrees or pixels)
|
|
294
309
|
- **ycen**: Y coordinate (in map units, e.g. degrees or pixels)
|
|
295
|
-
- **fwhm_1**: Major axis FWHM (arcsec)
|
|
296
|
-
- **fwhm_2**: Minor axis FWHM (arcsec)
|
|
310
|
+
- **fwhm_1**: Major axis FWHM (arcsec, used as minimum radius for aperture photometry)
|
|
311
|
+
- **fwhm_2**: Minor axis FWHM (arcsec, used as minimum radius for aperture photometry)
|
|
297
312
|
- **PA**: Position angle (degrees, East of North)
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
| `detection.xcen_fix` | Fixed peak X coordinates (deg; used if `fixed_peaks` is `True`). | `[1.0, 1.0]` | OPTIONAL |
|
|
301
|
-
| `detection.ycen_fix` | Fixed peak Y coordinates (deg; used if `fixed_peaks` is `True`). | `[1.0, 1.0]` | OPTIONAL |
|
|
313
|
+
|
|
314
|
+
The code will use only `xcen` and `ycen` if `detection.fixed_peaks = true`, only `fwhm_1`, `fwhm_2`, and `PA` if `photometry.fixed_radius = true`, or both sets of parameters if both options are enabled.
|
|
302
315
|
|
|
303
316
|
### Photometry Settings
|
|
304
317
|
|
|
@@ -316,32 +329,47 @@ The `hyper_config.yaml` file controls all aspects of the Hyper-py pipeline. Belo
|
|
|
316
329
|
| Entry | Description | Default | Type |
|
|
317
330
|
|----------------------|-----------------------------------------------------------------------------|-----------------|-----------|
|
|
318
331
|
| `fit_options.fit_method` | Optimization algorithm for Gaussian fitting. | `"least_squares"`| ADVANCED |
|
|
319
|
-
| `fit_options.loss` | Specifies the loss function used during Gaussian fitting optimization.
|
|
332
|
+
| `fit_options.loss` | Specifies the loss function used during Gaussian fitting optimization. | `"linear"` | ADVANCED |
|
|
333
|
+
|
|
334
|
+
Loss function options:
|
|
320
335
|
- `"linear"`: Standard least-squares loss (minimizes squared residuals; most common for well-behaved data).
|
|
321
336
|
- `"soft_l1"`: Soft L1 loss, less sensitive to outliers than linear; combines properties of L1 and L2 norms.
|
|
322
337
|
- `"huber"`: Huber loss, robust to outliers; behaves like linear for small residuals and like L1 for large residuals.
|
|
323
338
|
- `"cauchy"`: Cauchy loss, strongly suppresses the influence of outliers.
|
|
324
|
-
Choose a robust loss (e.g., `"huber"` or `"cauchy"`) if your data contains significant outliers or non-Gaussian noise.
|
|
339
|
+
Choose a robust loss (e.g., `"huber"` or `"cauchy"`) if your data contains significant outliers or non-Gaussian noise.
|
|
340
|
+
|
|
341
|
+
| Entry | Description | Default | Type |
|
|
342
|
+
|----------------------|-----------------------------------------------------------------------------|-----------------|-----------|
|
|
325
343
|
| `fit_options.f_scale` | Relevant for `soft_l1`, `huber`, `cauchy` loss functions. | `0.1` | ADVANCED |
|
|
326
344
|
| `fit_options.max_nfev` | Maximum number of function evaluations. | `50000` | ADVANCED |
|
|
327
345
|
| `fit_options.xtol` | Tolerance on parameter change for convergence. | `1e-8` | ADVANCED |
|
|
328
346
|
| `fit_options.ftol` | Tolerance on cost function change for convergence. | `1e-8` | ADVANCED |
|
|
329
347
|
| `fit_options.gtol` | Tolerance on gradient orthogonality. | `1e-8` | ADVANCED |
|
|
330
|
-
| `fit_options.weights` | Specifies the weighting scheme used during Gaussian fitting.
|
|
348
|
+
| `fit_options.weights` | Specifies the weighting scheme used during Gaussian fitting. | `"snr"` | OPTIONAL |
|
|
349
|
+
|
|
350
|
+
Weighting scheme options:
|
|
331
351
|
- `"null"`: No weighting; all pixels are treated equally.
|
|
332
352
|
- `"inverse_rms"`: Weights are set as the inverse of the RMS noise, giving less weight to noisier pixels.
|
|
333
353
|
- `"snr"`: Weights are proportional to the signal-to-noise ratio (SNR) of each pixel.
|
|
334
354
|
- `"power_snr"`: Weights are proportional to the SNR raised to a user-defined power (`fit_options.power_snr`).
|
|
335
355
|
- `"map"`: Weights are set equal to the user-provided input map.
|
|
336
356
|
- `"mask"`: Weights are set to zero for masked pixels and one elsewhere, effectively ignoring masked regions.
|
|
337
|
-
Choose the scheme that best matches your data quality and analysis goals.
|
|
357
|
+
Choose the scheme that best matches your data quality and analysis goals.
|
|
358
|
+
|
|
359
|
+
| Entry | Description | Default | Type |
|
|
360
|
+
|----------------------|-----------------------------------------------------------------------------|-----------------|-----------|
|
|
338
361
|
| `fit_options.power_snr` | SNR exponent for weighting (if `weights` is `"power_snr"`). | `5` | OPTIONAL |
|
|
339
362
|
| `fit_options.calc_covar` | Estimate parameter covariance matrix (`True`/`False`). | `False` | ADVANCED |
|
|
340
|
-
| `fit_options.min_method` | Criterion used to select the best fit among multiple solutions
|
|
363
|
+
| `fit_options.min_method` | Criterion used to select the best fit among multiple solutions | `"nmse"` | ADVANCED |
|
|
364
|
+
|
|
365
|
+
Selection criterion to identify the best fit:
|
|
341
366
|
- `"nmse"`: Normalized Mean Squared Error; selects the fit with the lowest mean squared residuals normalized by the data variance.
|
|
342
367
|
- `"redchi"`: Reduced Chi-Squared; selects the fit with the lowest reduced chi-squared statistic, accounting for the number of degrees of freedom.
|
|
343
368
|
- `"bic"`: Bayesian Information Criterion; selects the fit with the lowest BIC value, which penalizes model complexity to avoid overfitting.
|
|
344
|
-
Choose the method that best matches your scientific goals and data characteristics.
|
|
369
|
+
Choose the method that best matches your scientific goals and data characteristics.
|
|
370
|
+
|
|
371
|
+
| Entry | Description | Default | Type |
|
|
372
|
+
|----------------------|-----------------------------------------------------------------------------|-----------------|-----------|
|
|
345
373
|
| `fit_options.verbose` | Print full fit report (`True`/`False`). | `False` | ADVANCED |
|
|
346
374
|
| `fit_options.use_l2_regularization`| Enable L2 regularization on background terms (`True`/`False`). | `True` | ADVANCED |
|
|
347
375
|
| `fit_options.lambda_l2` | Regularization strength. | `1e-4` | ADVANCED |
|
|
@@ -353,7 +381,7 @@ The `hyper_config.yaml` file controls all aspects of the Hyper-py pipeline. Belo
|
|
|
353
381
|
|
|
354
382
|
| Entry | Description | Default | Type |
|
|
355
383
|
|----------------------|-----------------------------------------------------------------------------|-----------------|-----------|
|
|
356
|
-
| `background.fit_gauss_and_bg_separately`| Estimate Gaussian and background separately (`True`/`False`). | `True` |
|
|
384
|
+
| `background.fit_gauss_and_bg_separately`| Estimate Gaussian and background separately (`True`/`False`). | `True` | REQUIRED |
|
|
357
385
|
| `background.pol_orders_separate` | Polynomial orders for separated background subtraction. | `[0, 1, 2]` | OPTIONAL |
|
|
358
386
|
| `background.fix_min_box` | Minimum box size for variable-size background fitting, expressed as a multiple of the source FWHM (half-size increment). **If set to `0`, the background is estimated over the entire map.** | `3` | OPTIONAL |
|
|
359
387
|
| `background.fix_max_box` | Maximum box size (multiple of FWHMs) for background fitting. | `5` | OPTIONAL |
|
|
@@ -364,10 +392,10 @@ The `hyper_config.yaml` file controls all aspects of the Hyper-py pipeline. Belo
|
|
|
364
392
|
|
|
365
393
|
| Entry | Description | Default | Type |
|
|
366
394
|
|----------------------|-----------------------------------------------------------------------------|-----------------|-----------|
|
|
367
|
-
| `fits_output.fits_fitting` | Save best fit model group FITS files (`True`/`False`). | `False` | OPTIONAL |
|
|
395
|
+
| `fits_output.fits_fitting` | Save best fit model and original group FITS files (`True`/`False`). | `False` | OPTIONAL |
|
|
368
396
|
| `fits_output.fits_deblended` | Save deblended per-source FITS files (`True`/`False`). | `False` | OPTIONAL |
|
|
369
397
|
| `fits_output.fits_bg_separate` | Save best fit background separated model group FITS files (`True`/`False`).| `False` | OPTIONAL |
|
|
370
|
-
| `fits_output.fits_output_dir_fitting`| Subdirectory of `dir_root` for
|
|
398
|
+
| `fits_output.fits_output_dir_fitting`| Subdirectory of `dir_root` for best model and original FITS files. | `fits/fitting` | OPTIONAL |
|
|
371
399
|
| `fits_output.fits_output_dir_deblended`| Subdirectory of `dir_root` for deblended FITS files. | `fits/deblended`| OPTIONAL |
|
|
372
400
|
| `fits_output.fits_output_dir_bg_separate`| Subdirectory of `dir_root` for background FITS files. | `fits/bg_separate`| OPTIONAL |
|
|
373
401
|
|
|
@@ -377,8 +405,8 @@ The `hyper_config.yaml` file controls all aspects of the Hyper-py pipeline. Belo
|
|
|
377
405
|
|----------------------|-----------------------------------------------------------------------------|-----------------|-----------|
|
|
378
406
|
| `visualization.visualize_fitting` | Visualize final Gaussian+background fit (`True`/`False`). | `False` | OPTIONAL |
|
|
379
407
|
| `visualization.visualize_deblended` | Visualize per-source blended maps (`True`/`False`). | `False` | OPTIONAL |
|
|
380
|
-
| `visualization.visualize_bg_separate` | Visualize background model
|
|
381
|
-
| `visualization.output_dir_fitting` | Subdirectory of `dir_root` for
|
|
408
|
+
| `visualization.visualize_bg_separate` | Visualize background separated model (`True`/`False`). | `False` | OPTIONAL |
|
|
409
|
+
| `visualization.output_dir_fitting` | Subdirectory of `dir_root` for best model and original FITS plots. | `plots/fitting` | OPTIONAL |
|
|
382
410
|
| `visualization.output_dir_deblended` | Subdirectory of `dir_root` for deblended plots. | `plots/deblended`| OPTIONAL |
|
|
383
411
|
| `visualization.output_dir_bg_separate` | Subdirectory of `dir_root` for background plots. | `plots/bg_separate`| OPTIONAL |
|
|
384
412
|
|
|
@@ -395,7 +423,7 @@ All entries can be customized in your `hyper_config.yaml`. If an entry is omitte
|
|
|
395
423
|
|-------------------------------|-------------|
|
|
396
424
|
| `run_hyper.py` | Main launcher for multi-map analysis (parallel or serial)
|
|
397
425
|
| `hyper.py` | Core logic for initializing the code run
|
|
398
|
-
| `single_map.py` | Core logic for running detection + photometry on
|
|
426
|
+
| `single_map.py` | Core logic for running detection + photometry on each map
|
|
399
427
|
| `config.py` | YAML parser with access interface
|
|
400
428
|
| `logger.py` | Custom logger supporting log file + screen separation
|
|
401
429
|
| `paths_io.py` | Handles file path construction for input/output files
|
|
@@ -483,12 +511,12 @@ To ensure compatibility with Hyper-py, each input FITS file (2D map or 3D datacu
|
|
|
483
511
|
- Common values for `CTYPE1`/`CTYPE2` are `'RA---SIN'`, `'RA---TAN'`, `'DEC--SIN'`, `'DEC--TAN'`, `'GLON--CAR'`, `'GLAT--CAR'`.
|
|
484
512
|
- For cubes, `CTYPE3` can be `'VRAD'` (velocity), `'VELO-LSR'`, or `'FREQ'` (frequency).
|
|
485
513
|
- **Units:**
|
|
486
|
-
- `CUNIT1`/`CUNIT2`: `'deg'` (degrees), `'arcsec'` (arcseconds)
|
|
487
|
-
- `CUNIT3`: `'km s-1'` (velocity), `'Hz'` (frequency)
|
|
488
|
-
- `BUNIT`: `'Jy'`, `'Jy/beam'`, `'beam-1 Jy'`, `'MJy/sr'` (must match your science case)
|
|
514
|
+
- `CUNIT1`/`CUNIT2`: `'deg'` (degrees), `'arcsec'` (arcseconds).
|
|
515
|
+
- `CUNIT3`: `'km s-1'` (velocity), `'Hz'` (frequency).
|
|
516
|
+
- `BUNIT`: `'Jy'`, `'Jy/beam'`, `'beam-1 Jy'`, `'MJy/sr'` (must match your science case).
|
|
489
517
|
- **Beam Parameters:**
|
|
490
|
-
- `BMAJ`, `BMIN`: Beam size in degrees (convert from arcsec if needed: 1 arcsec = 1/3600 deg)
|
|
491
|
-
- `BPA`: Beam position angle in degrees
|
|
518
|
+
- `BMAJ`, `BMIN`: Beam size in degrees (convert from arcsec if needed: 1 arcsec = 1/3600 deg).
|
|
519
|
+
- `BPA`: Beam position angle in degrees.
|
|
492
520
|
- **Other:**
|
|
493
521
|
- Additional header keywords may be present, but the above are required for Hyper-py to interpret the map/cube correctly.
|
|
494
522
|
|
|
@@ -550,3 +578,25 @@ BPA = 0.0
|
|
|
550
578
|
OBJECT = 'Datacube for Hyper-py test'
|
|
551
579
|
END
|
|
552
580
|
```
|
|
581
|
+
|
|
582
|
+
## 🔬 Test Mode
|
|
583
|
+
|
|
584
|
+
In order to quickly test the full functionality of **Hyper_py**, a dedicated **test mode** is available.
|
|
585
|
+
|
|
586
|
+
You can run the code in test mode by executing the `test_hyper.py` script located in the `test/` folder:
|
|
587
|
+
|
|
588
|
+
```bash
|
|
589
|
+
python test/test_hyper.py
|
|
590
|
+
```
|
|
591
|
+
|
|
592
|
+
When launched, the script will:
|
|
593
|
+
- Automatically generate a minimal working config.yaml file;
|
|
594
|
+
- Analyze two synthetic 2D maps and one synthetic datacube with 4 slices;
|
|
595
|
+
- Run the analysis using 2 parallel cores (if available);
|
|
596
|
+
- Generate all intermediate and final FITS files and diagnostic plots, including:
|
|
597
|
+
- Background models;
|
|
598
|
+
- Gaussian + background fits;
|
|
599
|
+
- Residual maps;
|
|
600
|
+
- Photometric results.
|
|
601
|
+
|
|
602
|
+
This mode is designed to validate the installation and ensure that all the core functionalities of the pipeline are working properly. It is particularly useful for new users, developers, or during CI testing.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/IDL_comparison/map_500_Gaussians_1.fits
RENAMED
|
File without changes
|
{hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/IDL_comparison/map_500_Gaussians_2.fits
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/IDL_comparison/table_500_Gaussians_1.txt
RENAMED
|
File without changes
|
{hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/IDL_comparison/table_500_Gaussians_2.txt
RENAMED
|
File without changes
|
|
File without changes
|
{hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/paper/Figures/Flux_Diff_Histogram_Int.png
RENAMED
|
File without changes
|
{hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/paper/Figures/Flux_Diff_Histogram_Peak.png
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/src/hyper_py/assets/default_config.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/src/hyper_py/create_background_slices.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hyper_py_photometry-0.1.4 → hyper_py_photometry-0.1.5}/src/hyper_py_photometry.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|