Skip to content

Commit

Permalink
Context: get_obs accepts a list of ints for detsets
Browse files Browse the repository at this point in the history
Also get_meta is documented and accepts a simple string obs_id.
  • Loading branch information
mhasself authored and keskitalo committed Jan 28, 2021
1 parent 92bb392 commit ebafa77
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions sotodlib/core/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,12 @@ def get_obs(self, obs_id=None, dets=None, detsets=None,

# Intersect with detectors allowed by the detsets argument?
if detsets is not None:
all_detsets = self.obsfiledb.get_detsets(obs_id)
ddets = []
for ds in detsets:
if isinstance(ds, int):
# So user can pass in detsets=[0] as a shortcut.
ds = all_detsets[ds]
ddets.extend(self.obsfiledb.get_dets(ds))
dets_selection.append(ddets)

Expand Down Expand Up @@ -164,6 +168,13 @@ def get_obs(self, obs_id=None, dets=None, detsets=None,
return aman

def get_meta(self, request):
"""Load and return the supporting metadata for an observation. The
request parameter can be a simple observation id as a string,
or else a request dict like the kind passed in from get_obs.
"""
if isinstance(request, str):
request = {'obs:obs_id': request}
return self.loader.load(self['metadata'][:], request)


Expand Down

0 comments on commit ebafa77

Please sign in to comment.