Skip to content

Commit

Permalink
Merge pull request #296 from lsst/tickets/DM-26476
Browse files Browse the repository at this point in the history
DM-26476: Add observation reason to exposure and visit registry
  • Loading branch information
timj committed Sep 30, 2020
2 parents 2b8b609 + 4fc4f68 commit 885a4e5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions python/lsst/obs/base/_instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,7 @@ def makeExposureRecordFromObsInfo(obsInfo, universe):
exposure_time=obsInfo.exposure_time.to_value("s"),
dark_time=obsInfo.dark_time.to_value("s"),
observation_type=obsInfo.observation_type,
observation_reason=obsInfo.observation_reason,
physical_filter=obsInfo.physical_filter,
science_program=obsInfo.science_program,
target_name=obsInfo.object,
Expand Down
6 changes: 6 additions & 0 deletions python/lsst/obs/base/defineVisits.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,11 @@ def _buildVisitRecords(self, definition: VisitDefinitionData, *,
(e.target_name for e in definition.exposures))
science_program = _reduceOrNone(lambda a, b: a if a == b else None,
(e.science_program for e in definition.exposures))
observation_reason = _reduceOrNone(lambda a, b: a if a == b else None,
(e.observation_reason for e in definition.exposures))
if observation_reason is None:
# Be explicit about there being multiple reasons
observation_reason = "various"

# Use the mean zenith angle as an approximation
zenith_angle = _reduceOrNone(sum, (e.zenith_angle for e in definition.exposures))
Expand All @@ -394,6 +399,7 @@ def _buildVisitRecords(self, definition: VisitDefinitionData, *,
physical_filter=physical_filter,
target_name=target_name,
science_program=science_program,
observation_reason=observation_reason,
zenith_angle=zenith_angle,
visit_system=self.groupExposures.getVisitSystem()[0],
exposure_time=exposure_time,
Expand Down

0 comments on commit 885a4e5

Please sign in to comment.