Skip to content

Commit

Permalink
Add observaton reason to exposure and visit registry
Browse files Browse the repository at this point in the history
  • Loading branch information
timj committed Sep 4, 2020
1 parent e482724 commit 63ceb9f
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 @@ -581,6 +581,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 @@ -361,6 +361,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 @@ -376,6 +381,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 63ceb9f

Please sign in to comment.