hyper-py-photometry 0.1.0__py3-none-any.whl → 0.1.3__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/__init__.py +21 -1
- hyper_py/__main__.py +7 -0
- hyper_py/assets/default_config.yaml +136 -0
- hyper_py/hyper.py +1 -1
- hyper_py/run_hyper.py +137 -28
- {hyper_py_photometry-0.1.0.dist-info → hyper_py_photometry-0.1.3.dist-info}/METADATA +21 -13
- {hyper_py_photometry-0.1.0.dist-info → hyper_py_photometry-0.1.3.dist-info}/RECORD +11 -9
- {hyper_py_photometry-0.1.0.dist-info → hyper_py_photometry-0.1.3.dist-info}/WHEEL +0 -0
- {hyper_py_photometry-0.1.0.dist-info → hyper_py_photometry-0.1.3.dist-info}/entry_points.txt +0 -0
- {hyper_py_photometry-0.1.0.dist-info → hyper_py_photometry-0.1.3.dist-info}/licenses/LICENSE +0 -0
- {hyper_py_photometry-0.1.0.dist-info → hyper_py_photometry-0.1.3.dist-info}/top_level.txt +0 -0
hyper_py/__init__.py
CHANGED
|
@@ -1 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
"""
|
|
2
|
+
Hyper-Py package initializer.
|
|
3
|
+
|
|
4
|
+
This file defines the public API and version metadata.
|
|
5
|
+
It does not run the application automatically; use
|
|
6
|
+
either `python -m hyper_py` or the console script entry point.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from importlib.metadata import version, PackageNotFoundError
|
|
10
|
+
|
|
11
|
+
from .hyper import start_hyper
|
|
12
|
+
|
|
13
|
+
try:
|
|
14
|
+
__version__ = version("hyper-py")
|
|
15
|
+
except PackageNotFoundError:
|
|
16
|
+
__version__ = "0.0.0-dev"
|
|
17
|
+
|
|
18
|
+
__all__ = [
|
|
19
|
+
"start_hyper",
|
|
20
|
+
"__version__",
|
|
21
|
+
]
|
hyper_py/__main__.py
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
|
hyper_py/hyper.py
CHANGED
|
@@ -22,7 +22,7 @@ def start_hyper(cfg_path):
|
|
|
22
22
|
# === Load config ===
|
|
23
23
|
os.chdir(os.path.dirname(__file__))
|
|
24
24
|
|
|
25
|
-
config_path = cfg_path if not None else "
|
|
25
|
+
config_path = cfg_path if not None else "hyper_config.yaml"
|
|
26
26
|
|
|
27
27
|
if not os.path.exists(config_path):
|
|
28
28
|
raise FileNotFoundError(f"Config file not found: {config_path}")
|
hyper_py/run_hyper.py
CHANGED
|
@@ -1,45 +1,154 @@
|
|
|
1
1
|
import sys
|
|
2
2
|
import os
|
|
3
|
-
import shutil
|
|
4
3
|
import warnings
|
|
5
|
-
import
|
|
4
|
+
import shutil
|
|
5
|
+
import platform
|
|
6
6
|
from pathlib import Path
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
# Block warnings
|
|
8
|
+
# Silence some known irrelevant warnings
|
|
11
9
|
warnings.filterwarnings("ignore", message="Using UFloat objects with std_dev==0 may give unexpected results.")
|
|
12
10
|
warnings.filterwarnings("ignore", message=".*Set OBSGEO-L to.*")
|
|
13
11
|
warnings.filterwarnings("ignore", message=".*Wrapping comment lines > 78 characters.*")
|
|
14
|
-
warnings.filterwarnings("ignore", message=".*more axes
|
|
12
|
+
warnings.filterwarnings("ignore", message=".*more axes \\(4\\) than the image it is associated with \\(2\\).*")
|
|
15
13
|
warnings.filterwarnings("ignore", message=".*Set MJD-OBS to.*")
|
|
16
14
|
|
|
15
|
+
# Import the main entry point of the package
|
|
17
16
|
from hyper_py.hyper import start_hyper
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
18
|
+
# importlib.resources for packaged data (fallback to importlib_resources on older Python)
|
|
19
|
+
try:
|
|
20
|
+
from importlib.resources import files as ir_files
|
|
21
|
+
except Exception: # Python <3.9
|
|
22
|
+
from importlib_resources import files as ir_files # type: ignore
|
|
23
|
+
|
|
24
|
+
# Try ruamel.yaml for comment-preserving roundtrips
|
|
25
|
+
try:
|
|
26
|
+
from ruamel.yaml import YAML # type: ignore
|
|
27
|
+
_HAS_RUAMEL = True
|
|
28
|
+
except Exception:
|
|
29
|
+
_HAS_RUAMEL = False
|
|
30
|
+
|
|
31
|
+
_PKG = "hyper_py" # top-level package name
|
|
32
|
+
_CONFIG_FILENAME = "hyper_config.yaml" # custom config filename
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _user_config_path() -> Path:
|
|
36
|
+
"""Return the user-level config path depending on the operating system."""
|
|
37
|
+
if platform.system() == "Windows":
|
|
38
|
+
base = Path(os.environ.get("APPDATA", Path.home() / "AppData" / "Roaming"))
|
|
39
|
+
return base / "HyperPy" / _CONFIG_FILENAME
|
|
40
|
+
base = Path(os.environ.get("XDG_CONFIG_HOME", Path.home() / ".config"))
|
|
41
|
+
return base / "hyper-py" / _CONFIG_FILENAME
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _load_default_template_path() -> Path:
|
|
45
|
+
"""
|
|
46
|
+
Locate the packaged default config template.
|
|
47
|
+
Fallback to local files when running directly from src (dev mode).
|
|
48
|
+
"""
|
|
49
|
+
try:
|
|
50
|
+
res = ir_files(_PKG).joinpath("assets/default_config.yaml")
|
|
51
|
+
if res and os.path.isfile(str(res)):
|
|
52
|
+
return Path(str(res))
|
|
53
|
+
except Exception:
|
|
54
|
+
pass
|
|
55
|
+
|
|
56
|
+
# Fallbacks for development mode
|
|
57
|
+
here = Path(__file__).parent
|
|
58
|
+
for cand in (
|
|
59
|
+
here / "assets" / "default_config.yaml",
|
|
60
|
+
here / "config.yaml",
|
|
61
|
+
here.parent / "config.yaml",
|
|
62
|
+
):
|
|
63
|
+
if cand.is_file():
|
|
64
|
+
return cand
|
|
65
|
+
|
|
66
|
+
print("Error: default config template not found in package or src.")
|
|
67
|
+
sys.exit(1)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def _ensure_parent(p: Path) -> None:
|
|
71
|
+
"""Ensure the parent directory exists."""
|
|
72
|
+
p.parent.mkdir(parents=True, exist_ok=True)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def _copy_template_to(dest: Path) -> None:
|
|
76
|
+
"""Copy the default template into the destination config file."""
|
|
77
|
+
src = _load_default_template_path()
|
|
78
|
+
_ensure_parent(dest)
|
|
79
|
+
with src.open("rb") as s, dest.open("wb") as d:
|
|
80
|
+
shutil.copyfileobj(s, d)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def _resolve_config_path(argv: list[str]) -> Path:
|
|
84
|
+
"""Resolve the path of the configuration file from CLI args or default locations."""
|
|
85
|
+
# 1) CLI argument
|
|
86
|
+
if len(argv) > 1:
|
|
87
|
+
return Path(argv[1]).expanduser().resolve()
|
|
88
|
+
# 2) config file in the current working directory
|
|
89
|
+
cwd_cfg = Path.cwd() / _CONFIG_FILENAME
|
|
90
|
+
if cwd_cfg.is_file():
|
|
91
|
+
return cwd_cfg
|
|
92
|
+
# 3) user config path
|
|
93
|
+
ucfg = _user_config_path()
|
|
94
|
+
if ucfg.is_file():
|
|
95
|
+
return ucfg
|
|
96
|
+
# 4) if nothing found, suggest CWD/hyper_config.yaml as creation target
|
|
97
|
+
return cwd_cfg
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def _update_dir_root_preserving_comments(config_path: Path, new_dir_root: Path) -> None:
|
|
101
|
+
"""
|
|
102
|
+
Update paths.output.dir_root preserving comments and formatting using ruamel.yaml.
|
|
103
|
+
If ruamel.yaml is not available, do nothing (keep template intact and let the user edit).
|
|
104
|
+
"""
|
|
105
|
+
if not _HAS_RUAMEL:
|
|
106
|
+
print("Note: ruamel.yaml not installed; left config comments intact. "
|
|
107
|
+
"Please edit 'paths.output.dir_root' manually in hyper_config.yaml.")
|
|
108
|
+
return
|
|
109
|
+
|
|
110
|
+
yaml = YAML()
|
|
111
|
+
yaml.preserve_quotes = True
|
|
112
|
+
yaml.indent(mapping=2, sequence=4, offset=2)
|
|
113
|
+
|
|
114
|
+
with config_path.open("r", encoding="utf-8") as f:
|
|
115
|
+
data = yaml.load(f) or {}
|
|
116
|
+
|
|
117
|
+
# Ensure nested mapping exists without destroying comments
|
|
118
|
+
paths = data.get("paths")
|
|
119
|
+
if paths is None:
|
|
120
|
+
from ruamel.yaml.comments import CommentedMap # type: ignore
|
|
121
|
+
paths = CommentedMap()
|
|
122
|
+
data["paths"] = paths
|
|
123
|
+
|
|
124
|
+
output = paths.get("output")
|
|
125
|
+
if output is None:
|
|
126
|
+
from ruamel.yaml.comments import CommentedMap # type: ignore
|
|
127
|
+
output = CommentedMap()
|
|
128
|
+
paths["output"] = output
|
|
129
|
+
|
|
130
|
+
output["dir_root"] = str(new_dir_root / "output")
|
|
131
|
+
|
|
132
|
+
with config_path.open("w", encoding="utf-8") as f:
|
|
133
|
+
yaml.dump(data, f)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def main() -> None:
|
|
137
|
+
"""Main entry point for CLI execution."""
|
|
138
|
+
cfg_path = _resolve_config_path(sys.argv)
|
|
139
|
+
|
|
140
|
+
if not cfg_path.exists():
|
|
141
|
+
# Create new hyper_config.yaml from packaged template
|
|
142
|
+
_copy_template_to(cfg_path)
|
|
143
|
+
# Update dir_root while preserving comments (if ruamel.yaml is available)
|
|
144
|
+
_update_dir_root_preserving_comments(cfg_path, Path.cwd())
|
|
145
|
+
print(f"⚠️ New {_CONFIG_FILENAME} created at: {cfg_path}")
|
|
146
|
+
print("⚠️ Please edit it and run the command again.")
|
|
40
147
|
sys.exit(0)
|
|
41
148
|
|
|
42
|
-
|
|
149
|
+
# Run the real application
|
|
150
|
+
start_hyper(str(cfg_path))
|
|
151
|
+
|
|
43
152
|
|
|
44
153
|
if __name__ == "__main__":
|
|
45
154
|
main()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hyper-py-photometry
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
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
|
|
@@ -15,6 +15,7 @@ Requires-Dist: scipy
|
|
|
15
15
|
Requires-Dist: lmfit
|
|
16
16
|
Requires-Dist: matplotlib
|
|
17
17
|
Requires-Dist: scikit-learn<1.6,>=1.4
|
|
18
|
+
Requires-Dist: ruamel.yaml>=0.18
|
|
18
19
|
Dynamic: license-file
|
|
19
20
|
|
|
20
21
|
# 💫 `Hyper-py`: Hybrid Photometry Photometry and Extraction Routine in Python
|
|
@@ -80,6 +81,10 @@ Before using `Hyper-py`, make sure you have all the necessary Python dependencie
|
|
|
80
81
|
• photutils
|
|
81
82
|
• matplotlib
|
|
82
83
|
• lmfit
|
|
84
|
+
• pyyaml
|
|
85
|
+
• numpy
|
|
86
|
+
• scipy
|
|
87
|
+
• scikit-learn>=1.4,<1.6
|
|
83
88
|
|
|
84
89
|
This will install the necessary packages using `pip`:
|
|
85
90
|
|
|
@@ -96,7 +101,6 @@ You can install and use `Hyper-py` in two different ways, depending on your need
|
|
|
96
101
|
If you want to modify, extend, or integrate `Hyper-py` in your own projects:
|
|
97
102
|
|
|
98
103
|
1. Clone the repository or download the source code.
|
|
99
|
-
|
|
100
104
|
```bash
|
|
101
105
|
git clone https://github.com/Alessio-Traficante/hyper-py.git
|
|
102
106
|
```
|
|
@@ -113,14 +117,10 @@ import sys
|
|
|
113
117
|
sys.path.insert(0, "/absolute/path/to/hyper_py/src")
|
|
114
118
|
```
|
|
115
119
|
### Option 2: Install via `pip` (for direct usage)
|
|
116
|
-
|
|
117
|
-
2. Install the wheel file using `pip`:
|
|
118
|
-
|
|
120
|
+
Install via PyPI:
|
|
119
121
|
```bash
|
|
120
|
-
pip install
|
|
122
|
+
pip install hyper-py-photometry
|
|
121
123
|
```
|
|
122
|
-
Use the current file version in dist folder.
|
|
123
|
-
|
|
124
124
|
|
|
125
125
|
|
|
126
126
|
## 🎯 Usage
|
|
@@ -131,7 +131,7 @@ You can use `Hyper-py` either by importing and running it directly from Python,
|
|
|
131
131
|
|
|
132
132
|
### 1. From Python
|
|
133
133
|
|
|
134
|
-
Import and run the `
|
|
134
|
+
Import and run the `start_hyper` function, passing the path to your YAML configuration file.
|
|
135
135
|
|
|
136
136
|
```python
|
|
137
137
|
from hyper_py import run_hyper
|
|
@@ -156,6 +156,14 @@ Once the .whl package is installed (e.g., via pip install hyper_py-X.X.X-py3-non
|
|
|
156
156
|
```bash
|
|
157
157
|
hyper_py path/to/config.yaml
|
|
158
158
|
```
|
|
159
|
+
OR
|
|
160
|
+
```bash
|
|
161
|
+
hyper-py path/to/config.yaml
|
|
162
|
+
```
|
|
163
|
+
OR
|
|
164
|
+
```bash
|
|
165
|
+
hyper path/to/config.yaml
|
|
166
|
+
```
|
|
159
167
|
|
|
160
168
|
## Using the Source Code in Visual Studio Code
|
|
161
169
|
To run or debug the source code using Visual Studio Code:
|
|
@@ -168,10 +176,10 @@ To run or debug the source code using Visual Studio Code:
|
|
|
168
176
|
### 2. Run and debug the code
|
|
169
177
|
|
|
170
178
|
To debug:
|
|
171
|
-
- Open src/hyper_py/hyper.py or
|
|
179
|
+
- Open src/hyper_py/hyper.py or run_hyper.py.
|
|
172
180
|
- Set breakpoints as needed.
|
|
173
181
|
- 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/
|
|
182
|
+
- In the launch configuration, set the entry script to src/hyper_py/run_hyper.py.
|
|
175
183
|
|
|
176
184
|
Optional: You can add this to `.vscode/launch.json` for convenience:
|
|
177
185
|
|
|
@@ -184,7 +192,7 @@ Optional: You can add this to `.vscode/launch.json` for convenience:
|
|
|
184
192
|
"name": "Python Debugger:Run Hyper",
|
|
185
193
|
"type": "debugpy",
|
|
186
194
|
"request": "launch",
|
|
187
|
-
"program": "${workspaceFolder}/src/hyper_py/
|
|
195
|
+
"program": "${workspaceFolder}/src/hyper_py/run_hyper.py",
|
|
188
196
|
"console": "integratedTerminal",
|
|
189
197
|
"args": ["path/to/config.yaml"], // Specify a different config file
|
|
190
198
|
}
|
|
@@ -355,7 +363,7 @@ All entries can be customized in your `config.yaml`. If an entry is omitted, the
|
|
|
355
363
|
|
|
356
364
|
| File | Description |
|
|
357
365
|
|-------------------------------|-------------|
|
|
358
|
-
| `
|
|
366
|
+
| `run_hyper.py` | Main launcher for multi-map analysis (parallel or serial)
|
|
359
367
|
| `hyper.py` | Core logic for initializing the code run
|
|
360
368
|
| `single_map.py` | Core logic for running detection + photometry on one map
|
|
361
369
|
| `config.py` | YAML parser with access interface
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
hyper_py/__init__.py,sha256=
|
|
1
|
+
hyper_py/__init__.py,sha256=9qj4yOKnDfeqKdMOHB4a7qVmPgTAxWYxSq_Zr_yugwc,458
|
|
2
|
+
hyper_py/__main__.py,sha256=VEzRWxxjj8Jja0FY5TiqDWaYkqYsFhHirbAK2gxRFTg,208
|
|
2
3
|
hyper_py/bkg_multigauss.py,sha256=SuVlEMkPOccqOuATCaoEBU_WpQARAlHJa2qwAkglHII,22778
|
|
3
4
|
hyper_py/bkg_single.py,sha256=stGiZIAFabOW3QHxakA2pJ0__HjgyvcPD2TnB3ARbZc,20269
|
|
4
5
|
hyper_py/config.py,sha256=evafwkxft8YK4vbAjOlBdB796gYd4zNnHt8wJbOabPs,1473
|
|
@@ -9,18 +10,19 @@ hyper_py/extract_cubes.py,sha256=hmfp5MoA5HKOwEduXqmV8uahfBbL479Qr5cC84zT7z0,164
|
|
|
9
10
|
hyper_py/fitting.py,sha256=MTw9Yt4LYAybVXM5uI_IgQiT5Maiz_W9EyWqHLEXVkY,26010
|
|
10
11
|
hyper_py/gaussfit.py,sha256=t_LlKd5hJZB1K2fGnZsd6v-q2h-M5XCW214FYjDCFOU,22833
|
|
11
12
|
hyper_py/groups.py,sha256=Q2xQ4MqYR-sRpRhNtayMqTVPMi2rm0ie34mmCDwTbNY,2303
|
|
12
|
-
hyper_py/hyper.py,sha256=
|
|
13
|
+
hyper_py/hyper.py,sha256=574EnlwCXTesCkOK_L3dMMnIo8uU4G1RWj_Tgaz2F7c,6018
|
|
13
14
|
hyper_py/logger.py,sha256=He18tjVOvG7_OVGY6262wj30HExoEa7vCFO6WziHSFk,2864
|
|
14
15
|
hyper_py/map_io.py,sha256=QHYsMFOA1Jzmx-ou_CFHAdRLXl00ynf2dYK8PZGh2CQ,2363
|
|
15
16
|
hyper_py/paths_io.py,sha256=fUl0GjwUZLEDXZAUlLK88DB6mBQ_il7fIa-vvKVUxRI,3770
|
|
16
17
|
hyper_py/photometry.py,sha256=4oCRZy8FVjV9BZL5f85LlcNnXuNq0wgtGAm8_cL5f9w,3869
|
|
17
|
-
hyper_py/run_hyper.py,sha256=
|
|
18
|
+
hyper_py/run_hyper.py,sha256=ZQYEuvU_SFsmLn7g61a169dGS3jL-NhHHdi7jckqQ0s,5220
|
|
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
|
-
|
|
22
|
-
hyper_py_photometry-0.1.
|
|
23
|
-
hyper_py_photometry-0.1.
|
|
24
|
-
hyper_py_photometry-0.1.
|
|
25
|
-
hyper_py_photometry-0.1.
|
|
26
|
-
hyper_py_photometry-0.1.
|
|
22
|
+
hyper_py/assets/default_config.yaml,sha256=64DJtYhwHX6XkbOyuGMmn51WwjK0uJpNafRe8CwkkO4,10616
|
|
23
|
+
hyper_py_photometry-0.1.3.dist-info/licenses/LICENSE,sha256=aB7cqE2-X_8mxy-EmQuVMkKmP8DQA2BnQaqD5k5C5nE,584
|
|
24
|
+
hyper_py_photometry-0.1.3.dist-info/METADATA,sha256=EDVdEHJ5BM9MGlP_m7JJiKX7GfXsVBzmxlaM_0mmfZk,32412
|
|
25
|
+
hyper_py_photometry-0.1.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
26
|
+
hyper_py_photometry-0.1.3.dist-info/entry_points.txt,sha256=0AVwuatL0ri5juy_Ccgt_9Bd4V0McpOrWSSnNX8cCzs,120
|
|
27
|
+
hyper_py_photometry-0.1.3.dist-info/top_level.txt,sha256=Pw-Iuf0SQwcibLdOwx4RkmEas3I6s0Ym_D0_oUnXEr4,9
|
|
28
|
+
hyper_py_photometry-0.1.3.dist-info/RECORD,,
|
|
File without changes
|
{hyper_py_photometry-0.1.0.dist-info → hyper_py_photometry-0.1.3.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{hyper_py_photometry-0.1.0.dist-info → hyper_py_photometry-0.1.3.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|