Skip to content

Commit

Permalink
better API error message, fix wrong catmatch cache file
Browse files Browse the repository at this point in the history
  • Loading branch information
simeonreusch committed May 15, 2023
1 parent 3e74f26 commit 21e1a2b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions nuztf/ampel_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,8 +636,14 @@ def ampel_api_catalog(
https://ampel.zeuthen.desy.de/api/catalogmatch/catalogs
"""
assert catalog_type in ["extcats", "catsHTM"]
assert search_type in ["all", "nearest"]
if not catalog_type in ["extcats", "catsHTM"]:
raise ValueError(
f"Expected parameter catalog_type in ['extcats', 'catsHTM'], got {catalog_type}"
)
if not search_type in ["all", "nearest"]:
raise ValueError(
f"Expected parameter catalog_type in ['all', 'nearest'], got {search_type}"
)

if logger is None:
logger = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion nuztf/base_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ def peak_mag_summary(self):
if tns_name:
tns_result = f"({tns_name})"

cache_file = Path(self.cache_dir) / f"{name}_catchmatch.json"
cache_file = Path(self.cache_dir) / f"{name}_catmatch.json"
xmatch_info = get_cross_match_info(
raw=res, cache_file=cache_file, logger=self.logger
)
Expand Down

0 comments on commit 21e1a2b

Please sign in to comment.