Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

from __future__ import print_function 

from __future__ import absolute_import 

import lsst.obs.suprimecam as obsSc 

from .utils import * 

 

 

def _getSuprimeMapper(rootdir=None, calibdir=None, outrootdir=None): 

if rootdir is None: 

rootdir = os.path.join(os.environ['HOME'], 'lsst', 'ACT-data') 

if calibdir is None: 

calibdir = os.path.join(rootdir, 'CALIB') 

mapperArgs = dict(root=rootdir, calibRoot=calibdir, outputRoot=outrootdir) 

mapper = obsSc.SuprimecamMapper(**mapperArgs) 

#return mapper 

wrap = WrapperMapper(mapper) 

return wrap 

 

 

def _getSuprimeButler(rootdir=None, calibdir=None, outrootdir=None): 

mapper = _getSuprimeMapper(rootdir, calibdir, outrootdir) 

butlerFactory = dafPersist.ButlerFactory(mapper=mapper) 

butler = butlerFactory.create() 

return butler 

 

 

def getSuprimeDataref(visit, ccd, single=True, rootdir=None, calibdir=None, outrootdir=None): 

butler = _getSuprimeButler(rootdir=rootdir, calibdir=calibdir, outrootdir=outrootdir) 

print('Butler', butler) 

dataRef = butler.subset('raw', dataId=dict(visit=visit, ccd=ccd)) 

print('dataRef:', dataRef) 

print('len(dataRef):', len(dataRef)) 

for dr in dataRef: 

print(' ', dr) 

if single: 

assert(len(dataRef) == 1) 

# dataRef doesn't support indexing, but it does support iteration? 

dr = None 

for dr in dataRef: 

break 

assert(dr) 

return dr 

return dataRef