LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
Public Member Functions | Static Public Attributes | List of all members
lsst.obs.decam.decamMapper.DecamMapper Class Reference
Inheritance diagram for lsst.obs.decam.decamMapper.DecamMapper:

Public Member Functions

def __init__ (self, inputPolicy=None, **kwargs)
 
def bypass_ccdExposureId (self, datasetType, pythonType, location, dataId)
 
def bypass_ccdExposureId_bits (self, datasetType, pythonType, location, dataId)
 
def bypass_deepCoaddId (self, datasetType, pythonType, location, dataId)
 
def bypass_deepCoaddId_bits (self, *args, **kwargs)
 
def bypass_deepMergedCoaddId (self, datasetType, pythonType, location, dataId)
 
def bypass_deepMergedCoaddId_bits (self, *args, **kwargs)
 
def bypass_dcrCoaddId (self, datasetType, pythonType, location, dataId)
 
def bypass_dcrCoaddId_bits (self, *args, **kwargs)
 
def bypass_dcrMergedCoaddId (self, datasetType, pythonType, location, dataId)
 
def bypass_dcrMergedCoaddId_bits (self, *args, **kwargs)
 
def translate_dqmask (self, dqmask)
 
def translate_wtmap (self, wtmap)
 
def bypass_instcal (self, datasetType, pythonType, butlerLocation, dataId)
 
def std_raw (self, item, dataId)
 
def std_dark (self, item, dataId)
 
def std_bias (self, item, dataId)
 
def std_flat (self, item, dataId)
 
def std_illumcor (self, item, dataId)
 
def std_cpBias (self, item, dataId)
 
def std_cpFlat (self, item, dataId)
 
def std_fringe (self, item, dataId)
 
def std_cpIllumcor (self, item, dataId)
 
def getLinearizerDir (cls)
 
def map_linearizer (self, dataId, write=False)
 
def getCrosstalkDir (cls)
 

Static Public Attributes

string packageName = 'obs_decam'
 
 MakeRawVisitInfoClass = MakeDecamRawVisitInfo
 
dictionary detectorNames
 

Detailed Description

Definition at line 45 of file decamMapper.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.obs.decam.decamMapper.DecamMapper.__init__ (   self,
  inputPolicy = None,
**  kwargs 
)

Definition at line 61 of file decamMapper.py.

61  def __init__(self, inputPolicy=None, **kwargs):
62  policyFile = Policy.defaultPolicyFile(self.packageName, "DecamMapper.yaml", "policy")
63  policy = Policy(policyFile)
64 
65  super(DecamMapper, self).__init__(policy, os.path.dirname(policyFile), **kwargs)
66 
67  DECAM_FILTER_DEFINITIONS.defineFilters()
68 
69  # The data ID key ccdnum is not directly used in the current policy
70  # template of the raw and instcal et al. datasets, so is not in its
71  # keyDict automatically. Add it so the butler know about the data ID key
72  # ccdnum.
73  # Similarly, add "object" for raws.
74  for datasetType in ("raw", "instcal", "dqmask", "wtmap", "cpIllumcor"):
75  self.mappings[datasetType].keyDict.update({'ccdnum': int})
76  self.mappings["raw"].keyDict.update({'object': str})
77 
78  # The number of bits allocated for fields in object IDs
79  # TODO: This needs to be updated; also see Trac #2797
80  DecamMapper._nbit_tract = 10
81  DecamMapper._nbit_patch = 10
82  DecamMapper._nbit_filter = 4
83  DecamMapper._nbit_id = 64 - (DecamMapper._nbit_tract
84  + 2*DecamMapper._nbit_patch
85  + DecamMapper._nbit_filter)
86 

Member Function Documentation

◆ bypass_ccdExposureId()

def lsst.obs.decam.decamMapper.DecamMapper.bypass_ccdExposureId (   self,
  datasetType,
  pythonType,
  location,
  dataId 
)

Definition at line 100 of file decamMapper.py.

100  def bypass_ccdExposureId(self, datasetType, pythonType, location, dataId):
101  return self._computeCcdExposureId(dataId)
102 

◆ bypass_ccdExposureId_bits()

def lsst.obs.decam.decamMapper.DecamMapper.bypass_ccdExposureId_bits (   self,
  datasetType,
  pythonType,
  location,
  dataId 
)

