Skip to content

Commit

Permalink
Update metadata storage
Browse files Browse the repository at this point in the history
  • Loading branch information
mexanick committed Oct 30, 2024
1 parent e615594 commit beea571
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .codespell-ignores
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ chec
usera
nd
studi
REFERENC
referenc
2 changes: 0 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ repos:
additional_dependencies:
- tomli
exclude: AUTHORS
args:
- --ignore-words=.codespell-ignores

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
Expand Down
17 changes: 13 additions & 4 deletions src/ctapipe/utils/astro.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
usage within ctapipe.
"""

import json
import logging
from collections import namedtuple
from copy import deepcopy
Expand Down Expand Up @@ -147,6 +146,7 @@ def get_star_catalog(
if isinstance(catalog, str):
catalog = StarCatalog[catalog]
catalog_info = catalog.value
catalog_name = catalog.name

vizier = Vizier(
catalog=catalog_info.directory,
Expand All @@ -155,10 +155,19 @@ def get_star_catalog(
)

stars = vizier.query_constraints(Vmag=f"<{magnitude_cutoff}")[0]
meta = catalog_info._asdict()
meta["magnitude_cutoff"] = magnitude_cutoff

stars.meta["Catalog"] = json.dumps(meta)
header = {
"ORIGIN": "CTAPIPE",
"JEPOCH": float(catalog_info.coordinates["epoch"].replace("J", "")),
"RADESYS": catalog_info.coordinates["frame"].upper(),
"MAGCUT": magnitude_cutoff,
"BAND": "V",
"CATALOG": catalog_name,
"REFERENC": catalog_info.directory,
"COLUMNS": "_".join(catalog_info.columns),
}

stars.meta = header

return stars

Expand Down

0 comments on commit beea571

Please sign in to comment.