def getOutputDataFromDNATableFile(self, _strFileName): """Parses the result 'DNA'-type XML file""" xsDataResultRdfit = XSDataResultRdfit() strDnaTablesXML = self.readProcessFile(_strFileName) xsDataDnaTables = dna_tables.parseString(strDnaTablesXML) # Loop through all the tables and fill in the relevant parts of xsDataResultBest xsDataRDFIT_Results = EDUtilsTable.getTableListFromTables(xsDataDnaTables, "RDFIT_Results")[0] xsDataListGeneral = EDUtilsTable.getListsFromTable(xsDataRDFIT_Results, "general")[0] xsDataItemBeta = EDUtilsTable.getItemFromList(xsDataListGeneral, "beta") if xsDataItemBeta is not None: beta = xsDataItemBeta.getValueOf_() xsDataResultRdfit.setBeta(XSDataDouble(beta)) xsDataItemGama = EDUtilsTable.getItemFromList(xsDataListGeneral, "gama") if xsDataItemGama is not None: gama = xsDataItemGama.getValueOf_() xsDataResultRdfit.setGama(XSDataDouble(gama)) xsDataItemDose_half_th = EDUtilsTable.getItemFromList(xsDataListGeneral, "Dose_1/2_th") if xsDataItemDose_half_th is not None: dose_half_th = xsDataItemDose_half_th.getValueOf_() xsDataResultRdfit.setDose_half_th(XSDataDouble(dose_half_th)) xsDataItemDose_half = EDUtilsTable.getItemFromList(xsDataListGeneral, "Dose_1/2") if xsDataItemDose_half is not None: dose_half = xsDataItemDose_half.getValueOf_() xsDataResultRdfit.setDose_half(XSDataDouble(dose_half)) xsDataItemRelative_radiation_sensitivity = EDUtilsTable.getItemFromList(xsDataListGeneral, "Relative_Radiation_Sensitivity") if xsDataItemRelative_radiation_sensitivity is not None: relative_radiation_sensitivity = xsDataItemRelative_radiation_sensitivity.getValueOf_() xsDataResultRdfit.setRelative_radiation_sensitivity(XSDataDouble(relative_radiation_sensitivity)) return xsDataResultRdfit
def testListOfTables(self): xsItem = None xsItem2 = None strDnaTablesXML = EDUtilsFile.readFile(self.__strFilePath2) xsDataDnaTables = dna_tables.parseString(strDnaTablesXML) listTable = EDUtilsTable.getTableListFromTables( xsDataDnaTables, "data_collection_strategy") EDAssert.equal(2, len(listTable)) bFoundPlan1 = False bFoundPlan2 = False for xsTable in listTable: xsItem = None xsLists = EDUtilsTable.getListsFromTable(xsTable, "summary") for xsList in xsLists: xsItem = EDUtilsTable.getItemFromList(xsList, "resolution_reasoning") if (xsItem.getValueOf_() == "Low-resolution pass, no overloads"): bFoundPlan1 = True if (xsItem.getValueOf_() == "Resolution limit is set by the initial image resolution"): bFoundPlan2 = True EDAssert.equal(True, bFoundPlan1) EDAssert.equal(True, bFoundPlan2)
def testListOfTables(self): xsItem = None xsItem2 = None strDnaTablesXML = EDUtilsFile.readFile(self.__strFilePath2) xsDataDnaTables = dna_tables.parseString(strDnaTablesXML) listTable = EDUtilsTable.getTableListFromTables(xsDataDnaTables, "data_collection_strategy") EDAssert.equal(2, len(listTable)) bFoundPlan1 = False bFoundPlan2 = False for xsTable in listTable: xsItem = None xsLists = EDUtilsTable.getListsFromTable(xsTable, "summary") for xsList in xsLists: xsItem = EDUtilsTable.getItemFromList(xsList, "resolution_reasoning") if(xsItem.getValueOf_() == "Low-resolution pass, no overloads"): bFoundPlan1 = True if(xsItem.getValueOf_() == "Resolution limit is set by the initial image resolution"): bFoundPlan2 = True EDAssert.equal(True, bFoundPlan1) EDAssert.equal(True, bFoundPlan2)
def testTableListItem(self): xsItem = None xsItem2 = None strDnaTablesXML = EDUtilsFile.readFile(self.__strFilePath) xsDataDnaTables = dna_tables.parseString(strDnaTablesXML) xsTable = EDUtilsTable.getTableFromTables(xsDataDnaTables, "input") xsLists = EDUtilsTable.getListsFromTable(xsTable, "select_task") for xsList in xsLists: xsItem = EDUtilsTable.getItemFromList(xsList, "task") xsItem2 = EDUtilsTable.getItemFromList(xsList, "tata") EDAssert.equal("optimize", xsItem.getValueOf_()) EDAssert.equal(None, xsItem2) xsLists = EDUtilsTable.getListsFromTable(xsTable, "select_tata") EDAssert.equal([], xsLists) xsTable = EDUtilsTable.getTableFromTables(xsDataDnaTables, "toto") EDAssert.equal(None, xsTable) EDVerbose.DEBUG("Test done...")
def getOutputDataFromDNATableFile(self, _strFileName): """Parses the result 'DNA'-type XML file""" xsDataResultRdfit = XSDataResultRdfit() strDnaTablesXML = self.readProcessFile(_strFileName) xsDataDnaTables = dna_tables.parseString(strDnaTablesXML) # Loop through all the tables and fill in the relevant parts of xsDataResultBest xsDataRDFIT_Results = EDUtilsTable.getTableListFromTables( xsDataDnaTables, "RDFIT_Results")[0] xsDataListGeneral = EDUtilsTable.getListsFromTable( xsDataRDFIT_Results, "general")[0] xsDataItemBeta = EDUtilsTable.getItemFromList(xsDataListGeneral, "beta") if xsDataItemBeta is not None: beta = xsDataItemBeta.getValueOf_() xsDataResultRdfit.setBeta(XSDataDouble(beta)) xsDataItemGama = EDUtilsTable.getItemFromList(xsDataListGeneral, "gama") if xsDataItemGama is not None: gama = xsDataItemGama.getValueOf_() xsDataResultRdfit.setGama(XSDataDouble(gama)) xsDataItemDose_half_th = EDUtilsTable.getItemFromList( xsDataListGeneral, "Dose_1/2_th") if xsDataItemDose_half_th is not None: dose_half_th = xsDataItemDose_half_th.getValueOf_() xsDataResultRdfit.setDose_half_th(XSDataDouble(dose_half_th)) xsDataItemDose_half = EDUtilsTable.getItemFromList( xsDataListGeneral, "Dose_1/2") if xsDataItemDose_half is not None: dose_half = xsDataItemDose_half.getValueOf_() xsDataResultRdfit.setDose_half(XSDataDouble(dose_half)) xsDataItemRelative_radiation_sensitivity = EDUtilsTable.getItemFromList( xsDataListGeneral, "Relative_Radiation_Sensitivity") if xsDataItemRelative_radiation_sensitivity is not None: relative_radiation_sensitivity = xsDataItemRelative_radiation_sensitivity.getValueOf_( ) xsDataResultRdfit.setRelative_radiation_sensitivity( XSDataDouble(relative_radiation_sensitivity)) return xsDataResultRdfit
def createDataMOSFLMOutputIntegration(self): self.DEBUG("EDPluginMOSFLMIntegrationv10.createDataMOSFLMOutputIntegration") xsDataMOSFLMOutputIntegration = XSDataMOSFLMOutputIntegration() # Read bestfile.par, bestfile.hkl and bestfile.dat strBestfilePar = self.readBestFile("bestfile.par") bContinue = True if (strBestfilePar is not None): xsDataMOSFLMOutputIntegration.setBestfilePar(XSDataString(strBestfilePar)) else: bContinue = False if bContinue: strBestfileHKL = self.readBestFile("bestfile.hkl") if (strBestfileHKL is not None): xsDataMOSFLMOutputIntegration.setBestfileHKL(XSDataString(strBestfileHKL)) else: bContinue = False if bContinue: strBestfileDat = self.readBestFile("bestfile.dat") if (strBestfileDat is not None): xsDataMOSFLMOutputIntegration.setBestfileDat(XSDataString(strBestfileDat)) else: bContinue = False if bContinue: strDnaTablesXML = self.readProcessFile(self.getBaseName() + "_dnaTables.xml") xsDataDnaTables = dna_tables.parseString(strDnaTablesXML) xsTableIntegrationResults = EDUtilsTable.getTableFromTables(xsDataDnaTables, "integration_results") xsListFinalResiduals = EDUtilsTable.getListsFromTable(xsTableIntegrationResults, "final_residuals")[0] strRMSSpotDeviation = EDUtilsTable.getItemFromList(xsListFinalResiduals, "rms").getValueOf_() xsDataMOSFLMOutputIntegration.setRMSSpotDeviation(XSDataLength(float(strRMSSpotDeviation))) strBeamPositionX = EDUtilsTable.getItemFromList(xsListFinalResiduals, "xcen").getValueOf_() strBeamPositionY = EDUtilsTable.getItemFromList(xsListFinalResiduals, "ycen").getValueOf_() xsDataMOSFLMBeamPosition = XSDataMOSFLMBeamPosition() xsDataMOSFLMBeamPosition.setX(XSDataLength(float(strBeamPositionX))) xsDataMOSFLMBeamPosition.setY(XSDataLength(float(strBeamPositionY))) xsDataMOSFLMOutputIntegration.setRefinedBeam(xsDataMOSFLMBeamPosition) xsDataMOSFLMNewmatMatrix = self.getDataMOSFLMMatrix() xsDataMOSFLMOutputIntegration.setRefinedNewmat(xsDataMOSFLMNewmatMatrix) # New results (described in bug #63) xsTableIntegrationOutput = EDUtilsTable.getTableFromTables(xsDataDnaTables, "integration_output") xsListOutputFiles = EDUtilsTable.getListsFromTable(xsTableIntegrationOutput, "output_files")[0] strMTZFilename = EDUtilsTable.getItemFromList(xsListOutputFiles, "hklout").getValueOf_() strMTZPath = os.path.join(self.getWorkingDirectory(), strMTZFilename) xsDataFile = XSDataFile() xsDataFile.setPath(XSDataString(strMTZPath)) xsDataMOSFLMOutputIntegration.setGeneratedMTZFile(xsDataFile) xsTableSummaryInformation = EDUtilsTable.getTableFromTables(xsDataDnaTables, "summary_information") xsListSummary = EDUtilsTable.getListsFromTable(xsTableSummaryInformation, "summary")[0] xsListSpots = EDUtilsTable.getListsFromTable(xsTableSummaryInformation, "spots")[0] strDistance = EDUtilsTable.getItemFromList(xsListSummary, "distance").getValueOf_() xsDataMOSFLMOutputIntegration.setRefinedDistance(XSDataLength(float(strDistance))) strYScale = EDUtilsTable.getItemFromList(xsListSummary, "yscale").getValueOf_() xsDataMOSFLMOutputIntegration.setRefinedYScale(XSDataFloat(float(strYScale))) strOverallIOverSigma = EDUtilsTable.getItemFromList(xsListSummary, "isigall").getValueOf_() xsDataMOSFLMOutputIntegration.setOverallIOverSigma(XSDataFloat(float(strOverallIOverSigma))) strHighestResolutionIOverSigma = EDUtilsTable.getItemFromList(xsListSummary, "isigout").getValueOf_() xsDataMOSFLMOutputIntegration.setHighestResolutionIOverSigma(XSDataFloat(float(strHighestResolutionIOverSigma))) strNumberOfBadReflections = EDUtilsTable.getItemFromList(xsListSpots, "bad_spots").getValueOf_() xsDataMOSFLMOutputIntegration.setNumberOfBadReflections(XSDataInteger(int(strNumberOfBadReflections))) strNumberOfFullyRecordedReflections = EDUtilsTable.getItemFromList(xsListSpots, "full").getValueOf_() xsDataMOSFLMOutputIntegration.setNumberOfFullyRecordedReflections(XSDataInteger(int(strNumberOfFullyRecordedReflections))) strNumberOfNegativeReflections = EDUtilsTable.getItemFromList(xsListSpots, "negative").getValueOf_() xsDataMOSFLMOutputIntegration.setNumberOfNegativeReflections(XSDataInteger(int(strNumberOfNegativeReflections))) strNumberOfOverlappedReflections = EDUtilsTable.getItemFromList(xsListSpots, "overlap").getValueOf_() xsDataMOSFLMOutputIntegration.setNumberOfOverlappedReflections(XSDataInteger(int(strNumberOfOverlappedReflections))) strNumberOfPartialReflections = EDUtilsTable.getItemFromList(xsListSpots, "partial").getValueOf_() xsDataMOSFLMOutputIntegration.setNumberOfPartialReflections(XSDataInteger(int(strNumberOfPartialReflections))) # Fill in the statistics xsDataMOSFLMOutputIntegration.setOverallStatistics(self.getMOSFLMIntegrationStatisticsPerResolutionBin(xsDataDnaTables, "bin_0")) iIndex = 1 bContinue = True fMinResolution = None while (bContinue == True): strBin = "bin_%d" % iIndex # I don't know how many intensity bins there are. Since the EDUtilsTable.getListsFromTable # method crashes if the list is not present, I had to wrap the calls to this method in # try - except: try: xsDataMOSFLMIntegrationStatisticsPerResolutionBin = self.getMOSFLMIntegrationStatisticsPerResolutionBin(xsDataDnaTables, strBin, fMinResolution) fMinResolution = xsDataMOSFLMIntegrationStatisticsPerResolutionBin.getMaxResolution().getValue() xsDataMOSFLMOutputIntegration.addStatisticsPerResolutionBin(xsDataMOSFLMIntegrationStatisticsPerResolutionBin) iIndex += 1 except: bContinue = False # Path to log file xsDataMOSFLMOutputIntegration.setPathToLogFile(XSDataFile(XSDataString(os.path.join(self.getWorkingDirectory(), self.getScriptLogFileName())))) return xsDataMOSFLMOutputIntegration
def createDataMOSFLMOutputIndexing(self): EDVerbose.DEBUG("EDPluginMOSFLMIndexingv10.createDataMOSFLMOutputIndexing") xsDataMOSFLMOutputIndexing = XSDataMOSFLMOutputIndexing() # Read Newmat file xsDataMOSFLMNewmat = self.getDataMOSFLMNewmat() if (xsDataMOSFLMNewmat is None): strError = "MOSFLM indexing error : No solution was obtained!" EDVerbose.ERROR(strError) self.setFailure() else: xsDataMOSFLMOutputIndexing.setRefinedNewmat(xsDataMOSFLMNewmat) # Then read the XML file strDnaTablesXML = self.readProcessFile(self.getScriptBaseName() + "_dnaTables.xml") xsDataDnaTables = dna_tables.parseString(strDnaTablesXML) listXSTableMosaicityEstimation = EDUtilsTable.getTableListFromTables(xsDataDnaTables, "mosaicity_estimation") dMosaicityValueSum = 0.0 nValues = 0 for xsTableMosaicityEstimation in listXSTableMosaicityEstimation: for xsListMosaicity in EDUtilsTable.getListsFromTable(xsTableMosaicityEstimation, "mosaicity"): dMosaicityValue = float(EDUtilsTable.getItemFromList(xsListMosaicity, "value").getValueOf_()) dMosaicityValueSum += dMosaicityValue nValues += 1 xsDataFloatMosaicityEstimation = XSDataFloat() xsDataFloatMosaicityEstimation.setValue(dMosaicityValueSum / nValues) xsDataMOSFLMOutputIndexing.setMosaicityEstimation(xsDataFloatMosaicityEstimation) xsTableRefinement = EDUtilsTable.getTableFromTables(xsDataDnaTables, "refinement") if (xsTableRefinement is None): strError = "MOSFLM indexing error : No solution was refined!" EDVerbose.ERROR(strError) self.setFailure() else: xsListDeviations = EDUtilsTable.getListsFromTable(xsTableRefinement, "deviations")[0] dDeviationAngular = float(EDUtilsTable.getItemFromList(xsListDeviations, "angular").getValueOf_()) dDeviationPositional = float(EDUtilsTable.getItemFromList(xsListDeviations, "positional").getValueOf_()) xsDataMOSFLMOutputIndexing.setDeviationAngular(XSDataAngle(dDeviationAngular)) xsDataMOSFLMOutputIndexing.setDeviationPositional(XSDataLength(dDeviationPositional)) xsListResults = EDUtilsTable.getListsFromTable(xsTableRefinement, "results")[0] dDetectorDistance = float(EDUtilsTable.getItemFromList(xsListResults, "detector_distance").getValueOf_()) xsDataMOSFLMOutputIndexing.setRefinedDistance(XSDataLength(dDetectorDistance)) xsListParameters = EDUtilsTable.getListsFromTable(xsTableRefinement, "parameters")[0] iSpotsUsed = int(EDUtilsTable.getItemFromList(xsListParameters, "used").getValueOf_()) iSpotsTotal = int(EDUtilsTable.getItemFromList(xsListParameters, "out_of").getValueOf_()) xsDataMOSFLMOutputIndexing.setSpotsUsed(XSDataInteger(iSpotsUsed)) xsDataMOSFLMOutputIndexing.setSpotsTotal(XSDataInteger(iSpotsTotal)) xsTableSolutionRefinement = EDUtilsTable.getTableFromTables(xsDataDnaTables, "solution_refinement") xsListParameters = EDUtilsTable.getListsFromTable(xsTableSolutionRefinement, "selection")[0] iSelectedSolutionNumber = int(EDUtilsTable.getItemFromList(xsListParameters, "number").getValueOf_()) xsDataMOSFLMOutputIndexing.setSelectedSolutionNumber(XSDataInteger(iSelectedSolutionNumber)) strSelectedSolutionSpaceGroup = (EDUtilsTable.getItemFromList(xsListParameters, "spacegroup").getValueOf_()) xsDataMOSFLMOutputIndexing.setSelectedSolutionSpaceGroup(XSDataString(strSelectedSolutionSpaceGroup)) iSelectedSolutionSpaceGroupNumber = int(EDUtilsTable.getItemFromList(xsListParameters, "spacegroup_number").getValueOf_()) xsDataMOSFLMOutputIndexing.setSelectedSolutionSpaceGroupNumber(XSDataInteger(iSelectedSolutionSpaceGroupNumber)) xsTableAutoIndexSolutions = EDUtilsTable.getTableFromTables(xsDataDnaTables, "autoindex_solutions") xsListsSolution = xsTableAutoIndexSolutions.getList() for xsListSolution in xsListsSolution: xsDataMOSFLMIndexingSolution = XSDataMOSFLMIndexingSolution() xsDataCell = XSDataCell() iSolutionNumber = int(EDUtilsTable.getItemFromList(xsListSolution, "index").getValueOf_()) xsDataMOSFLMIndexingSolution.setIndex(XSDataInteger(iSolutionNumber)) iPenalty = int(EDUtilsTable.getItemFromList(xsListSolution, "penalty").getValueOf_()) xsDataMOSFLMIndexingSolution.setPenalty(XSDataInteger(iPenalty)) strLattice = (EDUtilsTable.getItemFromList(xsListSolution, "lattice").getValueOf_()) xsDataMOSFLMIndexingSolution.setLattice(XSDataString(strLattice)) dA = float(EDUtilsTable.getItemFromList(xsListSolution, "a").getValueOf_()) xsDataCell.setLength_a(XSDataLength(dA)) dB = float(EDUtilsTable.getItemFromList(xsListSolution, "b").getValueOf_()) xsDataCell.setLength_b(XSDataLength(dB)) dC = float(EDUtilsTable.getItemFromList(xsListSolution, "c").getValueOf_()) xsDataCell.setLength_c(XSDataLength(dC)) dAlpha = float(EDUtilsTable.getItemFromList(xsListSolution, "alpha").getValueOf_()) xsDataCell.setAngle_alpha(XSDataAngle(dAlpha)) dBeta = float(EDUtilsTable.getItemFromList(xsListSolution, "beta").getValueOf_()) xsDataCell.setAngle_beta(XSDataAngle(dBeta)) dGamma = float(EDUtilsTable.getItemFromList(xsListSolution, "gamma").getValueOf_()) xsDataCell.setAngle_gamma(XSDataAngle(dGamma)) xsDataMOSFLMIndexingSolution.setCell(xsDataCell) xsDataMOSFLMOutputIndexing.addPossibleSolutions(xsDataMOSFLMIndexingSolution) xsTableBeamRefinement = EDUtilsTable.getTableFromTables(xsDataDnaTables, "beam_refinement") xsDataMOSFLMBeamPositionRefined = XSDataMOSFLMBeamPosition() xsDataMOSFLMBeamPositionShift = XSDataMOSFLMBeamPosition() dInitialBeamX = 0.0 dInitialBeamY = 0.0 dRefinedBeamX = 0.0 dRefinedBeamY = 0.0 xsListInitialBeam = EDUtilsTable.getListsFromTable(xsTableBeamRefinement, "initial_beam")[0] fInitialBeamPositionX = float(EDUtilsTable.getItemFromList(xsListInitialBeam, "x").getValueOf_()) fInitialBeamPositionY = float(EDUtilsTable.getItemFromList(xsListInitialBeam, "y").getValueOf_()) xsListRefinedBeam = EDUtilsTable.getListsFromTable(xsTableBeamRefinement, "refined_beam")[0] fRefinedBeamPositionX = float(EDUtilsTable.getItemFromList(xsListRefinedBeam, "x").getValueOf_()) fRefinedBeamPositionY = float(EDUtilsTable.getItemFromList(xsListRefinedBeam, "y").getValueOf_()) xsDataMOSFLMBeamPositionRefined.setX(XSDataLength(fRefinedBeamPositionX)) xsDataMOSFLMBeamPositionRefined.setY(XSDataLength(fRefinedBeamPositionY)) xsDataMOSFLMBeamPositionShift.setX(XSDataLength(fInitialBeamPositionX - fRefinedBeamPositionX)) xsDataMOSFLMBeamPositionShift.setY(XSDataLength(fInitialBeamPositionY - fRefinedBeamPositionY)) xsDataMOSFLMOutputIndexing.setRefinedBeam(xsDataMOSFLMBeamPositionRefined) xsDataMOSFLMOutputIndexing.setBeamShift(xsDataMOSFLMBeamPositionShift) return xsDataMOSFLMOutputIndexing
def createDataMOSFLMOutputIndexing(self): self.DEBUG("EDPluginMOSFLMIndexingv10.createDataMOSFLMOutputIndexing") xsDataMOSFLMOutputIndexing = XSDataMOSFLMOutputIndexing() # Read Newmat file xsDataMOSFLMNewmat = self.getDataMOSFLMNewmat() if (xsDataMOSFLMNewmat is None): strError = "MOSFLM indexing error : No solution was obtained!" self.ERROR(strError) self.setFailure() else: xsDataMOSFLMOutputIndexing.setRefinedNewmat(xsDataMOSFLMNewmat) # Then read the XML file strDnaTablesXML = self.readProcessFile(self.getScriptBaseName() + "_dnaTables.xml") xsDataDnaTables = dna_tables.parseString(strDnaTablesXML) listXSTableMosaicityEstimation = EDUtilsTable.getTableListFromTables( xsDataDnaTables, "mosaicity_estimation") dMosaicityValueSum = 0.0 nValues = 0 for xsTableMosaicityEstimation in listXSTableMosaicityEstimation: for xsListMosaicity in EDUtilsTable.getListsFromTable( xsTableMosaicityEstimation, "mosaicity"): dMosaicityValue = float( EDUtilsTable.getItemFromList(xsListMosaicity, "value").getValueOf_()) dMosaicityValueSum += dMosaicityValue nValues += 1 xsDataFloatMosaicityEstimation = XSDataFloat() xsDataFloatMosaicityEstimation.setValue(dMosaicityValueSum / nValues) xsDataMOSFLMOutputIndexing.setMosaicityEstimation( xsDataFloatMosaicityEstimation) xsTableRefinement = EDUtilsTable.getTableFromTables( xsDataDnaTables, "refinement") if (xsTableRefinement is None): strError = "MOSFLM indexing error : No solution was refined!" self.ERROR(strError) self.setFailure() else: xsListDeviations = EDUtilsTable.getListsFromTable( xsTableRefinement, "deviations")[0] dDeviationAngular = float( EDUtilsTable.getItemFromList(xsListDeviations, "angular").getValueOf_()) dDeviationPositional = float( EDUtilsTable.getItemFromList(xsListDeviations, "positional").getValueOf_()) xsDataMOSFLMOutputIndexing.setDeviationAngular( XSDataAngle(dDeviationAngular)) xsDataMOSFLMOutputIndexing.setDeviationPositional( XSDataLength(dDeviationPositional)) xsListResults = EDUtilsTable.getListsFromTable( xsTableRefinement, "results")[0] dDetectorDistance = float( EDUtilsTable.getItemFromList( xsListResults, "detector_distance").getValueOf_()) xsDataMOSFLMOutputIndexing.setRefinedDistance( XSDataLength(dDetectorDistance)) xsListParameters = EDUtilsTable.getListsFromTable( xsTableRefinement, "parameters")[0] iSpotsUsed = int( EDUtilsTable.getItemFromList(xsListParameters, "used").getValueOf_()) iSpotsTotal = int( EDUtilsTable.getItemFromList(xsListParameters, "out_of").getValueOf_()) xsDataMOSFLMOutputIndexing.setSpotsUsed( XSDataInteger(iSpotsUsed)) xsDataMOSFLMOutputIndexing.setSpotsTotal( XSDataInteger(iSpotsTotal)) xsTableSolutionRefinement = EDUtilsTable.getTableFromTables( xsDataDnaTables, "solution_refinement") xsListParameters = EDUtilsTable.getListsFromTable( xsTableSolutionRefinement, "selection")[0] iSelectedSolutionNumber = int( EDUtilsTable.getItemFromList(xsListParameters, "number").getValueOf_()) xsDataMOSFLMOutputIndexing.setSelectedSolutionNumber( XSDataInteger(iSelectedSolutionNumber)) strSelectedSolutionSpaceGroup = (EDUtilsTable.getItemFromList( xsListParameters, "spacegroup").getValueOf_()) xsDataMOSFLMOutputIndexing.setSelectedSolutionSpaceGroup( XSDataString(strSelectedSolutionSpaceGroup)) iSelectedSolutionSpaceGroupNumber = int( EDUtilsTable.getItemFromList( xsListParameters, "spacegroup_number").getValueOf_()) xsDataMOSFLMOutputIndexing.setSelectedSolutionSpaceGroupNumber( XSDataInteger(iSelectedSolutionSpaceGroupNumber)) xsTableAutoIndexSolutions = EDUtilsTable.getTableFromTables( xsDataDnaTables, "autoindex_solutions") xsListsSolution = xsTableAutoIndexSolutions.getList() for xsListSolution in xsListsSolution: xsDataMOSFLMIndexingSolution = XSDataMOSFLMIndexingSolution( ) xsDataCell = XSDataCell() iSolutionNumber = int( EDUtilsTable.getItemFromList(xsListSolution, "index").getValueOf_()) xsDataMOSFLMIndexingSolution.setIndex( XSDataInteger(iSolutionNumber)) iPenalty = int( EDUtilsTable.getItemFromList(xsListSolution, "penalty").getValueOf_()) xsDataMOSFLMIndexingSolution.setPenalty( XSDataInteger(iPenalty)) strLattice = (EDUtilsTable.getItemFromList( xsListSolution, "lattice").getValueOf_()) xsDataMOSFLMIndexingSolution.setLattice( XSDataString(strLattice)) dA = float( EDUtilsTable.getItemFromList(xsListSolution, "a").getValueOf_()) xsDataCell.setLength_a(XSDataLength(dA)) dB = float( EDUtilsTable.getItemFromList(xsListSolution, "b").getValueOf_()) xsDataCell.setLength_b(XSDataLength(dB)) dC = float( EDUtilsTable.getItemFromList(xsListSolution, "c").getValueOf_()) xsDataCell.setLength_c(XSDataLength(dC)) dAlpha = float( EDUtilsTable.getItemFromList(xsListSolution, "alpha").getValueOf_()) xsDataCell.setAngle_alpha(XSDataAngle(dAlpha)) dBeta = float( EDUtilsTable.getItemFromList(xsListSolution, "beta").getValueOf_()) xsDataCell.setAngle_beta(XSDataAngle(dBeta)) dGamma = float( EDUtilsTable.getItemFromList(xsListSolution, "gamma").getValueOf_()) xsDataCell.setAngle_gamma(XSDataAngle(dGamma)) xsDataMOSFLMIndexingSolution.setCell(xsDataCell) xsDataMOSFLMOutputIndexing.addPossibleSolutions( xsDataMOSFLMIndexingSolution) xsTableBeamRefinement = EDUtilsTable.getTableFromTables( xsDataDnaTables, "beam_refinement") xsDataMOSFLMBeamPositionRefined = XSDataMOSFLMBeamPosition() xsDataMOSFLMBeamPositionShift = XSDataMOSFLMBeamPosition() dInitialBeamX = 0.0 dInitialBeamY = 0.0 dRefinedBeamX = 0.0 dRefinedBeamY = 0.0 xsListInitialBeam = EDUtilsTable.getListsFromTable( xsTableBeamRefinement, "initial_beam")[0] fInitialBeamPositionX = float( EDUtilsTable.getItemFromList(xsListInitialBeam, "x").getValueOf_()) fInitialBeamPositionY = float( EDUtilsTable.getItemFromList(xsListInitialBeam, "y").getValueOf_()) xsListRefinedBeam = EDUtilsTable.getListsFromTable( xsTableBeamRefinement, "refined_beam")[0] fRefinedBeamPositionX = float( EDUtilsTable.getItemFromList(xsListRefinedBeam, "x").getValueOf_()) fRefinedBeamPositionY = float( EDUtilsTable.getItemFromList(xsListRefinedBeam, "y").getValueOf_()) xsDataMOSFLMBeamPositionRefined.setX( XSDataLength(fRefinedBeamPositionX)) xsDataMOSFLMBeamPositionRefined.setY( XSDataLength(fRefinedBeamPositionY)) xsDataMOSFLMBeamPositionShift.setX( XSDataLength(fInitialBeamPositionX - fRefinedBeamPositionX)) xsDataMOSFLMBeamPositionShift.setY( XSDataLength(fInitialBeamPositionY - fRefinedBeamPositionY)) xsDataMOSFLMOutputIndexing.setRefinedBeam( xsDataMOSFLMBeamPositionRefined) xsDataMOSFLMOutputIndexing.setBeamShift( xsDataMOSFLMBeamPositionShift) # Path to log file xsDataMOSFLMOutputIndexing.setPathToLogFile( XSDataFile( XSDataString( os.path.join(self.getWorkingDirectory(), self.getScriptLogFileName())))) return xsDataMOSFLMOutputIndexing