Exemple #1
0
    def getXSDataXDSDetector(_xsDataDetector):
        EDFactoryPluginStatic.loadModule("XSDataXDSv1_0")
        from XSDataXDSv1_0 import XSDataXDSDetector
        from XSDataXDSv1_0 import XSDataXDSIntegerRange
        xsDataXDSDetector = XSDataXDSDetector()
        strDetectorType = _xsDataDetector.getType().getValue()
        if ((strDetectorType == "q4")      or \
             (strDetectorType == "q4-2x")   or \
             (strDetectorType == "q210")    or \
             (strDetectorType == "q210-2x") or \
             (strDetectorType == "q315")    or \
             (strDetectorType == "q315-2x")):
            xsDataXDSDetector.setDetector_name(XSDataString("ADSC"))
            xsDataXDSDetector.setMinimum_valid_pixel_value(XSDataInteger(1))
            xsDataXDSDetector.setOverload(XSDataInteger(65535))

            xsDataXDSIntegerRangeTrustedPixel = XSDataXDSIntegerRange()
            xsDataXDSIntegerRangeTrustedPixel.setLower(XSDataInteger(6000))
            xsDataXDSIntegerRangeTrustedPixel.setUpper(XSDataInteger(30000))
            xsDataXDSDetector.setValue_range_for_trusted_detector_pixels(
                xsDataXDSIntegerRangeTrustedPixel)
#        elif ( strDetectorType == "mar165") or \
#               strDetectorType == "mar225") ):
#            xsDataXDSDetector.setType( XSDataString( "MARCCD" ) )
        elif strDetectorType == "pilatus6m":
            xsDataXDSDetector.setDetector_name(XSDataString("PILATUS"))
            listUntrustedRectangle = \
               [[ 487, 495, 0, 2528], \
                [ 981, 989, 0, 2528], \
                [1475, 1483, 0, 2528], \
                [1969, 1977, 0, 2528], \
                [   0, 2464, 195, 213], \
                [   0, 2464, 407, 425], \
                [   0, 2464, 619, 637], \
                [   0, 2464, 831, 849], \
                [   0, 2464, 1043, 1061], \
                [   0, 2464, 1255, 1273], \
                [   0, 2464, 1467, 1485], \
                [   0, 2464, 1679, 1697], \
                [   0, 2464, 1891, 1909], \
                [   0, 2464, 2103, 2121], \
                [   0, 2464, 2315, 2333]]
            for listRectangle in listUntrustedRectangle:
                xsDataXDSRectangle = XSDataXDSRectangle()
                xsDataXDSRectangle.setX1(XSDataInteger(listRectangle[0]))
                xsDataXDSRectangle.setX2(XSDataInteger(listRectangle[1]))
                xsDataXDSRectangle.setY1(XSDataInteger(listRectangle[2]))
                xsDataXDSRectangle.setY2(XSDataInteger(listRectangle[3]))
                xsDataXDSDetector.addUntrusted_rectangle(xsDataXDSRectangle)
            xsDataXDSDetector.setMinimum_valid_pixel_value(XSDataInteger(0))
            xsDataXDSDetector.setOverload(XSDataInteger(1048500))

            xsDataXDSIntegerRangeTrustedPixel = XSDataXDSIntegerRange()
            xsDataXDSIntegerRangeTrustedPixel.setLower(XSDataInteger(7000))
            xsDataXDSIntegerRangeTrustedPixel.setUpper(XSDataInteger(30000))
            xsDataXDSDetector.setValue_range_for_trusted_detector_pixels(
                xsDataXDSIntegerRangeTrustedPixel)

            xsDataXDSDoubleRangeTrustedRegion = XSDataXDSDoubleRange()
            xsDataXDSDoubleRangeTrustedRegion.setLower(XSDataDouble(0.0))
            xsDataXDSDoubleRangeTrustedRegion.setUpper(XSDataDouble(1.41))
            xsDataXDSDetector.setTrusted_region(
                xsDataXDSDoubleRangeTrustedRegion)

            xsDataXDSDetector.setSensor_thickness(XSDataDouble(0.32))
        else:
            # This is a temporary solution for the exception problem pointed out in bug #43.
            # Instead of raising an exception with a known type we send the error message as a string.
            pyStrErrorMessage = "EDHandlerXSDataXDSv1_0.getXSDataXDSDetector: Unknown detector type : " + strDetectorType
            raise Exception, pyStrErrorMessage

        xsDataXDSDetector.setNx(_xsDataDetector.getNumberPixelX())
        xsDataXDSDetector.setNy(_xsDataDetector.getNumberPixelY())
        xsDataXDSDetector.setQx(_xsDataDetector.getPixelSizeX())
        xsDataXDSDetector.setQy(_xsDataDetector.getPixelSizeY())
        xsDataXDSDetector.setDetector_distance(_xsDataDetector.getDistance())

        fOrgx = _xsDataDetector.getBeamPositionY().getValue(
        ) / _xsDataDetector.getPixelSizeY().getValue()
        fOrgy = _xsDataDetector.getBeamPositionX().getValue(
        ) / _xsDataDetector.getPixelSizeX().getValue()
        xsDataXDSDetector.setOrgx(XSDataDouble(fOrgx))
        xsDataXDSDetector.setOrgy(XSDataDouble(fOrgy))
        xsDataVectorDoubleXAxis = XSDataVectorDouble()

        xsDataVectorDoubleXAxis.setV1(1.0)
        xsDataVectorDoubleXAxis.setV2(0.0)
        xsDataVectorDoubleXAxis.setV3(0.0)
        xsDataXDSDetector.setDirection_of_detector_x_axis(
            xsDataVectorDoubleXAxis)

        xsDataVectorDoubleYAxis = XSDataVectorDouble()
        xsDataVectorDoubleYAxis.setV1(0.0)
        xsDataVectorDoubleYAxis.setV2(1.0)
        xsDataVectorDoubleYAxis.setV3(0.0)
        xsDataXDSDetector.setDirection_of_detector_y_axis(
            xsDataVectorDoubleYAxis)

        return xsDataXDSDetector
Exemple #2
0
    def getXSDataXDSDetector(_xsDataDetector):
        EDFactoryPluginStatic.loadModule("XSDataXDSv1_0")
        from XSDataXDSv1_0 import XSDataXDSDetector
        from XSDataXDSv1_0 import XSDataXDSIntegerRange
        xsDataXDSDetector = XSDataXDSDetector()
        strDetectorType = _xsDataDetector.getType().getValue()
        if ((strDetectorType == "q4")      or \
             (strDetectorType == "q4-2x")   or \
             (strDetectorType == "q210")    or \
             (strDetectorType == "q210-2x") or \
             (strDetectorType == "q315")    or \
             (strDetectorType == "q315-2x")):
            xsDataXDSDetector.setDetector_name(XSDataString("ADSC"))
            xsDataXDSDetector.setMinimum_valid_pixel_value(XSDataInteger(1))
            xsDataXDSDetector.setOverload(XSDataInteger(65535))

            xsDataXDSIntegerRangeTrustedPixel = XSDataXDSIntegerRange()
            xsDataXDSIntegerRangeTrustedPixel.setLower(XSDataInteger(6000))
            xsDataXDSIntegerRangeTrustedPixel.setUpper(XSDataInteger(30000))
            xsDataXDSDetector.setValue_range_for_trusted_detector_pixels(xsDataXDSIntegerRangeTrustedPixel)
#        elif ( strDetectorType == "mar165") or \
#               strDetectorType == "mar225") ):
#            xsDataXDSDetector.setType( XSDataString( "MARCCD" ) )
        elif strDetectorType == "pilatus6m":
            xsDataXDSDetector.setDetector_name(XSDataString("PILATUS"))
            listUntrustedRectangle = \
               [[ 487, 495, 0, 2528], \
                [ 981, 989, 0, 2528], \
                [1475, 1483, 0, 2528], \
                [1969, 1977, 0, 2528], \
                [   0, 2464, 195, 213], \
                [   0, 2464, 407, 425], \
                [   0, 2464, 619, 637], \
                [   0, 2464, 831, 849], \
                [   0, 2464, 1043, 1061], \
                [   0, 2464, 1255, 1273], \
                [   0, 2464, 1467, 1485], \
                [   0, 2464, 1679, 1697], \
                [   0, 2464, 1891, 1909], \
                [   0, 2464, 2103, 2121], \
                [   0, 2464, 2315, 2333]]
            for listRectangle in listUntrustedRectangle:
                xsDataXDSRectangle = XSDataXDSRectangle()
                xsDataXDSRectangle.setX1(XSDataInteger(listRectangle[0]))
                xsDataXDSRectangle.setX2(XSDataInteger(listRectangle[1]))
                xsDataXDSRectangle.setY1(XSDataInteger(listRectangle[2]))
                xsDataXDSRectangle.setY2(XSDataInteger(listRectangle[3]))
                xsDataXDSDetector.addUntrusted_rectangle(xsDataXDSRectangle)
            xsDataXDSDetector.setMinimum_valid_pixel_value(XSDataInteger(0))
            xsDataXDSDetector.setOverload(XSDataInteger(1048500))

            xsDataXDSIntegerRangeTrustedPixel = XSDataXDSIntegerRange()
            xsDataXDSIntegerRangeTrustedPixel.setLower(XSDataInteger(7000))
            xsDataXDSIntegerRangeTrustedPixel.setUpper(XSDataInteger(30000))
            xsDataXDSDetector.setValue_range_for_trusted_detector_pixels(xsDataXDSIntegerRangeTrustedPixel)

            xsDataXDSDoubleRangeTrustedRegion = XSDataXDSDoubleRange()
            xsDataXDSDoubleRangeTrustedRegion.setLower(XSDataDouble(0.0))
            xsDataXDSDoubleRangeTrustedRegion.setUpper(XSDataDouble(1.41))
            xsDataXDSDetector.setTrusted_region(xsDataXDSDoubleRangeTrustedRegion)

            xsDataXDSDetector.setSensor_thickness(XSDataDouble(0.32))
        elif strDetectorType == "pilatus2m":
            xsDataXDSDetector.setDetector_name(XSDataString("PILATUS"))
            listUntrustedRectangle = \
               [[ 487, 495, 0, 1680], \
                [ 981, 989, 0, 1680], \
                [   0, 1476, 195, 213], \
                [   0, 1476, 407, 425], \
                [   0, 1476, 619, 637], \
                [   0, 1476, 831, 849], \
                [   0, 1476, 1043, 1061], \
                [   0, 1476, 1255, 1273], \
                [   0, 1476, 1467, 1485]]
            for listRectangle in listUntrustedRectangle:
                xsDataXDSRectangle = XSDataXDSRectangle()
                xsDataXDSRectangle.setX1(XSDataInteger(listRectangle[0]))
                xsDataXDSRectangle.setX2(XSDataInteger(listRectangle[1]))
                xsDataXDSRectangle.setY1(XSDataInteger(listRectangle[2]))
                xsDataXDSRectangle.setY2(XSDataInteger(listRectangle[3]))
                xsDataXDSDetector.addUntrusted_rectangle(xsDataXDSRectangle)
            xsDataXDSDetector.setMinimum_valid_pixel_value(XSDataInteger(0))
            xsDataXDSDetector.setOverload(XSDataInteger(1048500))

            xsDataXDSIntegerRangeTrustedPixel = XSDataXDSIntegerRange()
            xsDataXDSIntegerRangeTrustedPixel.setLower(XSDataInteger(7000))
            xsDataXDSIntegerRangeTrustedPixel.setUpper(XSDataInteger(30000))
            xsDataXDSDetector.setValue_range_for_trusted_detector_pixels(xsDataXDSIntegerRangeTrustedPixel)

            xsDataXDSDoubleRangeTrustedRegion = XSDataXDSDoubleRange()
            xsDataXDSDoubleRangeTrustedRegion.setLower(XSDataDouble(0.0))
            xsDataXDSDoubleRangeTrustedRegion.setUpper(XSDataDouble(1.41))
            xsDataXDSDetector.setTrusted_region(xsDataXDSDoubleRangeTrustedRegion)

            xsDataXDSDetector.setSensor_thickness(XSDataDouble(0.32))
        elif strDetectorType == "eiger4m":
            xsDataXDSDetector.setDetector_name(XSDataString("PILATUS"))
            listUntrustedRectangle = \
               [[ 1029, 1040, 0, 2167], \
                [ 0, 2070, 512, 550], \
                [ 0, 2070, 1063, 1103], \
                [ 0, 2070, 1614, 1654],
                ]
            for listRectangle in listUntrustedRectangle:
                xsDataXDSRectangle = XSDataXDSRectangle()
                xsDataXDSRectangle.setX1(XSDataInteger(listRectangle[0]))
                xsDataXDSRectangle.setX2(XSDataInteger(listRectangle[1]))
                xsDataXDSRectangle.setY1(XSDataInteger(listRectangle[2]))
                xsDataXDSRectangle.setY2(XSDataInteger(listRectangle[3]))
                xsDataXDSDetector.addUntrusted_rectangle(xsDataXDSRectangle)
            xsDataXDSDetector.setMinimum_valid_pixel_value(XSDataInteger(0))
            xsDataXDSDetector.setOverload(XSDataInteger(1048500))

            xsDataXDSIntegerRangeTrustedPixel = XSDataXDSIntegerRange()
            xsDataXDSIntegerRangeTrustedPixel.setLower(XSDataInteger(7000))
            xsDataXDSIntegerRangeTrustedPixel.setUpper(XSDataInteger(30000))
            xsDataXDSDetector.setValue_range_for_trusted_detector_pixels(xsDataXDSIntegerRangeTrustedPixel)

            xsDataXDSDoubleRangeTrustedRegion = XSDataXDSDoubleRange()
            xsDataXDSDoubleRangeTrustedRegion.setLower(XSDataDouble(0.0))
            xsDataXDSDoubleRangeTrustedRegion.setUpper(XSDataDouble(1.41))
            xsDataXDSDetector.setTrusted_region(xsDataXDSDoubleRangeTrustedRegion)

            xsDataXDSDetector.setSensor_thickness(XSDataDouble(0.32))
        elif strDetectorType == "eiger9m":
            xsDataXDSDetector.setDetector_name(XSDataString("PILATUS"))
            listUntrustedRectangle = \
               [[ 1029, 1040, 0, 3269], \
                [ 2069, 2082, 0, 3269], \
                [ 0, 3110, 513, 553], \
                [ 0, 3110, 1064, 1104], \
                [ 0, 3110, 1615, 1655], \
                [ 0, 3110, 2166, 2206], \
                [ 0, 3110, 2717, 2757], \
                ]
            for listRectangle in listUntrustedRectangle:
                xsDataXDSRectangle = XSDataXDSRectangle()
                xsDataXDSRectangle.setX1(XSDataInteger(listRectangle[0]))
                xsDataXDSRectangle.setX2(XSDataInteger(listRectangle[1]))
                xsDataXDSRectangle.setY1(XSDataInteger(listRectangle[2]))
                xsDataXDSRectangle.setY2(XSDataInteger(listRectangle[3]))
                xsDataXDSDetector.addUntrusted_rectangle(xsDataXDSRectangle)
            xsDataXDSDetector.setMinimum_valid_pixel_value(XSDataInteger(0))
            xsDataXDSDetector.setOverload(XSDataInteger(1048500))

            xsDataXDSIntegerRangeTrustedPixel = XSDataXDSIntegerRange()
            xsDataXDSIntegerRangeTrustedPixel.setLower(XSDataInteger(7000))
            xsDataXDSIntegerRangeTrustedPixel.setUpper(XSDataInteger(30000))
            xsDataXDSDetector.setValue_range_for_trusted_detector_pixels(xsDataXDSIntegerRangeTrustedPixel)

            xsDataXDSDoubleRangeTrustedRegion = XSDataXDSDoubleRange()
            xsDataXDSDoubleRangeTrustedRegion.setLower(XSDataDouble(0.0))
            xsDataXDSDoubleRangeTrustedRegion.setUpper(XSDataDouble(1.41))
            xsDataXDSDetector.setTrusted_region(xsDataXDSDoubleRangeTrustedRegion)

            xsDataXDSDetector.setSensor_thickness(XSDataDouble(0.45))
        elif strDetectorType == "eiger16m":
            xsDataXDSDetector.setDetector_name(XSDataString("PILATUS"))
            # From https://www.psi.ch/sls/pxi/ComputingEN/XDS.INP.E16M.X06SA_2016.txt
            # !EXCLUSION OF HORIZONTAL DEAD AREAS OF THE EIGER 16M DETECTOR + ONE PIXEL ON EACH SIDE
            # UNTRUSTED_RECTANGLE=    0 4151    513  553
            # UNTRUSTED_RECTANGLE=    0 4151   1064 1104
            # UNTRUSTED_RECTANGLE=    0 4151   1615 1655
            # UNTRUSTED_RECTANGLE=    0 4151   2166 2206
            # UNTRUSTED_RECTANGLE=    0 4151   2717 2757
            # UNTRUSTED_RECTANGLE=    0 4151   3268 3308
            # UNTRUSTED_RECTANGLE=    0 4151   3819 3859
            # !EXCLUSION OF VERTICAL DEAD AREAS OF THE EIGER 16M DETECTOR + ONE PIXEL ON EACH SIDE
            # UNTRUSTED_RECTANGLE= 1029 1042      0 4372
            # UNTRUSTED_RECTANGLE= 2069 2082      0 4372
            # UNTRUSTED_RECTANGLE= 3109 3122      0 4372
            listUntrustedRectangle = \
                [
                    [    0, 4151, 513, 553],
                    [    0, 4151, 1064, 1104],
                    [    0, 4151, 1615, 1655],
                    [    0, 4151, 2166, 2206],
                    [    0, 4151, 2717, 2757],
                    [    0, 4151, 3268, 3308],
                    [    0, 4151, 3819, 3859],
                    [ 1029, 1042, 0, 4372],
                    [ 2069, 2082, 0, 4372],
                    [ 3109, 3122, 0, 4372],
                ]
            for listRectangle in listUntrustedRectangle:
                xsDataXDSRectangle = XSDataXDSRectangle()
                xsDataXDSRectangle.setX1(XSDataInteger(listRectangle[0]))
                xsDataXDSRectangle.setX2(XSDataInteger(listRectangle[1]))
                xsDataXDSRectangle.setY1(XSDataInteger(listRectangle[2]))
                xsDataXDSRectangle.setY2(XSDataInteger(listRectangle[3]))
                xsDataXDSDetector.addUntrusted_rectangle(xsDataXDSRectangle)
            xsDataXDSDetector.setMinimum_valid_pixel_value(XSDataInteger(0))
            xsDataXDSDetector.setOverload(XSDataInteger(1048500))

            xsDataXDSIntegerRangeTrustedPixel = XSDataXDSIntegerRange()
            xsDataXDSIntegerRangeTrustedPixel.setLower(XSDataInteger(4000))
            xsDataXDSIntegerRangeTrustedPixel.setUpper(XSDataInteger(30000))
            xsDataXDSDetector.setValue_range_for_trusted_detector_pixels(xsDataXDSIntegerRangeTrustedPixel)

            xsDataXDSDoubleRangeTrustedRegion = XSDataXDSDoubleRange()
            xsDataXDSDoubleRangeTrustedRegion.setLower(XSDataDouble(0.0))
            xsDataXDSDoubleRangeTrustedRegion.setUpper(XSDataDouble(1.21))
            xsDataXDSDetector.setTrusted_region(xsDataXDSDoubleRangeTrustedRegion)

            xsDataXDSDetector.setSensor_thickness(XSDataDouble(0.32))

        elif strDetectorType == "mar225":
            xsDataXDSDetector.setDetector_name(XSDataString("CCDCHESS"))
            xsDataXDSDetector.setMinimum_valid_pixel_value(XSDataInteger(0))
            xsDataXDSDetector.setOverload(XSDataInteger(65000))

            xsDataXDSIntegerRangeTrustedPixel = XSDataXDSIntegerRange()
            xsDataXDSIntegerRangeTrustedPixel.setLower(XSDataInteger(7000))
            xsDataXDSIntegerRangeTrustedPixel.setUpper(XSDataInteger(30000))
            xsDataXDSDetector.setValue_range_for_trusted_detector_pixels(xsDataXDSIntegerRangeTrustedPixel)

            xsDataXDSDoubleRangeTrustedRegion = XSDataXDSDoubleRange()
            xsDataXDSDoubleRangeTrustedRegion.setLower(XSDataDouble(0.0))
            xsDataXDSDoubleRangeTrustedRegion.setUpper(XSDataDouble(1.4))
            xsDataXDSDetector.setTrusted_region(xsDataXDSDoubleRangeTrustedRegion)
        else:
            # This is a temporary solution for the exception problem pointed out in bug #43.
            # Instead of raising an exception with a known type we send the error message as a string.
            pyStrErrorMessage = "EDHandlerXSDataXDSv1_0.getXSDataXDSDetector: Unknown detector type : " + strDetectorType
            raise BaseException(pyStrErrorMessage)

        xsDataXDSDetector.setNx(_xsDataDetector.getNumberPixelX())
        xsDataXDSDetector.setNy(_xsDataDetector.getNumberPixelY())
        xsDataXDSDetector.setQx(_xsDataDetector.getPixelSizeX())
        xsDataXDSDetector.setQy(_xsDataDetector.getPixelSizeY())
        xsDataXDSDetector.setDetector_distance(_xsDataDetector.getDistance())

        fOrgx = _xsDataDetector.getBeamPositionY().getValue() / _xsDataDetector.getPixelSizeY().getValue()
        fOrgy = _xsDataDetector.getBeamPositionX().getValue() / _xsDataDetector.getPixelSizeX().getValue()
        xsDataXDSDetector.setOrgx(XSDataDouble(fOrgx))
        xsDataXDSDetector.setOrgy(XSDataDouble(fOrgy))
        xsDataVectorDoubleXAxis = XSDataVectorDouble()

        xsDataVectorDoubleXAxis.setV1(1.0)
        xsDataVectorDoubleXAxis.setV2(0.0)
        xsDataVectorDoubleXAxis.setV3(0.0)
        xsDataXDSDetector.setDirection_of_detector_x_axis(xsDataVectorDoubleXAxis)

        xsDataVectorDoubleYAxis = XSDataVectorDouble()
        xsDataVectorDoubleYAxis.setV1(0.0)
        xsDataVectorDoubleYAxis.setV2(1.0)
        xsDataVectorDoubleYAxis.setV3(0.0)
        xsDataXDSDetector.setDirection_of_detector_y_axis(xsDataVectorDoubleYAxis)


        return xsDataXDSDetector