Changeset 2309 for palm/trunk/SCRIPTS/palm_gf_files/palm_gf_tools.py
- Timestamp:
- Jul 10, 2017 3:55:55 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SCRIPTS/palm_gf_files/palm_gf_tools.py
r2308 r2309 60 60 self.np_table.clicked.connect(lambda: self.sort_table(str("np"))) 61 61 self.ngpts_table.clicked.connect(lambda: self.sort_table(str("ngpts"))) 62 self.nxpex_table.clicked.connect(lambda: self.sort_table(str("nxnpex"))) 63 self.nypey_table.clicked.connect(lambda: self.sort_table(str("nynpey"))) 62 64 63 65 self.instant() … … 83 85 dtb = str('.palm_gf_data.db') 84 86 #con = sqlite3.connect("/localdata/.palm_gf_data.db") 85 con = sqlite3.connect(pathx + '.palm_gf_data.db') 87 88 pathx = pathx + '/.palm_gf_data.db' 89 con = sqlite3.connect(pathx) 86 90 c = con.cursor() 87 91 c.execute("SELECT * FROM " + 'grid_limits') … … 90 94 self.nx_min.setValue(mini[0]) 91 95 self.nx_max.setValue(max[0]) 96 92 97 self.ny_min.setValue(mini[1]) 93 98 self.ny_max.setValue(max[1]) … … 104 109 self.ngpts_min.setValue(mini[7]) 105 110 self.ngpts_max.setValue(max[7]) 111 self.nxpex_min.setValue(mini[8]) 112 self.nxpex_max.setValue(max[8]) 113 self.nypey_min.setValue(mini[9]) 114 self.nypey_max.setValue(max[9]) 106 115 107 116 self.nx_min.setMinimum(mini[0]) … … 119 128 self.np_min.setMinimum(mini[6]) 120 129 self.np_max.setMaximum(max[6]) 130 121 131 self.ngpts_min.setMinimum(mini[7]) 122 132 self.ngpts_max.setMaximum(max[7]) … … 124 134 self.ngpts_max.setMinimum(mini[7]) 125 135 136 self.nxpex_min.setMinimum(mini[8]) 137 self.nxpex_max.setMaximum(max[8]) 138 self.nxpex_min.setMaximum(max[8]) 139 self.nxpex_max.setMinimum(mini[8]) 140 141 self.nypey_min.setMinimum(mini[9]) 142 self.nypey_max.setMaximum(max[9]) 143 self.nypey_min.setMaximum(max[9]) 144 self.nypey_max.setMinimum(mini[9]) 145 146 147 126 148 127 149 … … 134 156 135 157 def check(self): 158 pathx = configwr.read_config() 159 pathx = pathx[19] 160 136 161 dtb = str('.palm_gf_data.db') 137 con = sqlite3.connect("/localdata/.palm_gf_data.db") 162 #con = sqlite3.connect("/localdata/.palm_gf_data.db") 163 con = sqlite3.connect(pathx + '/.palm_gf_data.db') 138 164 c = con.cursor() 139 165 c.execute("SELECT * FROM " + 'grid_limits') … … 154 180 #print("LOADED!!!") 155 181 import decimal 182 183 pathx = configwr.read_config() 184 pathx = pathx[19] 185 156 186 self.setEnabled(False) 157 187 QtGui.QApplication.processEvents() … … 159 189 self.process1() 160 190 database = str('.palm_gf_data.db') 161 conn = sqlite3.connect( "/localdata/.palm_gf_data.db")191 conn = sqlite3.connect(pathx + '/.palm_gf_data.db') 162 192 c = conn.cursor() 163 193 c.execute("SELECT * FROM " + 'grid_current') … … 172 202 while i < len(results): 173 203 line = results[i] 174 while j < 8:204 while j < 10: 175 205 var = line[j] 176 206 … … 202 232 def filter_results(self): 203 233 234 pathx = configwr.read_config() 235 pathx = pathx[19] 236 204 237 self.setEnabled(False) 205 238 self.calc_label.setText('calculating...') 206 239 QtGui.QApplication.processEvents() 207 240 database = str('.palm_gf_data.db') 208 conn = sqlite3.connect( "/localdata/.palm_gf_data.db")241 conn = sqlite3.connect(pathx + '/.palm_gf_data.db') 209 242 c = conn.cursor() 210 243 c.execute("SELECT * FROM " + "grid_current") … … 252 285 if line[7] >= self.ngpts_min.value(): 253 286 254 row_cnt += 1 255 while j < 8: 256 var = line[j] 257 258 if j == 7: 259 self.tableWidget.setItem(row_cnt, j, self.MyTableWidgetItem(str("%.1e" % var), i)) 260 261 else: 262 self.tableWidget.setItem(row_cnt, j, self.MyTableWidgetItem(str(var), i)) 263 264 j += 1 287 if line[8] <= self.nxpex_max.value(): 288 289 if line[8] >= self.nxpex_min.value(): 290 291 if line[9] <= self.nypey_max.value(): 292 293 if line[9] >= self.nypey_min.value(): 294 295 row_cnt += 1 296 while j < 10: 297 var = line[j] 298 299 if j == 7: 300 self.tableWidget.setItem(row_cnt, j, self.MyTableWidgetItem(str("%.1e" % var), i)) 301 302 else: 303 self.tableWidget.setItem(row_cnt, j, self.MyTableWidgetItem(str(var), i)) 304 305 j += 1 265 306 266 307 j = 0 … … 295 336 fngpts_mn = self.ngpts_min.value() 296 337 fngpts_mx = self.ngpts_max.value() 338 nxpex_mn = self.nxpex_min.value() 339 nxpex_mx = self.nxpex_max.value() 340 nypey_mn = self.nypey_min.value() 341 nypey_mx = self.nypey_max.value() 342 297 343 298 344 if column == str("nx"): … … 313 359 self.np_table.setChecked(False) 314 360 self.ngpts_table.setChecked(False) 361 self.nxpex_table.setChecked(False) 362 self.nypey_table.setChecked(False) 315 363 316 364 if column == str("ny"): … … 331 379 self.np_table.setChecked(False) 332 380 self.ngpts_table.setChecked(False) 381 self.nxpex_table.setChecked(False) 382 self.nypey_table.setChecked(False) 333 383 334 384 if column == str("nz"): … … 349 399 self.np_table.setChecked(False) 350 400 self.ngpts_table.setChecked(False) 401 self.nxpex_table.setChecked(False) 402 self.nypey_table.setChecked(False) 351 403 352 404 if column == str("npex"): … … 367 419 self.np_table.setChecked(False) 368 420 self.ngpts_table.setChecked(False) 421 self.nxpex_table.setChecked(False) 422 self.nypey_table.setChecked(False) 369 423 370 424 if column == str("npey"): … … 386 440 self.np_table.setChecked(False) 387 441 self.ngpts_table.setChecked(False) 442 self.nxpex_table.setChecked(False) 443 self.nypey_table.setChecked(False) 388 444 389 445 if column == str("npexnpey"): … … 404 460 self.np_table.setChecked(False) 405 461 self.ngpts_table.setChecked(False) 462 self.nxpex_table.setChecked(False) 463 self.nypey_table.setChecked(False) 406 464 407 465 if column == str("np"): … … 422 480 self.nx_table.setChecked(False) 423 481 self.ngpts_table.setChecked(False) 482 self.nxpex_table.setChecked(False) 483 self.nypey_table.setChecked(False) 424 484 425 485 if column == str("ngpts"): … … 440 500 self.np_table.setChecked(False) 441 501 self.nx_table.setChecked(False) 442 443 444 445 conn = sqlite3.connect("/localdata/.palm_gf_data.db") 502 self.nxpex_table.setChecked(False) 503 self.nypey_table.setChecked(False) 504 505 if column == str("nxnpex"): 506 sorted_col = "nxnpex" 507 508 if self.nxpex_table.isChecked() is True: 509 order = " DESC" 510 511 else: 512 513 order = " ASC" 514 515 self.ny_table.setChecked(False) 516 self.nz_table.setChecked(False) 517 self.npex_table.setChecked(False) 518 self.npey_table.setChecked(False) 519 self.npexnpey_table.setChecked(False) 520 self.np_table.setChecked(False) 521 self.nx_table.setChecked(False) 522 self.ngpts_table.setChecked(False) 523 self.nypey_table.setChecked(False) 524 525 if column == str("nynpey"): 526 sorted_col = "nynpey" 527 528 if self.nypey_table.isChecked() is True: 529 order = " DESC" 530 531 else: 532 533 order = " ASC" 534 535 self.ny_table.setChecked(False) 536 self.nz_table.setChecked(False) 537 self.npex_table.setChecked(False) 538 self.npey_table.setChecked(False) 539 self.npexnpey_table.setChecked(False) 540 self.np_table.setChecked(False) 541 self.nx_table.setChecked(False) 542 self.ngpts_table.setChecked(False) 543 self.nxpex_table.setChecked(False) 544 545 else: 546 pass 547 548 pathx = configwr.read_config() 549 pathx = pathx[19] 550 551 552 conn = sqlite3.connect(pathx + "/.palm_gf_data.db") 446 553 c = conn.cursor() 447 554 c.execute("SELECT * FROM grid_current WHERE nx <= " + str(fnx_mx) + " AND nx >= " + str(fnx_mn) + " AND ny <= " + str(fny_mx) + " AND ny >= " + str(fny_mn) + " AND nz <= " + str(fnz_mx) + … … 449 556 str(fnpex_mn) + " AND npey <= " + str(fnpey_mx) + " AND npey >= " + str(fnpey_mn) + " AND " 450 557 "npxnpy <= " + str(fnpxnpy_mx) + " AND npxnpy >= " + str(fnpxnpy_mn) + " AND np <= " + str(fnp_mx) + " AND np >= " + str(fnp_mn) + " AND ngpts <= " + str(fngpts_mx) + " AND ngpts >= " + str(fngpts_mn) + 558 " AND nxnpex <= " + str(nxpex_mx) + " AND nxnpex >= " + str(nxpex_mn) + " AND nynpey <= " + str(nypey_mx) + " AND nynpey >= " + str(nypey_mn) + 451 559 " ORDER BY " + str(sorted_col) + str(order)) 452 560 … … 454 562 455 563 sorted = c.fetchall() 564 456 565 457 566 c.close() … … 461 570 for row_indx in range(0,len(sorted)): 462 571 463 for col_indx in range(0, 8):572 for col_indx in range(0,10): 464 573 row = sorted[row_indx] 465 574 value = row[col_indx]
Note: See TracChangeset
for help on using the changeset viewer.