22 __all__ = [
"ExposureIdInfo"]
26 """Exposure ID and number of bits used. 33 maximum number of bits allowed for exposure IDs 35 maximum number of bits available for values that combine exposure ID 36 with other information, such as source ID 38 maximum number of bits available for non-exposure info (maxBits - expBits) 40 One common use is creating an ID factory for making a source table. 41 For example, given a data butler `butler` and a data ID `dataId`:: 43 from lsst.afw.table import IdFactory, SourceTable 44 exposureIdInfo = butler.get("expIdInfo", dataId) 45 sourceIdFactory = IdFactory.makeSource(exposureIdInfo.expId, exposureIdInfo.unusedBits) 46 schema = SourceTable.makeMinimalSchema() 47 #...add fields to schema as desired, then... 48 sourceTable = SourceTable.make(self.schema, sourceIdFactory) 50 At least one bit must be reserved, even if there is no exposure ID, for reasons 51 that are not entirely clear (this is DM-6664). 54 def __init__(self, expId=0, expBits=1, maxBits=64):
55 """Construct an ExposureIdInfo 57 See the class doc string for an explanation of the arguments. 60 expBits = int(expBits)
61 maxBits = int(maxBits)
63 if expId.bit_length() > expBits:
64 raise RuntimeError(
"expId=%s uses %s bits > expBits=%s" % (expId, expId.bit_length(), expBits))
66 raise RuntimeError(
"expBits=%s > maxBits=%s" % (expBits, maxBits))
def __init__(self, expId=0, expBits=1, maxBits=64)