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