Skip to content

Commit

Permalink
Merge branch 'tickets/DM-45923'
Browse files Browse the repository at this point in the history
  • Loading branch information
leeskelvin committed Aug 26, 2024
2 parents abf8084 + 2a0d688 commit 6c9a134
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions python/lsst/source/injection/bin/ingest_injection_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,24 @@ def main():
writeable_butler = Butler(args.butler_config, writeable=True)
injection_catalog_format = vars(args).get("format", None)

for injection_catalog, band in injection_catalogs:
# The character_as_bytes=False option is preferred, if possible.
try:
table = Table.read(injection_catalog, format=injection_catalog_format, character_as_bytes=False)
except TypeError:
table = Table.read(injection_catalog, format=injection_catalog_format)
injection_catalogs_table = Table(rows=injection_catalogs, names=("injection_catalog", "band"))
injection_catalogs_groups = injection_catalogs_table.group_by("band")

for injection_catalogs_group in injection_catalogs_groups.groups:
band = injection_catalogs_group["band"][0]

injection_catalogs_band = []
for injection_catalog in injection_catalogs_group["injection_catalog"]:
# The character_as_bytes=False option is preferred, if possible.
try:
tbl = Table.read(injection_catalog, format=injection_catalog_format, character_as_bytes=False)
except TypeError:
tbl = Table.read(injection_catalog, format=injection_catalog_format)
injection_catalogs_band.append(tbl)

_ = ingest_injection_catalog(
writeable_butler=writeable_butler,
table=table,
table=injection_catalogs_band,
band=band,
**{
k: v
Expand Down

0 comments on commit 6c9a134

Please sign in to comment.