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