Skip to content

Commit

Permalink
Merge pull request #35 from lsst/tickets/DM-44233
Browse files Browse the repository at this point in the history
DM-44233: Remove packed from ObservationIdentifiers
  • Loading branch information
arunkannawadi committed May 7, 2024
2 parents fc18560 + 12bab89 commit 990d208
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 13 deletions.
1 change: 1 addition & 0 deletions doc/changes/DM-44233.api.rst
@@ -0,0 +1 @@
Removed `packed` attribute from `ObservationIdentifiers`.
12 changes: 1 addition & 11 deletions python/lsst/cell_coadds/_identifiers.py
Expand Up @@ -32,7 +32,6 @@
from typing import Self, cast

from lsst.daf.butler import DataCoordinate, DimensionRecord
from lsst.pipe.base import Instrument
from lsst.skymap import Index2D


Expand Down Expand Up @@ -130,11 +129,6 @@ class ObservationIdentifiers:
"""Name of the physical filter that this observation was taken with.
"""

packed: int
"""ID that uniquely identifies both the visit and detector by packing
together their IDs.
"""

visit: int
"""Unique identifier for the visit.
Expand Down Expand Up @@ -173,19 +167,15 @@ def from_data_id(cls, data_id: DataCoordinate, *, backup_detector: int = -1) ->
identifiers : `ObservationIdentifiers`
Struct of identifiers for this observation.
"""
packer = Instrument.make_default_dimension_packer(data_id, is_exposure=False)
detector = data_id.get("detector", backup_detector)
day_obs = data_id.get("day_obs", None)
return cls(
instrument=cast(str, data_id["instrument"]),
physical_filter=cast(str, data_id["physical_filter"]),
# Passing detector twice does not crash the packer. So send it in
# without checking if available in data_id.
packed=cast(int, packer.pack(data_id, detector=detector, returnMaxBits=False)),
visit=cast(int, data_id["visit"]),
day_obs=cast(int, day_obs),
detector=cast(int, detector),
)

def __lt__(self, other: Self, /) -> bool:
return self.packed < other.packed
return (self.visit, self.detector) < (other.visit, other.detector)
2 changes: 1 addition & 1 deletion python/lsst/cell_coadds/_single_cell_coadd.py
Expand Up @@ -110,7 +110,7 @@ def psf_image(self) -> ImageF:
# TODO: Remove the conditioning in DM-40563.
def inputs(self) -> tuple[ObservationIdentifiers, ...] | tuple[()]:
"""Identifiers for the input images that contributed to this cell,
sorted by their `packed` attribute.
sorted by their `visit` attribute first, and then by `detector`.
"""
return self._inputs

Expand Down
1 change: 0 additions & 1 deletion tests/test_coadds.py
Expand Up @@ -211,7 +211,6 @@ def setUpClass(cls) -> None:
physical_filter="dummy-I",
visit=12345,
detector=67,
packed=13579,
day_obs=20000101,
),
),
Expand Down

0 comments on commit 990d208

Please sign in to comment.