Commit 961b3253 authored by Hackmet's avatar Hackmet

Bugfix in SQLExport

parent 1258436c
...@@ -176,7 +176,7 @@ class SQLExport(QtWidgets.QDialog): ...@@ -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): ...@@ -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]) if lower <= size <= upper:
except: return i[1]
print('error processing limits {} from {} with size {}'.format(limits, i, size))
raise
if lower <= np.round(size) <= upper:
return i
def getDateString(self, QDateObject): def getDateString(self, QDateObject):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment