Commit 961b3253 authored by Hackmet's avatar Hackmet
Browse files

Bugfix in SQLExport

parent 1258436c
Loading
Loading
Loading
Loading
+9 −19
Original line number Original line Diff line number Diff line
@@ -176,7 +176,7 @@ class SQLExport(QtWidgets.QDialog):
            currentParticleInd = self.getPartIndicesOfSample(self.sampleSelector.currentText())
            currentParticleInd = self.getPartIndicesOfSample(self.sampleSelector.currentText())
            
            
            currentAnalysisInd  = self.getAnalyisIndicesOfMethod(self.methodIndices[self.methodSelector.currentIndex()])
            currentAnalysisInd  = self.getAnalyisIndicesOfMethod(self.methodIndices[self.methodSelector.currentIndex()])
            sizeCategories = self.getColFromTable('Size_category', 'size_fraction')
            sizeCategories = self.getEntireTable('size_fraction')[1]
            
            
            for index, polymerType in enumerate(self.polymerTypes):
            for index, polymerType in enumerate(self.polymerTypes):
                if self.polymerCheckboxes[index].isChecked():
                if self.polymerCheckboxes[index].isChecked():
@@ -287,26 +287,16 @@ class SQLExport(QtWidgets.QDialog):
            
            
            
            
    def getSizeFraction(self, sizeList, size):
    def getSizeFraction(self, sizeList, size):
        def isNumber(string):
        size = np.round(size)
            try: 
                float(string)
                return True
            except:
                return False
            
        for i in sizeList:
        for i in sizeList:
            if i.find('>') != -1:    #i.e., string is >10000
            if i[1].find('>') != -1:    #i.e., string is '>100000'
                return i
                return i[1]
            else:
            else:
                limits= [float(s) for s in i.split() if isNumber(s)]
                limits = [i[2], i[3]]
                try:
                upper = float(limits[1])
                upper = float(limits[1])
                lower = float(limits[0])
                lower = float(limits[0])
                except:
                if lower <= size <= upper:
                    print('error processing limits {} from {} with size {}'.format(limits, i, size))
                    return i[1]
                    raise
                if lower <= np.round(size) <= upper:
                    return i
            
            


    def getDateString(self, QDateObject):
    def getDateString(self, QDateObject):