Changeset 2309
- Timestamp:
- Jul 10, 2017 3:55:55 PM (7 years ago)
- Location:
- palm/trunk/SCRIPTS
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SCRIPTS/palm_gf
r2308 r2309 422 422 c.execute("DROP TABLE IF EXISTS grid_limits") 423 423 c.execute( 424 "CREATE TABLE IF NOT EXISTS grid_current(nx INT, ny INT, nz INT, npex INT, npey INT, npxnpy FLOAT, np INT, ngpts INT )")424 "CREATE TABLE IF NOT EXISTS grid_current(nx INT, ny INT, nz INT, npex INT, npey INT, npxnpy FLOAT, np INT, ngpts INT, nxnpex FLOAT, nynpey FLOAT)") 425 425 c.execute( 426 "CREATE TABLE IF NOT EXISTS grid_limits(nx INT, ny INT, nz INT, npex INT, npey INT, npxnpy FLOAT, np INT, ngpts INT )")426 "CREATE TABLE IF NOT EXISTS grid_limits(nx INT, ny INT, nz INT, npex INT, npey INT, npxnpy FLOAT, np INT, ngpts INT, nxnpex FLOAT, nynpey FLOAT)") 427 427 conn.commit() 428 428 main_bool = True … … 591 591 592 592 npxnpy = format(float(npex) / float(npey), '.2f') 593 nxpex = float(nx+1) /float(npex) 594 nypey = float(ny+1) /float(npey) 595 593 596 c.execute( 594 """INSERT OR REPLACE INTO grid_current(nx, ny, nz, npex, npey, npxnpy, np, ngpts ) VALUES (?, ?, ?, ?, ?, ?, ?, ?)""",595 (nx, ny, nz, npex, npey, npxnpy, (npex * npey), (nx * ny * nz) ))597 """INSERT OR REPLACE INTO grid_current(nx, ny, nz, npex, npey, npxnpy, np, ngpts, nxnpex, nynpey) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""", 598 (nx, ny, nz, npex, npey, npxnpy, (npex * npey), (nx * ny * nz), nxpex, nypey)) 596 599 597 600 nz += 1 … … 669 672 mn_ngpts = c.fetchone()[0] 670 673 # print(mn_ngpts) 674 c.execute("SELECT nxnpex FROM grid_current ORDER BY nxnpex DESC LIMIT 1") 675 mx_nxpex = c.fetchone()[0] 676 c.execute("SELECT nxnpex FROM grid_current ORDER BY nxnpex LIMIT 1") 677 mn_nxpex = c.fetchone()[0] 678 c.execute("SELECT nynpey FROM grid_current ORDER BY nynpey DESC LIMIT 1") 679 mx_nypey = c.fetchone()[0] 680 c.execute("SELECT nynpey FROM grid_current ORDER BY nynpey LIMIT 1") 681 mn_nypey = c.fetchone()[0] 682 683 671 684 672 685 conn.commit() 673 686 c.execute( 674 """INSERT OR REPLACE INTO grid_limits(nx, ny, nz, npex, npey, npxnpy, np, ngpts ) VALUES (?, ?, ?, ?, ?, ?, ?, ?)""",675 (mn_nx, mn_ny, mn_nz, mn_npex, mn_npey, mn_npxnpy, mn_np, mn_ngpts ))687 """INSERT OR REPLACE INTO grid_limits(nx, ny, nz, npex, npey, npxnpy, np, ngpts, nxnpex, nynpey) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""", 688 (mn_nx, mn_ny, mn_nz, mn_npex, mn_npey, mn_npxnpy, mn_np, mn_ngpts, mn_nxpex, mn_nypey)) 676 689 677 690 c.execute( 678 """INSERT OR REPLACE INTO grid_limits(nx, ny, nz, npex, npey, npxnpy, np, ngpts ) VALUES (?, ?, ?, ?, ?, ?, ?, ?)""",679 (mx_nx, mx_ny, mx_nz, mx_npex, mx_npey, mx_npxnpy, mx_np, mx_ngpts ))691 """INSERT OR REPLACE INTO grid_limits(nx, ny, nz, npex, npey, npxnpy, np, ngpts, nxnpex, nynpey) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""", 692 (mx_nx, mx_ny, mx_nz, mx_npex, mx_npey, mx_npxnpy, mx_np, mx_ngpts, mx_nxpex, mx_nypey)) 680 693 conn.commit() 681 694 -
palm/trunk/SCRIPTS/palm_gf_files/palm_gf_table.ui
r2308 r2309 7 7 <x>0</x> 8 8 <y>0</y> 9 <width> 817</width>9 <width>1030</width> 10 10 <height>439</height> 11 11 </rect> … … 19 19 <x>5</x> 20 20 <y>166</y> 21 <width> 805</width>21 <width>1005</width> 22 22 <height>266</height> 23 23 </rect> … … 55 55 <property name="rowCount"> 56 56 <number>8</number> 57 </property> 58 <property name="columnCount"> 59 <number>10</number> 57 60 </property> 58 61 <attribute name="horizontalHeaderVisible"> … … 72 75 <row> 73 76 <property name="text"> 74 <string> 2</string>77 <string>8</string> 75 78 </property> 76 79 </row> … … 141 144 </property> 142 145 </column> 146 <column/> 147 <column/> 143 148 </widget> 144 149 <widget class="Line" name="line"> 145 150 <property name="geometry"> 146 151 <rect> 147 <x> 655</x>152 <x>831</x> 148 153 <y>60</y> 149 154 <width>30</width> … … 158 163 <property name="geometry"> 159 164 <rect> 160 <x> 675</x>165 <x>851</x> 161 166 <y>112</y> 162 167 <width>131</width> … … 750 755 <property name="geometry"> 751 756 <rect> 752 <x> 675</x>757 <x>851</x> 753 758 <y>70</y> 754 759 <width>52</width> … … 763 768 <property name="geometry"> 764 769 <rect> 765 <x> 675</x>770 <x>851</x> 766 771 <y>90</y> 767 772 <width>131</width> … … 1229 1234 </layout> 1230 1235 </widget> 1236 <widget class="QPushButton" name="nxpex_table"> 1237 <property name="geometry"> 1238 <rect> 1239 <x>806</x> 1240 <y>149</y> 1241 <width>104</width> 1242 <height>23</height> 1243 </rect> 1244 </property> 1245 <property name="text"> 1246 <string>nx+1 / npex</string> 1247 </property> 1248 <property name="checkable"> 1249 <bool>true</bool> 1250 </property> 1251 </widget> 1252 <widget class="QPushButton" name="nypey_table"> 1253 <property name="geometry"> 1254 <rect> 1255 <x>907</x> 1256 <y>149</y> 1257 <width>104</width> 1258 <height>23</height> 1259 </rect> 1260 </property> 1261 <property name="text"> 1262 <string>ny+1 / npey</string> 1263 </property> 1264 <property name="checkable"> 1265 <bool>true</bool> 1266 </property> 1267 </widget> 1268 <widget class="QLabel" name="label_13"> 1269 <property name="geometry"> 1270 <rect> 1271 <x>677</x> 1272 <y>67</y> 1273 <width>57</width> 1274 <height>19</height> 1275 </rect> 1276 </property> 1277 <property name="sizePolicy"> 1278 <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> 1279 <horstretch>0</horstretch> 1280 <verstretch>0</verstretch> 1281 </sizepolicy> 1282 </property> 1283 <property name="minimumSize"> 1284 <size> 1285 <width>57</width> 1286 <height>19</height> 1287 </size> 1288 </property> 1289 <property name="maximumSize"> 1290 <size> 1291 <width>57</width> 1292 <height>19</height> 1293 </size> 1294 </property> 1295 <property name="text"> 1296 <string>nx / npex</string> 1297 </property> 1298 </widget> 1299 <widget class="QLabel" name="label_14"> 1300 <property name="geometry"> 1301 <rect> 1302 <x>755</x> 1303 <y>67</y> 1304 <width>57</width> 1305 <height>19</height> 1306 </rect> 1307 </property> 1308 <property name="sizePolicy"> 1309 <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> 1310 <horstretch>0</horstretch> 1311 <verstretch>0</verstretch> 1312 </sizepolicy> 1313 </property> 1314 <property name="minimumSize"> 1315 <size> 1316 <width>57</width> 1317 <height>19</height> 1318 </size> 1319 </property> 1320 <property name="maximumSize"> 1321 <size> 1322 <width>57</width> 1323 <height>19</height> 1324 </size> 1325 </property> 1326 <property name="text"> 1327 <string>ny / npey</string> 1328 </property> 1329 </widget> 1330 <widget class="QDoubleSpinBox" name="nxpex_min"> 1331 <property name="geometry"> 1332 <rect> 1333 <x>670</x> 1334 <y>86</y> 1335 <width>71</width> 1336 <height>22</height> 1337 </rect> 1338 </property> 1339 <property name="maximum"> 1340 <double>1000000.000000000000000</double> 1341 </property> 1342 </widget> 1343 <widget class="QDoubleSpinBox" name="nxpex_max"> 1344 <property name="geometry"> 1345 <rect> 1346 <x>670</x> 1347 <y>110</y> 1348 <width>71</width> 1349 <height>22</height> 1350 </rect> 1351 </property> 1352 <property name="maximum"> 1353 <double>1000000.000000000000000</double> 1354 </property> 1355 </widget> 1356 <widget class="QDoubleSpinBox" name="nypey_min"> 1357 <property name="geometry"> 1358 <rect> 1359 <x>747</x> 1360 <y>86</y> 1361 <width>71</width> 1362 <height>22</height> 1363 </rect> 1364 </property> 1365 <property name="maximum"> 1366 <double>1000000.000000000000000</double> 1367 </property> 1368 </widget> 1369 <widget class="QDoubleSpinBox" name="nypey_max"> 1370 <property name="geometry"> 1371 <rect> 1372 <x>747</x> 1373 <y>110</y> 1374 <width>71</width> 1375 <height>22</height> 1376 </rect> 1377 </property> 1378 <property name="maximum"> 1379 <double>1000000.000000000000000</double> 1380 </property> 1381 </widget> 1231 1382 </widget> 1232 1383 <tabstops> -
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.