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