LSSTApplications  21.0.0+1b62c9342b,21.0.0+45a059f35e,21.0.0-1-ga51b5d4+ceb9cf20a3,21.0.0-19-g7c7630f+a88ebbf2d9,21.0.0-2-g103fe59+3522cf3bc7,21.0.0-2-g1367e85+571a348718,21.0.0-2-g2909d54+45a059f35e,21.0.0-2-g45278ab+1b62c9342b,21.0.0-2-g4bc9b9f+35a70d5868,21.0.0-2-g5242d73+571a348718,21.0.0-2-g54e2caa+aa129c4686,21.0.0-2-g66bcc37+3caef57c29,21.0.0-2-g7f82c8f+6f9059e2fe,21.0.0-2-g8dde007+5d1b9cb3f5,21.0.0-2-g8f08a60+73884b2cf5,21.0.0-2-g973f35b+1d054a08b9,21.0.0-2-ga326454+6f9059e2fe,21.0.0-2-ga63a54e+3d2c655db6,21.0.0-2-gc738bc1+a567cb0f17,21.0.0-2-gde069b7+5a8f2956b8,21.0.0-2-ge17e5af+571a348718,21.0.0-2-ge712728+834f2a3ece,21.0.0-2-gecfae73+dfe6e80958,21.0.0-2-gfc62afb+571a348718,21.0.0-21-g006371a9+88174a2081,21.0.0-3-g4c5b185+7fd31a6834,21.0.0-3-g6d51c4a+3caef57c29,21.0.0-3-gaa929c8+55f5a6a5c9,21.0.0-3-gd222c45+afc8332dbe,21.0.0-3-gd5de2f2+3caef57c29,21.0.0-4-g3300ddd+1b62c9342b,21.0.0-4-g5873dc9+9a92674037,21.0.0-4-g8a80011+5955f0fd15,21.0.0-5-gb7080ec+8658c79ec4,21.0.0-5-gcff38f6+89f2a0074d,21.0.0-6-gd3283ba+55f5a6a5c9,21.0.0-8-g19111d86+2c4b0a9f47,21.0.0-9-g7bed000b9+c7d3cce47e,w.2021.03
LSSTDataManagementBasePackage
Classes | Functions
lsst.cp.pipe.photodiode Namespace Reference

Classes

class  PhotodiodeData
 

Functions

def getBOTphotodiodeData (dataRef, dataPath='/project/shared/BOT/_parent/raw/photodiode_data/', logger=None)
 

Function Documentation

◆ getBOTphotodiodeData()

def lsst.cp.pipe.photodiode.getBOTphotodiodeData (   dataRef,
  dataPath = '/project/shared/BOT/_parent/raw/photodiode_data/',
  logger = None 
)
Get the photodiode data associated with a BOT dataRef.

This is a temporary Gen2-only interface to the photodiode readings from
the SLAC Run3 datasets onwards.

Parameters
----------
dataRef : `lsst.daf.persistence.ButlerDataRef`
    dataRef of the of the detector/visit to load the data for.

dataPath : `str`, optional
    Path at which to find the corresponding photodiode data files.

logger : `lsst.log.Log`, optional
    Logger for logging warnings.


Returns
-------
photodiodeData : `lsst.cp.pipe.photodiode.PhotodiodeData` or `None`
    The full time-series of the photodiode readings, with methods to
    integrate the photocharge, or None if the expected file isn't found.

Definition at line 30 of file photodiode.py.

30 def getBOTphotodiodeData(dataRef, dataPath='/project/shared/BOT/_parent/raw/photodiode_data/',
31  logger=None):
32  """Get the photodiode data associated with a BOT dataRef.
33 
34  This is a temporary Gen2-only interface to the photodiode readings from
35  the SLAC Run3 datasets onwards.
36 
37  Parameters
38  ----------
39  dataRef : `lsst.daf.persistence.ButlerDataRef`
40  dataRef of the of the detector/visit to load the data for.
41 
42  dataPath : `str`, optional
43  Path at which to find the corresponding photodiode data files.
44 
45  logger : `lsst.log.Log`, optional
46  Logger for logging warnings.
47 
48 
49  Returns
50  -------
51  photodiodeData : `lsst.cp.pipe.photodiode.PhotodiodeData` or `None`
52  The full time-series of the photodiode readings, with methods to
53  integrate the photocharge, or None if the expected file isn't found.
54 
55  """
56  if logger is None:
57  logger = lsstLog.Log.getDefaultLogger()
58 
59  def getKeyFromDataId(dataRef, key):
60  if key in dataRef.dataId:
61  return dataRef.dataId[key]
62  else:
63  result = dataRef.getButler().queryMetadata('raw', key, dataRef.dataId)
64  assert len(result) == 1, f"Failed to find unique value for {key} with {dataRef.dataId}"
65  return result[0]
66 
67  dayObs = getKeyFromDataId(dataRef, 'dayObs')
68  seqNum = getKeyFromDataId(dataRef, 'seqNum')
69 
70  filePattern = 'Photodiode_Readings_%s_%06d.txt'
71 
72  dayObsAsNumber = dayObs.replace('-', '')
73  diodeFilename = os.path.join(dataPath, filePattern % (dayObsAsNumber, seqNum))
74 
75  if not os.path.exists(diodeFilename):
76  logger.warn(f"Failed to find the photodiode data at {diodeFilename}")
77  return None
78 
79  try:
80  photodiodeData = PhotodiodeData(diodeFilename)
81  return photodiodeData
82  except Exception:
83  logger.warn(f"Photodiode data found at {diodeFilename} but failed to load.")
84  return None
85 
86 
lsst.cp.pipe.photodiode.getBOTphotodiodeData
def getBOTphotodiodeData(dataRef, dataPath='/project/shared/BOT/_parent/raw/photodiode_data/', logger=None)
Definition: photodiode.py:30