Skip to content

Commit

Permalink
Add htm skip for SolarSystem associated DiaSources
Browse files Browse the repository at this point in the history
Modify test to start with 1 indexed ids for DiaObjects.
  • Loading branch information
morriscb committed Oct 8, 2021
1 parent dc1f270 commit 7420888
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 7 additions & 1 deletion python/lsst/dax/apdb/apdbSql.py
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,13 @@ def _add_src_htm_index(self, sources: pandas.DataFrame, objs: pandas.DataFrame)

htm_index = np.zeros(sources.shape[0], dtype=np.int64)
for i, diaObjId in enumerate(sources["diaObjectId"]):
htm_index[i] = pixel_id_map[diaObjId]
# DiaSources associated with SolarSystemObjects do not have an
# associated DiaObject hence we skip them and set their htmIndex
# value to 0.
if diaObjId == 0:
continue
else:
htm_index[i] = pixel_id_map[diaObjId]
sources = sources.copy()
sources[self.config.htm_index_column] = htm_index
return sources
3 changes: 2 additions & 1 deletion tests/test_apdbSql.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ def _makeObjectCatalogPandas(region, count: int, config: ApdbSqlConfig):
object per pixel range). Coordinates of the created objects are not usable.
"""
data_list = []
# 0 id'ed DiaObjects don't exist and is used as a Null value for the id.
for oid, sp in enumerate(_makeVectors(region, count)):
tmp_dict = {"diaObjectId": oid,
tmp_dict = {"diaObjectId": oid + 1,
"ra": sp.getRa().asDegrees(),
"decl": sp.getDec().asDegrees()}
data_list.append(tmp_dict)
Expand Down

0 comments on commit 7420888

Please sign in to comment.