Definition at line 103 of file decamMapper.py.

103  def bypass_ccdExposureId_bits(self, datasetType, pythonType, location, dataId):
104  return 32 # not really, but this leaves plenty of space for sources
105 

◆ bypass_dcrCoaddId()

def lsst.obs.decam.decamMapper.DecamMapper.bypass_dcrCoaddId (   self,
  datasetType,
  pythonType,
  location,
  dataId 
)

Definition at line 164 of file decamMapper.py.

164  def bypass_dcrCoaddId(self, datasetType, pythonType, location, dataId):
165  return self.bypass_deepCoaddId(datasetType, pythonType, location, dataId)
166 

◆ bypass_dcrCoaddId_bits()

def lsst.obs.decam.decamMapper.DecamMapper.bypass_dcrCoaddId_bits (   self,
args,
**  kwargs 
)

Definition at line 167 of file decamMapper.py.

167  def bypass_dcrCoaddId_bits(self, *args, **kwargs):
168  return self.bypass_deepCoaddId_bits(*args, **kwargs)
169 

◆ bypass_dcrMergedCoaddId()

def lsst.obs.decam.decamMapper.DecamMapper.bypass_dcrMergedCoaddId (   self,
  datasetType,
  pythonType,
  location,
  dataId 
)

Definition at line 170 of file decamMapper.py.

170  def bypass_dcrMergedCoaddId(self, datasetType, pythonType, location, dataId):
171  return self.bypass_deepMergedCoaddId(datasetType, pythonType, location, dataId)
172 

◆ bypass_dcrMergedCoaddId_bits()

def lsst.obs.decam.decamMapper.DecamMapper.bypass_dcrMergedCoaddId_bits (   self,
args,
**  kwargs 
)

Definition at line 173 of file decamMapper.py.

173  def bypass_dcrMergedCoaddId_bits(self, *args, **kwargs):
174  return self.bypass_deepMergedCoaddId_bits(*args, **kwargs)
175 

◆ bypass_deepCoaddId()

def lsst.obs.decam.decamMapper.DecamMapper.bypass_deepCoaddId (   self,
  datasetType,
  pythonType,
  location,
  dataId 
)

Definition at line 152 of file decamMapper.py.

152  def bypass_deepCoaddId(self, datasetType, pythonType, location, dataId):
153  return self._computeCoaddExposureId(dataId, True)
154 

◆ bypass_deepCoaddId_bits()

def lsst.obs.decam.decamMapper.DecamMapper.bypass_deepCoaddId_bits (   self,
args,
**  kwargs 
)

Definition at line 155 of file decamMapper.py.

155  def bypass_deepCoaddId_bits(self, *args, **kwargs):
156  return 64 - DecamMapper._nbit_id
157 

◆ bypass_deepMergedCoaddId()

def lsst.obs.decam.decamMapper.DecamMapper.bypass_deepMergedCoaddId (   self,
  datasetType,
  pythonType,
  location,
  dataId 
)

Definition at line 158 of file decamMapper.py.

158  def bypass_deepMergedCoaddId(self, datasetType, pythonType, location, dataId):
159  return self._computeCoaddExposureId(dataId, False)
160 

◆ bypass_deepMergedCoaddId_bits()

def lsst.obs.decam.decamMapper.DecamMapper.bypass_deepMergedCoaddId_bits (   self,
args,
**  kwargs 
)

Definition at line 161 of file decamMapper.py.

161  def bypass_deepMergedCoaddId_bits(self, *args, **kwargs):
162  return 64 - DecamMapper._nbit_id
163 

◆ bypass_instcal()

def lsst.obs.decam.decamMapper.DecamMapper.bypass_instcal (   self,
  datasetType,
  pythonType,
  butlerLocation,
  dataId 
)

Definition at line 205 of file decamMapper.py.

