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

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

# This file is part of obs_subaru. 

# 

# Developed for the LSST Data Management System. 

# This product includes software developed by the LSST Project 

# (http://www.lsst.org). 

# See the COPYRIGHT file at the top-level directory of this distribution 

# for details of code ownership. 

# 

# This program is free software: you can redistribute it and/or modify 

# it under the terms of the GNU General Public License as published by 

# the Free Software Foundation, either version 3 of the License, or 

# (at your option) any later version. 

# 

# This program is distributed in the hope that it will be useful, 

# but WITHOUT ANY WARRANTY; without even the implied warranty of 

# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 

# GNU General Public License for more details. 

# 

# You should have received a copy of the GNU General Public License 

# along with this program. If not, see <http://www.gnu.org/licenses/>. 

 

"""Gen3 Butler registry declarations for Hyper Suprime-Cam. 

""" 

 

import re 

 

from lsst.daf.butler.instrument import Instrument 

 

__all__ = ("HyperSuprimeCam",) 

 

# Regular expression that matches HSC PhysicalFilter names (the same as Gen2 

# filternames), with a group that can be lowercased to yield the 

# associated AbstractFilter. 

FILTER_REGEX = re.compile(r"HSC\-([GRIZY])2?") 

 

 

class HyperSuprimeCam(Instrument): 

"""Gen3 Butler specialization class for Subaru's Hyper Suprime-Cam. 

 

The current implementation simply retrieves the information it needs 

from a Gen2 HscMapper instance (the only constructor argument). This 

will obviously need to be changed before Gen2 is retired, but it avoids 

duplication for now. 

""" 

 

instrument = "HSC" 

 

def __init__(self, mapper): 

self.detectors = [ 

dict( 

detector=detector.getId(), 

name=detector.getName(), 

# getType() returns a pybind11-wrapped enum, which 

# unfortunately has no way to extract the name of just 

# the value (it's always prefixed by the enum type name). 

purpose=str(detector.getType()).split(".")[-1], 

# The most useful grouping of detectors in HSC is by their 

# orientation w.r.t. the focal plane, so that's what 

# we put in the 'group' field. 

group="NQUARTER{:d}".format(detector.getOrientation().getNQuarter() % 4) 

) 

for detector in mapper.camera 

] 

self.physicalFilters = [] 

for name in mapper.filters: 

# We use one of grizy for the abstract filter, when appropriate, 

# which we identify as when the physical filter starts with 

# "HSC-[GRIZY]". Note that this means that e.g. "HSC-I" and 

# "HSC-I2" are both mapped to abstract filter "i". 

m = FILTER_REGEX.match(name) 

self.physicalFilters.append( 

dict( 

physical_filter=name, 

abstract_filter=m.group(1).lower() if m is not None else None 

) 

)