Example #1
0
    def buildDetector(self):
        """Take all the information and build a Detector object.
        The Detector object is necessary for doing things like assembly.

        Returns
        -------
        detector : `lsst.afw.cameraGeom.Detector`
             The detector.
        """
        if self.detector is not None:
            return self.detector

        schema = afwTable.AmpInfoTable.makeMinimalSchema()
        ampInfo = afwTable.AmpInfoCatalog(schema)
        for ampMetadata in self.ampMetadataList:
            record = ampInfo.addNew()
            self.defaultAmpMap.setAttributes(record, ampMetadata, self.doRaise)
            record.setHasRawInfo(True)

        detConfig = afwCameraGeom.DetectorConfig()
        self.defaultDetectorMap.setAttributes(detConfig, self.detectorMetadata,
                                              self.doRaise)
        self.detector = afwCameraGeom.makeDetector(detConfig, ampInfo,
                                                   self.focalPlaneToField)
        return self.detector
Example #2
0
    def _makeDetectorConfigList(self):
        """!Make a list of detector configs

        @return a list of detector configs (lsst.afw.cameraGeom.DetectorConfig)
        """
        # There is only a single detector assumed perfectly centered and aligned.
        detector0Config = cameraGeom.DetectorConfig()
        detector0Config.name = '0'
        detector0Config.id = 0
        detector0Config.serial = 'abcd1234'
        detector0Config.detectorType = 0
        # This is the orientation we need to put the serial direciton along the x-axis
        detector0Config.bbox_x0 = 0
        detector0Config.bbox_x1 = 2048
        detector0Config.bbox_y0 = 0
        detector0Config.bbox_y1 = 2048
        detector0Config.pixelSize_x = 0.01  # in mm
        detector0Config.pixelSize_y = 0.01  # in mm
        detector0Config.transformDict.nativeSys = 'Pixels'
        detector0Config.transformDict.transforms = None
        detector0Config.refpos_x = 1024
        detector0Config.refpos_y = 1024
        detector0Config.offset_x = 0.0
        detector0Config.offset_y = 0.0
        detector0Config.transposeDetector = False
        detector0Config.pitchDeg = 0.0
        detector0Config.yawDeg = 0.0  # this is where chip rotation goes in.
        detector0Config.rollDeg = 0.0
        return [detector0Config]
Example #3
0
    def _makeDetectorConfigList(cls):
        """Make a list of detector configs

        Returns
        -------
        detectorConfigList : `list` of `lsst.afw.cameraGeom.DetectorConfig`
            List of detector configs.
        """
        # this camera has one detector that corresponds to a subregion of lsstSim detector R:2,2 S:0,0
        # with lower left corner 0, 1000 and dimensions 1018 x 2000
        # i.e. half of each of the following channels: 0,0, 0,1, 1,0 and 1,1
        detector0Config = cameraGeom.DetectorConfig()
        detector0Config.name = '0'
        detector0Config.id = 0
        detector0Config.serial = '0000011'
        detector0Config.detectorType = 0
        detector0Config.bbox_x0 = 0
        detector0Config.bbox_x1 = 1017
        detector0Config.bbox_y0 = 0
        detector0Config.bbox_y1 = 1999
        detector0Config.pixelSize_x = 0.01
        detector0Config.pixelSize_y = 0.01
        detector0Config.transformDict.nativeSys = 'Pixels'
        detector0Config.transformDict.transforms = None
        detector0Config.refpos_x = 2035.5
        detector0Config.refpos_y = 999.5
        detector0Config.offset_x = -42.26073
        detector0Config.offset_y = -42.21914
        detector0Config.transposeDetector = False
        detector0Config.pitchDeg = 0.0
        detector0Config.yawDeg = 90.0
        detector0Config.rollDeg = 0.0
        return [detector0Config]
Example #4
0
    def _makeDetectorConfigList(self, ccdParams):
        """!Make a list of detector configs

        @return a list of detector configs (lsst.afw.cameraGeom.DetectorConfig)
        """
        detectorConfigs = []
        for name, ccd in ccdParams.items():
            detectorConfig = cameraGeom.DetectorConfig()
            detectorConfigs.append(detectorConfig)

            detectorConfig.name = name
            detectorConfig.id = ccd['id']
            detectorConfig.serial = ccd['serial']
            detectorConfig.detectorType = ccd['detectorType']
            # This is the orientation we need to put the serial direction along the x-axis
            detectorConfig.bbox_x0, detectorConfig.bbox_y0 = ccd['bbox'][0]
            detectorConfig.bbox_x1, detectorConfig.bbox_y1 = ccd['bbox'][1]
            detectorConfig.pixelSize_x, detectorConfig.pixelSize_y = ccd['pixelSize']
            detectorConfig.transformDict.nativeSys = ccd['transformDict']['nativeSys']
            transforms = ccd['transformDict']['transforms']
            detectorConfig.transformDict.transforms = None if transforms == 'None' else transforms
            detectorConfig.refpos_x, detectorConfig.refpos_y = ccd['refpos']
            detectorConfig.offset_x, detectorConfig.offset_y = ccd['offset']
            detectorConfig.transposeDetector = ccd['transposeDetector']
            detectorConfig.pitchDeg = ccd['pitch']
            detectorConfig.yawDeg = ccd['yaw']
            detectorConfig.rollDeg = ccd['roll']
        
        return detectorConfigs
Example #5
0
    def _makeDetectorConfigList(self):
        """!Make a list of detector configs

        @return a list of detector configs (lsst.afw.cameraGeom.DetectorConfig)
        """
        # There is only a single detector assumed perfectly centered and aligned.
        detector0Config = cameraGeom.DetectorConfig()
        detector0Config.name = '0'
        detector0Config.id = 0
        detector0Config.serial = 'abcd1234'
        detector0Config.detectorType = 0  # SCIENCE type
        # This is the orientation we need to put the serial direciton along the x-axis
        # This bounding box is not true in general, but I don't think it's used, so specify
        # zero size, so we'll know if it is.
        detector0Config.bbox_x0 = 0
        detector0Config.bbox_x1 = 0
        detector0Config.bbox_y0 = 0
        detector0Config.bbox_y1 = 0
        detector0Config.pixelSize_x = 1.  # in mm
        detector0Config.pixelSize_y = 1.  # in mm
        detector0Config.transformDict.nativeSys = 'Pixels'
        detector0Config.transformDict.transforms = None
        detector0Config.refpos_x = 0.
        detector0Config.refpos_y = 0.
        detector0Config.offset_x = 0.0
        detector0Config.offset_y = 0.0
        detector0Config.transposeDetector = False
        detector0Config.pitchDeg = 0.0
        detector0Config.yawDeg = 0.0  # this is where chip rotation goes in.
        detector0Config.rollDeg = 0.0
        return [detector0Config]
Example #6
0
    def _makeDetectorConfig(self, id, fpPos):
        """Make a detector config for one detector.

        Parameters
        ----------
        id : `int`
            Detector ID.
        fpPos : pair of `float`
            Focal plane position of detector, in units of detector
            width/height. For example:

            - (0, 0) is a detector centered on the focal plane
            - (1, 0) is adjacent to a centered detector,
              in the direction of increasing focal plane x

        Returns
        -------
        detectorConfig : `lsst.afw.cameraGeom.DetectorConfig`
            Detector configuration for one detector.
        """
        bbox = lsst.geom.Box2I(
            lsst.geom.Point2I(0, 0),
            lsst.geom.Extent2I(self.detectorWidthPix, self.detectorHeightPix))
        ctr = lsst.geom.Box2D(bbox).getCenter()
        pixelSizeMm = 0.01
        config = cameraGeom.DetectorConfig()
        config.name = "D{}".format(id)
        config.id = id
        # detector serial number is not used by the CBP code,
        # but some value is required to construct a Detector
        config.serial = '0000011'
        config.detectorType = 0
        config.bbox_x0 = bbox.getMinX()
        config.bbox_x1 = bbox.getMaxX()
        config.bbox_y0 = bbox.getMinY()
        config.bbox_y1 = bbox.getMaxY()
        config.pixelSize_x = pixelSizeMm
        config.pixelSize_y = pixelSizeMm
        config.transformDict.nativeSys = 'Pixels'
        config.transformDict.transforms = None
        config.refpos_x = ctr[0]
        config.refpos_y = ctr[1]
        config.offset_x = fpPos[0] * pixelSizeMm * self.detectorWidthPix
        config.offset_y = fpPos[1] * pixelSizeMm * self.detectorHeightPix
        config.transposeDetector = False
        config.pitchDeg = 0.0
        config.yawDeg = 0.0
        config.rollDeg = 0.0
        return config