205  def bypass_instcal(self, datasetType, pythonType, butlerLocation, dataId):
206  # Workaround until I can access the butler
207  instcalMap = self.map_instcal(dataId)
208  dqmaskMap = self.map_dqmask(dataId)
209  wtmapMap = self.map_wtmap(dataId)
210  instcalType = getattr(afwImage, instcalMap.getPythonType().split(".")[-1])
211  dqmaskType = getattr(afwImage, dqmaskMap.getPythonType().split(".")[-1])
212  wtmapType = getattr(afwImage, wtmapMap.getPythonType().split(".")[-1])
213  instcal = instcalType(instcalMap.getLocationsWithRoot()[0])
214  dqmask = dqmaskType(dqmaskMap.getLocationsWithRoot()[0])
215  wtmap = wtmapType(wtmapMap.getLocationsWithRoot()[0])
216 
217  mask = self.translate_dqmask(dqmask)
218  variance = self.translate_wtmap(wtmap)
219 
220  mi = afwImage.MaskedImageF(afwImage.ImageF(instcal.getImage()), mask, variance)
221  md = readMetadata(instcalMap.getLocationsWithRoot()[0])
222  fix_header(md, translator_class=DecamTranslator)
223  wcs = makeSkyWcs(md, strip=True)
224  exp = afwImage.ExposureF(mi, wcs)
225 
226  exp.setPhotoCalib(afwImage.makePhotoCalibFromCalibZeroPoint(10**(0.4 * md.getScalar("MAGZERO")), 0))
227  visitInfo = self.makeRawVisitInfo(md=md)
228  exp.getInfo().setVisitInfo(visitInfo)
229  if 'EXPID' in md:
230  exp.info.id = md['EXPID']
231 
232  for kw in ('LTV1', 'LTV2'):
233  md.remove(kw)
234 
235  exp.setMetadata(md)
236  return exp
237 
std::shared_ptr< daf::base::PropertyList > readMetadata(std::string const &fileName, int hdu=DEFAULT_HDU, bool strip=false)
Read FITS header.
Definition: fits.cc:1657
std::shared_ptr< SkyWcs > makeSkyWcs(daf::base::PropertySet &metadata, bool strip=false)
Construct a SkyWcs from FITS keywords.
Definition: SkyWcs.cc:521
std::shared_ptr< PhotoCalib > makePhotoCalibFromCalibZeroPoint(double instFluxMag0, double instFluxMag0Err)
Construct a PhotoCalib from the deprecated Calib-style instFluxMag0/instFluxMag0Err values.
Definition: PhotoCalib.cc:613

◆ getCrosstalkDir()

def lsst.obs.decam.decamMapper.DecamMapper.getCrosstalkDir (   cls)
Directory containing crosstalk tables.

Definition at line 377 of file decamMapper.py.

377  def getCrosstalkDir(cls):
378  """Directory containing crosstalk tables.
379  """
380  packageName = cls.getPackageName()
381  packageDir = getPackageDir(packageName)
382  return os.path.join(packageDir, "decam", "crosstalk")
std::string getPackageDir(std::string const &packageName)
return the root directory of a setup package
Definition: packaging.cc:33

◆ getLinearizerDir()

def lsst.obs.decam.decamMapper.DecamMapper.getLinearizerDir (   cls)
Directory containing linearizers

Definition at line 356 of file decamMapper.py.

356  def getLinearizerDir(cls):
357  """Directory containing linearizers"""
358  packageName = cls.getPackageName()
359  packageDir = getPackageDir(packageName)
360  return os.path.join(packageDir, "decam", "linearizer")
361 

◆ map_linearizer()

def lsst.obs.decam.decamMapper.DecamMapper.map_linearizer (   self,
  dataId,
  write = False 
)
Map a linearizer

Definition at line 362 of file decamMapper.py.

362  def map_linearizer(self, dataId, write=False):
363  """Map a linearizer"""
364  actualId = self._transformId(dataId)
365  location = "%02d.fits" % (dataId["ccdnum"])
366  return ButlerLocation(
367  pythonType="lsst.ip.isr.LinearizeSquared",
368  cppType="Config",
369  storageName="PickleStorage",
370  locationList=[location],
371  dataId=actualId,
372  mapper=self,
373  storage=Storage.makeFromURI(self.getLinearizerDir())
374  )
375 

◆ std_bias()

def lsst.obs.decam.decamMapper.DecamMapper.std_bias (   self,
  item,
  dataId 
)

Definition at line 291 of file decamMapper.py.

291  def std_bias(self, item, dataId):
293  return self._standardizeExposure(self.calibrations["bias"], exp, dataId, filter=False)
294 
std::shared_ptr< Exposure< ImagePixelT, MaskPixelT, VariancePixelT > > makeExposure(MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > &mimage, std::shared_ptr< geom::SkyWcs const > wcs=std::shared_ptr< geom::SkyWcs const >())
A function to return an Exposure of the correct type (cf.
Definition: Exposure.h:462
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > * makeMaskedImage(typename std::shared_ptr< Image< ImagePixelT >> image, typename std::shared_ptr< Mask< MaskPixelT >> mask=Mask< MaskPixelT >(), typename std::shared_ptr< Image< VariancePixelT >> variance=Image< VariancePixelT >())
A function to return a MaskedImage of the correct type (cf.
Definition: MaskedImage.h:1240

◆ std_cpBias()

def lsst.obs.decam.decamMapper.DecamMapper.std_cpBias (   self,
  item,
  dataId 
)

Definition at line 342 of file decamMapper.py.

342  def std_cpBias(self, item, dataId):
343  return self._standardizeCpMasterCal("cpBias", item, dataId, setFilter=False)
344 

◆ std_cpFlat()

def lsst.obs.decam.decamMapper.DecamMapper.std_cpFlat (   self,
  item,
  dataId 
)

Definition at line 345 of file decamMapper.py.

345  def std_cpFlat(self, item, dataId):
346  return self._standardizeCpMasterCal("cpFlat", item, dataId, setFilter=True)
347 

◆ std_cpIllumcor()

def lsst.obs.decam.decamMapper.DecamMapper.std_cpIllumcor (   self,
  item,
  dataId 
)

Definition at line 352 of file decamMapper.py.

352  def std_cpIllumcor(self, item, dataId):
353  return self._standardizeCpMasterCal("cpIllumcor", item, dataId, setFilter=True)
354 

◆ std_dark()

def lsst.obs.decam.decamMapper.DecamMapper.std_dark (   self,
  item,
  dataId 
)

Definition at line 281 of file decamMapper.py.

281  def std_dark(self, item, dataId):
283  rawPath = self.map_raw(dataId).getLocations()[0]
284  headerPath = re.sub(r'[\[](\d+)[\]]$', "[0]", rawPath)
285  md0 = readMetadata(headerPath)
286  fix_header(md0, translator_class=DecamTranslator)
287  visitInfo = self.makeRawVisitInfo(md0)
288  exp.getInfo().setVisitInfo(visitInfo)
289  return self._standardizeExposure(self.calibrations["dark"], exp, dataId, filter=False)
290 

◆ std_flat()

def lsst.obs.decam.decamMapper.DecamMapper.std_flat (   self,
  item,
  dataId 
)

Definition at line 295 of file decamMapper.py.

295  def std_flat(self, item, dataId):
297  return self._standardizeExposure(self.calibrations["flat"], exp, dataId, filter=True)
298 

◆ std_fringe()

def lsst.obs.decam.decamMapper.DecamMapper.std_fringe (   self,
  item,
  dataId 
)

Definition at line 348 of file decamMapper.py.

348  def std_fringe(self, item, dataId):
350  return self._standardizeExposure(self.calibrations["fringe"], exp, dataId)
351 

◆ std_illumcor()

def lsst.obs.decam.decamMapper.DecamMapper.std_illumcor (   self,
  item,
  dataId 
)

Definition at line 299 of file decamMapper.py.

299  def std_illumcor(self, item, dataId):
301  return self._standardizeExposure(self.calibrations["illumcor"], exp, dataId, filter=True)
302 

◆ std_raw()

def lsst.obs.decam.decamMapper.DecamMapper.std_raw (   self,
  item,
  dataId 
)
Standardize a raw dataset by converting it to an Exposure.

Raw images are MEF files with one HDU for each detector.

Parameters
----------
item : `lsst.afw.image.DecoratedImage`
    The image read by the butler.
dataId : data ID
    Data identifier.

Returns
-------
result : `lsst.afw.image.Exposure`
    The standardized Exposure.

Definition at line 238 of file decamMapper.py.

238  def std_raw(self, item, dataId):
239  """Standardize a raw dataset by converting it to an Exposure.
240 
241  Raw images are MEF files with one HDU for each detector.
242 
243  Parameters
244  ----------
245  item : `lsst.afw.image.DecoratedImage`
246  The image read by the butler.
247  dataId : data ID
248  Data identifier.
249 
250  Returns
251  -------
252  result : `lsst.afw.image.Exposure`
253  The standardized Exposure.
254  """
255  return self._standardizeExposure(self.exposures['raw'], item, dataId,
256  trimmed=False, setExposureId=True)
257 

◆ translate_dqmask()

def lsst.obs.decam.decamMapper.DecamMapper.translate_dqmask (   self,
  dqmask 
)

Definition at line 176 of file decamMapper.py.

176  def translate_dqmask(self, dqmask):
177  # TODO: make a class member variable that knows the mappings
178  # below instead of hard-coding them
179  dqmArr = dqmask.getArray()
180  mask = afwImage.Mask(dqmask.getDimensions())
181  mArr = mask.getArray()
182  idxBad = np.where(dqmArr & 1)
183  idxSat = np.where(dqmArr & 2)
184  idxIntrp = np.where(dqmArr & 4)
185  idxCr = np.where(dqmArr & 16)
186  idxBleed = np.where(dqmArr & 64)
187  idxEdge = np.where(dqmArr & 512)
188  mArr[idxBad] |= mask.getPlaneBitMask("BAD")
189  mArr[idxSat] |= mask.getPlaneBitMask("SAT")
190  mArr[idxIntrp] |= mask.getPlaneBitMask("INTRP")
191  mArr[idxCr] |= mask.getPlaneBitMask("CR")
192  mArr[idxBleed] |= mask.getPlaneBitMask("SAT")
193  mArr[idxEdge] |= mask.getPlaneBitMask("EDGE")
194  return mask
195 
Represent a 2-dimensional array of bitmask pixels.
Definition: Mask.h:77

◆ translate_wtmap()

def lsst.obs.decam.decamMapper.DecamMapper.translate_wtmap (   self,
  wtmap 
)

Definition at line 196 of file decamMapper.py.

196  def translate_wtmap(self, wtmap):
197  wtmArr = wtmap.getArray()
198  idxUndefWeight = np.where(wtmArr <= 0)
199  # Reassign weights to be finite but small:
200  wtmArr[idxUndefWeight] = min(1e-14, np.min(wtmArr[np.where(wtmArr > 0)]))
201  var = 1.0 / wtmArr
202  varim = afwImage.ImageF(var)
203  return varim
204 
int min

Member Data Documentation

◆ detectorNames

dictionary lsst.obs.decam.decamMapper.DecamMapper.detectorNames
static
Initial value:
= {
1: 'S29', 2: 'S30', 3: 'S31', 4: 'S25', 5: 'S26', 6: 'S27', 7: 'S28', 8: 'S20', 9: 'S21',
10: 'S22', 11: 'S23', 12: 'S24', 13: 'S14', 14: 'S15', 15: 'S16', 16: 'S17', 17: 'S18',
18: 'S19', 19: 'S8', 20: 'S9', 21: 'S10', 22: 'S11', 23: 'S12', 24: 'S13', 25: 'S1', 26: 'S2',
27: 'S3', 28: 'S4', 29: 'S5', 30: 'S6', 31: 'S7', 32: 'N1', 33: 'N2', 34: 'N3', 35: 'N4',
36: 'N5', 37: 'N6', 38: 'N7', 39: 'N8', 40: 'N9', 41: 'N10', 42: 'N11', 43: 'N12', 44: 'N13',
45: 'N14', 46: 'N15', 47: 'N16', 48: 'N17', 49: 'N18', 50: 'N19', 51: 'N20', 52: 'N21',
53: 'N22', 54: 'N23', 55: 'N24', 56: 'N25', 57: 'N26', 58: 'N27', 59: 'N28', 60: 'N29',
62: 'N31'}

Definition at line 51 of file decamMapper.py.

◆ MakeRawVisitInfoClass

lsst.obs.decam.decamMapper.DecamMapper.MakeRawVisitInfoClass = MakeDecamRawVisitInfo
static

Definition at line 49 of file decamMapper.py.

◆ packageName

string lsst.obs.decam.decamMapper.DecamMapper.packageName = 'obs_decam'
static

Definition at line 46 of file decamMapper.py.


The documentation for this class was generated from the following file: