def testGetFileNameParameters(self):
     edPluginExecCharacterisation = self.createPlugin()
     xsDataGridScreeningFileNameParameters = edPluginExecCharacterisation.getFileNameParameters(
         "mesh_0_21.676_-0.051_22_001.mccd")
     xsDataGridScreeningFileNameParameters_reference = XSDataGridScreeningFileNameParameters(
     )
     xsDataGridScreeningFileNameParameters_reference.setScanId1(
         XSDataString("0"))
     xsDataGridScreeningFileNameParameters_reference.setMotorPosition1(
         XSDataString("21.676"))
     xsDataGridScreeningFileNameParameters_reference.setMotorPosition2(
         XSDataString("-0.051"))
     xsDataGridScreeningFileNameParameters_reference.setScanId2(
         XSDataString("22"))
     EDAssert.equal(
         xsDataGridScreeningFileNameParameters_reference.marshal(),
         xsDataGridScreeningFileNameParameters.marshal(),
         "Test with conforming image name")
     xsDataGridScreeningFileNameParameters2 = edPluginExecCharacterisation.getFileNameParameters(
         "ref-testscale_1_001.img")
     EDAssert.equal(None, xsDataGridScreeningFileNameParameters2,
                    "Test with non-conforming image name")
     xsDataGridScreeningFileNameParameters3 = edPluginExecCharacterisation.getFileNameParameters(
         "AAA060A_TVP_2_10_57_001.mccd")
     xsDataGridScreeningFileNameParameters_reference3 = XSDataGridScreeningFileNameParameters(
     )
     xsDataGridScreeningFileNameParameters_reference3.setScanId1(
         XSDataString("TVP"))
     xsDataGridScreeningFileNameParameters_reference3.setMotorPosition1(
         XSDataString("2"))
     xsDataGridScreeningFileNameParameters_reference3.setMotorPosition2(
         XSDataString("10"))
     xsDataGridScreeningFileNameParameters_reference3.setScanId2(
         XSDataString("57"))
     EDAssert.equal(
         xsDataGridScreeningFileNameParameters_reference3.marshal(),
         xsDataGridScreeningFileNameParameters3.marshal(),
         "Test with conforming image name")
     xsDataGridScreeningFileNameParameters4 = edPluginExecCharacterisation.getFileNameParameters(
         "semet_nt_7_16_9_001.mccd")
     xsDataGridScreeningFileNameParameters_reference4 = XSDataGridScreeningFileNameParameters(
     )
     xsDataGridScreeningFileNameParameters_reference4.setScanId1(
         XSDataString("nt"))
     xsDataGridScreeningFileNameParameters_reference4.setMotorPosition1(
         XSDataString("7"))
     xsDataGridScreeningFileNameParameters_reference4.setMotorPosition2(
         XSDataString("16"))
     xsDataGridScreeningFileNameParameters_reference4.setScanId2(
         XSDataString("9"))
     EDAssert.equal(
         xsDataGridScreeningFileNameParameters_reference4.marshal(),
         xsDataGridScreeningFileNameParameters4.marshal(),
         "Test with conforming image name")
Example #2
0
 def getFileNameParameters(self, _strFileName):
     """Method for extracting the rotation start angle, the two motor positions and the grid scan image no from the file name"""
     # Typical file name: mesh_0_21.676_-0.051_22_001.mccd
     listParts = os.path.basename(_strFileName).split("_")
     xsDataGridScreeningFileNameParameters = XSDataGridScreeningFileNameParameters()
     try:
         strScanId1 = listParts[1]
         xsDataGridScreeningFileNameParameters.setScanId1(XSDataString(strScanId1))
         strMotorPosition1 = listParts[2]
         xsDataGridScreeningFileNameParameters.setMotorPosition1(XSDataString(strMotorPosition1))
         strMotorPosition2 = listParts[3]
         xsDataGridScreeningFileNameParameters.setMotorPosition2(XSDataString(strMotorPosition2))
         strScanId2 = listParts[4]
         xsDataGridScreeningFileNameParameters.setScanId2(XSDataString(strScanId2))
     except:
         xsDataGridScreeningFileNameParameters = None
     return xsDataGridScreeningFileNameParameters