Changeset 4869 for palm/trunk
- Timestamp:
- Feb 8, 2021 4:14:27 PM (4 years ago)
- Location:
- palm/trunk/SCRIPTS
- Files:
-
- 2 added
- 1 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SCRIPTS/palm_gf
r4843 r4869 1 #!/usr/bin/env python 1 #!/usr/bin/env python3 2 2 # -*- coding: utf-8 -*- 3 3 #--------------------------------------------------------------------------------# … … 20 20 # Current revisions: 21 21 # ----------------- 22 # 23 # 22 # 23 # 24 24 # Former revisions: 25 25 # ----------------- 26 26 # $Id$ 27 # Modified palm_gf using python3 (edited by JR and RM) 28 # 29 # 4843 2021-01-15 15:22:11Z schwenkel 27 30 # Removed PALM_BIN dependency 28 # 31 # 29 32 # 2825 2018-02-20 21:48:27Z maronga 30 33 # Modified header 31 # 34 # 32 35 # 2718 2018-01-02 08:49:38Z maronga 33 36 # Corrected "Former revisions" section 34 # 37 # 35 38 # 2696 2017-12-14 17:12:51Z kanani 36 39 # Change in file header (GPL part) … … 44 47 # 2116 2017-01-16 16:15:24Z maronga 45 48 # Initial revision 46 # 47 # 49 # 50 # 48 51 # 49 52 # Description: 50 53 # ------------ 51 # 54 # 52 55 # 53 56 # Instructions: … … 56 59 #------------------------------------------------------------------------------! 57 60 61 from PyQt5 import QtWidgets, uic 62 from PyQt5.QtWidgets import QDesktopWidget 63 from palm_gf_files.palm_gf_conf import cfg_write, cfg_read 58 64 import sys 59 65 import os 60 import time 61 import palm_gf_files.palm_gf_exec as execute_script 62 import palm_gf_files.palm_gf_conf as config_wr 63 import sqlite3 64 import subprocess as sub 65 66 67 from PyQt4 import QtCore, QtGui, uic, Qt 68 from PyQt4.QtCore import QCoreApplication 69 from palm_gf_files.palm_gf_tools import MyApp3 70 71 # Determine PALM directories 72 # Determine PALM directories 73 try: 74 devnull = open(os.devnull, 'w') 66 from palm_gf_files.palm_gf_exec import MyThread 67 from palm_gf_files.palm_gf_tools import MyTable 68 69 try: 70 devnull = open(os.devnull, 'w') 75 71 palm_dir = os.getcwd() 76 72 palm_bin = palm_dir + '/trunk/SCRIPTS' … … 80 76 # file found 81 77 out = None 82 except: 78 except: 83 79 print ('Error. palm_gf probably called in wrong directory.') 84 80 raise SystemExit 85 81 86 qtCreatorFile = palm_bin + '/palm_gf_files/palm_gf.ui' 87 88 Ui_MainWindow, QtBaseClass = uic.loadUiType(qtCreatorFile) 89 90 91 class MyApp1(QtGui.QMainWindow, Ui_MainWindow): 82 class AppMain(QtWidgets.QMainWindow): 92 83 def __init__(self): 93 94 95 96 QtGui.QMainWindow.__init__(self) 97 Ui_MainWindow.__init__(self) 98 #self.setWindowTitle('Gridfinder') 99 100 frameGm = self.frameGeometry() 101 screen = QtGui.QApplication.desktop().screenNumber(QtGui.QApplication.desktop().cursor().pos()) 102 centerPoint = QtGui.QApplication.desktop().screenGeometry(screen).center() 103 frameGm.moveCenter(centerPoint) 104 self.move(frameGm.topLeft()) 105 106 107 #centerPoint = str(centerPoint) 108 #xcenter = centerPoint.split('(')[1].split(',')[0] 109 #ycenter = centerPoint.split('(')[1].split(',')[1].split(')')[0] 110 #print xcenter, ycenter 111 #centerPoint = QtCore.QPoint(int(xcenter) - 418, int(ycenter)) 112 #frameGm.moveCenter(centerPoint) 113 #self.move(frameGm.topLeft()) 114 115 self.setupUi(self) 116 self.startbutton.clicked.connect(self.input_check) # starts grid_calculation 117 self.psolver_box.currentIndexChanged.connect(self.vis) # triggers visibility of fft_method option 118 self.save_button.clicked.connect(self.save_results) # saves .db file under given name 119 self.fft_method_box.setVisible(False) 120 self.fft_method_label.setVisible(False) 121 self.result_headline.setVisible(False) 122 self.result_label.setVisible(False) 123 #self.line_res_up.setVisible(False) 124 self.line_res_down.setVisible(False) 125 self.view_result_button.setVisible(False) 126 #self.tableWidget.setVisible(False) 127 self.load_text_label.setVisible(False) 128 self.nor_spinbox.setVisible(False) 129 self.filename_line.setVisible(False) 130 self.save_button.setVisible(False) 131 self.testbar.setVisible(False) 132 self.d_box.setVisible(False) 133 self.tpn_box.setVisible(False) 134 self.tolerance_bar.setVisible(False) 135 self.tolerance_value.setVisible(False) 136 self.view_result_button.clicked.connect(self.load_gui) 137 self.threadclass = Threadclass() 138 self.actionSetting.triggered.connect(self.settings) 139 self.question_box.clicked.connect(self.settings) 140 self.warning_label.setVisible(False) 141 142 143 144 145 def closeEvent(self, QCloseEvent): 146 147 config_wr.closing_cleanup() 148 QCloseEvent.accept() 149 150 151 def input_check(self): 152 153 if int(self.nx_min_box.value()) <= int(self.nx_max_box.value()) and int(self.ny_min_box.value()) <= int(self.nx_max_box.value()) and int(self.nz_min_box.value()) <= int(self.nz_max_box.value()): 154 self.warning_label.setVisible(False) 155 self.run_program() 156 157 else: 158 159 self.warning_label.setStyleSheet('color: red') 160 self.warning_label.setVisible(True) 161 162 163 164 165 166 167 168 def settings(self): 169 170 self.w = MyPopup() 171 #self.w.setGeometry(Qt.QRect(100, 100, 400, 200)) 172 frameGm = self.frameGeometry() 173 screen = QtGui.QApplication.desktop().screenNumber(QtGui.QApplication.desktop().cursor().pos()) 174 centerPoint = QtGui.QApplication.desktop().screenGeometry(screen).center() 175 frameGm.moveCenter(centerPoint) 176 self.w.move(frameGm.topLeft()) 177 self.w.show() 178 179 180 181 def vis(self): 182 183 if str(self.psolver_box.currentIndex()) == str(1): 184 self.fft_method_box.setVisible(True) 185 self.fft_method_label.setVisible(True) 186 187 if str(self.psolver_box.currentIndex()) != str(1): 188 self.fft_method_box.setVisible(False) 189 self.fft_method_label.setVisible(False) 190 191 def load_gui(self): 192 self.child_win = MyApp3() 193 self.child_win.show() 194 195 def run_transfer(self): 196 self.threadclass = Threadclass() 197 self.connect(self.threadclass, QtCore.SIGNAL('finish'), self.behind_run) 198 #self.connect(self.threadclass, QtCore.SIGNAL('progress'), self.up2date) 199 self.connect(self.threadclass, QtCore.SIGNAL('startqmsg'), self.takeoff) 200 self.connect(self.threadclass, QtCore.SIGNAL('check'), self.checkme) 201 self.threadclass.runx() 202 203 def run_program(self): 204 205 206 self.result_label.setText('Starting calculation...') 207 #self.QtCore.QCoreApplication.processEvents() 208 QtGui.QApplication.processEvents() 209 #self.setEnabled(False) 210 # self.Ui_MainWindow.setDisabled(True) 211 #self.qmsg_wait(0) 212 #print("bool state ", self.npex_npey_box.checkState()) # XXX 213 np_min = str(self.np_min_box.value()) 214 np_max = str(self.np_max_box.value()) 215 nx_min = str(self.nx_min_box.value()) 216 nx_max = str(self.nx_max_box.value()) 217 ny_min = str(self.ny_min_box.value()) 218 ny_max = str(self.ny_max_box.value()) 219 nz_min = str(self.nz_min_box.value()) 220 nz_max = str(self.nz_max_box.value()) 221 tpn = str(self.tpn_box.value()) 222 dnpexnpey = str(self.d_box.value()) 223 dnpexnpey_tolerance = str(self.tolerance_value.value()) 224 dnxny = str(self.dnxny_box.value()) 225 myobject = MyPopup() 226 ld_thrs = myobject.load_thres.value() 227 rslt_thrs = myobject.result_thres.value() 228 229 if str(self.psolver_box.currentIndex()) == str(1): 230 poisfft = True 231 switch = True 232 if str(self.fft_method_box.currentIndex()) == str(2): 233 temperton = True 234 else: 84 super(AppMain, self).__init__() 85 uic.loadUi(palm_bin + '/palm_gf_files/palm_gf.ui', self) 86 self.center_window() 87 88 89 # initial hiding of results ui elements 90 self.result_visibility(False) 91 # dis/enable ui elements when un/checked 92 self.strict_matching_check.stateChanged.connect(self.strict_matching_able) 93 self.npex_npey_ratio_check.stateChanged.connect(self.npex_npey_ratio_able) 94 self.nx_ny_ratio_check.stateChanged.connect(self.nx_ny_ratio_able) 95 self.psolver_combo_box.currentIndexChanged.connect(self.fft_method_able) 96 # loading last used values into ui 97 self.startup_values() 98 # making sure max is not less than min 99 self.nx_min_box.valueChanged.connect(self.input_min_max_check) 100 self.ny_min_box.valueChanged.connect(self.input_min_max_check) 101 self.nz_min_box.valueChanged.connect(self.input_min_max_check) 102 self.proc_min_box.valueChanged.connect(self.input_min_max_check) 103 # connects main buttons to subroutines 104 self.start_button.clicked.connect(self.initialize) 105 self.view_button.clicked.connect(self.load_table) 106 self.reset_button.clicked.connect(self.reset_values) 107 108 def load_table(self): 109 # opens table Ui 110 self.table = MyTable() 111 self.table.show() 112 113 def initialize(self): 114 # translating Ui input into checks used during calculation 115 if self.psolver_combo_box.currentIndex() != 0: 116 if self.psolver_combo_box.currentIndex() == 1: 117 poisfft = True 118 switch = True 119 if self.fft_combo_box.currentIndex() == 2: 120 temperton = True 121 else: 122 temperton = False 123 else: 124 poisfft = False 235 125 temperton = False 236 else: 237 poisfft = False 238 temperton = False 239 switch = False 240 241 if str(self.psolver_box.currentIndex()) == str(2): 242 mlt_grid = True 243 else: 244 mlt_grid = False 245 246 if str(self.Oos_checkbox.checkState()) == str(2): 247 spctre = True 248 poisfft = True 249 else: 250 spctre = False 251 252 if int(self.strict_box.checkState()) != 2: 253 tpn = 0 254 255 if int(self.npex_npey_box.checkState()) != 2: 256 dnpexnpey = 0 257 dnpexnpey_tolerance = 0 258 259 #print(poisfft, switch, temperton, mlt_grid, spctre) 260 config_wr.write_config(np_min, np_max, nx_min, nx_max, ny_min, ny_max, nz_min, nz_max, tpn, dnpexnpey,dnpexnpey_tolerance, dnxny, 261 str(poisfft), str(switch), str(temperton), str(mlt_grid), str(spctre), rslt_thrs, ld_thrs) 262 #time.sleep(1) 263 # execute_script.grid_executer() temp deactive 264 self.testbar.setVisible(True) 265 QtCore.QCoreApplication.processEvents() 266 self.run_transfer() 267 268 269 def behind_run(self): 270 trigger_bool = False 271 #print("behind_run executed") 272 checkfile = open(".palm_gf_tmp", "r") 273 #self.result_label.setText(str(checkfile.readline())) 274 res_text = str(checkfile.readline()) # XXX 275 self.result_label.setText(res_text) 276 result_nr = res_text.split(' ')[2] 277 if int(checkfile.readline()) == 1: 278 self.view_result_button.setVisible(True) 279 trigger_bool = True 280 self.result_label.setVisible(True) 281 self.result_headline.setVisible(True) 282 self.line_res_down.setVisible(True) 283 #self.line_res_up.setVisible(True) 284 self.load_text_label.setVisible(False) 285 self.nor_spinbox.setVisible(False) 286 checkfile.close() 287 #self.setEnabled(True) 288 self.filename_line.setVisible(True) 289 self.save_button.setVisible(True) 290 parameters = config_wr.read_config() 291 292 293 if trigger_bool is True and int(result_nr) < int(parameters[18]): 294 self.result_label.setText(res_text + 'Loading Ui...') 295 self.load_gui() # XXXX 296 self.result_label.setText(res_text) 297 #self.close() 298 #frameGm = self.frameGeometry() 299 #screen = QtGui.QApplication.desktop().screenNumber(QtGui.QApplication.desktop().cursor().pos()) 300 #centerPoint = QtGui.QApplication.desktop().screenGeometry(screen).center() 301 #frameGm = self.frameGeometry() 302 #screen = QtGui.QApplication.desktop().screenNumber(QtGui.QApplication.desktop().cursor().pos()) 303 #centerPoint = str(centerPoint) 304 #xcenter = centerPoint.split('(')[1].split(',')[0] 305 #ycenter = centerPoint.split('(')[1].split(',')[1].split(')')[0] 306 ##print xcenter, ycenter 307 #centerPoint = QtCore.QPoint(int(xcenter) - 292, int(ycenter)) 308 #frameGm.moveCenter(centerPoint) 309 #self.move(frameGm.topLeft()) 310 311 312 313 314 315 316 317 def get_path(wildcard): 318 import wx 319 app = wx.App(None) 320 style = wx.FD_OPEN | wx.FD_FILE_MUST_EXIST 321 dialog = wx.FileDialog(None, 'Open', wildcard='*.db') 322 if dialog.ShowModal() == wx.ID_OK: 323 path = dialog.GetPath() 324 325 print(path, file) 326 else: 327 path = None 328 dialog.Destroy() 329 return 330 331 332 333 def save_results(self): 334 335 #self.get_path() 336 337 338 339 import os 340 import shutil 341 prvs = '.palm_gf_data.db' 342 new = str(self.filename_line.text()) 343 print(new) 344 shutil.copy(prvs, new) 345 print(prvs, new) 346 347 def qmsg(self): 348 msgbox = QtGui.QMessageBox() 349 msgbox.setWindowTitle("Information") 350 # msgbox.setVisible(False) 351 msgbox.Information 352 msgbox.setText("Calculating, please be patient.") 353 # msgbox. 354 msgbox.setModal(True) 355 msgbox.exec_() 356 357 def tester(self): 358 #print("tester was executed from run method") 359 pass 360 361 def qmsg_wait(self, progress): 362 global msgbox 363 msgbox = QtGui.QMessageBox() 364 layout = msgbox.layout() 365 layout.itemAtPosition(layout.rowCount() - 1, 0).widget().hide() 366 global progressx 367 progressx = QtGui.QProgressBar() 368 layout.addWidget(progressx, layout.rowCount(), 0, 1, layout.columnCount()) 369 370 msgbox.setWindowTitle("Progress") 371 msgbox.Information 372 msgbox.setText("Calculating, please be patient.") 373 374 progressx.setValue(int(progress)) 375 #msgbox.setModal(False) 376 msgbox.exec_() 377 378 def up2date(self, progress): 379 380 progressx.setValue(int(progress)) 381 if progress == 100: 382 msgbox.done(1) 383 384 def takeoff(self): 385 #self.qmsg_wait(0) 386 pass 387 388 def checkme(self, check): 389 #print(check) 390 self.testbar.setValue(int(check)) 391 392 if check == 100: 393 self.testbar.setVisible(False) 394 QtGui.QApplication.processEvents() 395 396 397 398 399 400 class Threadclass(QtCore.QThread): 401 def __init__(self, parent = None): 402 super(Threadclass, self).__init__(parent) 403 404 def runx(self): 405 #print("runx exec.") 406 self.execute() 407 408 409 410 def execute(self): 411 self.emit(QtCore.SIGNAL('startqmsg'), 0) 412 413 parameters = config_wr.read_config() 414 min_procs = int(parameters[0]) 415 max_procs = int(parameters[1]) 416 tpn = int(parameters[2]) 417 dnpexnpey = float(parameters[3]) 418 dnpexnpey_tol = int(parameters[4]) 419 dnxny = float(parameters[5]) 420 nx_min = int(parameters[6]) 421 nx_max = int(parameters[7]) 422 ny_min = int(parameters[8]) 423 ny_max = int(parameters[9]) 424 nz_min = int(parameters[10]) 425 nz_max = int(parameters[11]) 426 poisfft = parameters[12] 427 switch = parameters[13] 428 tempterton = parameters[14] 429 mlt_grid = parameters[15] 430 spectr = parameters[16] 431 result_thrs = parameters[17] 432 433 434 path = "/localdata/.palm_gf_data.db" 435 pathx = parameters[19] + '/.palm_gf_data.db' 436 437 438 conn = sqlite3.connect(pathx) 439 #conn = sqlite3.connect(".palm_gf_data.db") 440 c = conn.cursor() 441 c.execute("DROP TABLE IF EXISTS grid_current") 442 c.execute("DROP TABLE IF EXISTS grid_limits") 443 c.execute( 444 "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)") 445 c.execute( 446 "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)") 447 conn.commit() 448 main_bool = True 449 450 451 452 453 if poisfft == str(True): 454 poisfft = True 455 else: 456 poisfft = False 457 458 if switch == str(True): 459 switch = True 460 else: 461 switch = False 462 463 if tempterton == str(True): 464 tempterton = True 465 else: 466 tempterton = False 467 468 if mlt_grid == str(True): 469 mlt_grid = True 470 else: 471 mlt_grid = False 472 473 if spectr == str(True): 474 spectr = True 475 else: 476 spectr = False 477 478 #print(spectr, type(spectr)) 479 #print(poisfft, switch, tempterton, mlt_grid, spectr) 480 481 np_used = min_procs 482 counter = 0 483 484 nx = nx_min 485 ny = ny_min 486 nz = nz_min 487 488 from math import floor 489 490 def factors(n): 491 result = [] 492 for i in range(2, n + 1): # test all integers between 2 and n 493 s = 0 494 while n / i == floor(n / float(i)): # is n/i an integer? 495 n = n / float(i) 496 s += 1 497 if s > 0: 498 for k in range(s): 499 result.append(i) # i is a pf s times 500 if n == 1: 501 return result 502 503 while np_used <= max_procs: 504 a = 1 505 506 while a <= np_used: 507 prcs_var = np_used % a 508 if prcs_var != 0: 509 a += 1 510 elif prcs_var == 0: 511 npex = a 512 npey = int(np_used / npex) 513 514 if tpn != 0: # XXX 515 516 if np_used % tpn != 0: 517 a += 1 518 continue 519 520 if dnpexnpey != 0 and npex / npey != dnpexnpey: 521 a += 1 522 continue 523 524 if dnpexnpey != 0: 525 526 527 if float(npex) / float(npey) < (dnpexnpey - dnpexnpey*dnpexnpey_tol/100): 528 a += 1 529 continue 530 531 if float(npex) / float(npey) > (dnpexnpey + dnpexnpey*dnpexnpey_tol/100): 532 a += 1 533 continue 534 535 while nx <= nx_max: 536 if (nx + 1) % npex != 0: 537 nx += 1 538 continue 539 540 if mlt_grid is True and (nx + 1) % 2 != 0: 541 nx += 1 542 continue 543 544 if switch is True and (nx + 1) % npey != 0: 545 nx += 1 546 continue 547 if npex > nx: 548 nx += 1 549 continue 550 551 while ny <= ny_max: 552 553 if dnxny != 0 and float(nx) / float(ny) != float(dnxny): 554 ny += 1 555 continue 556 if (ny + 1) % npey != 0: 557 ny += 1 558 continue 559 560 #if mlt_grid is True and ny % 2 != 0: mlt and mlt_noOpt have same cond. 561 # ny += 1 562 # continue 563 564 if (ny + 1) % npex != 0 and switch is True: 565 ny += 1 566 continue 567 if npey > ny: 568 ny += 1 569 continue 570 571 while nz <= nz_max: 572 573 if mlt_grid is True and nz % 2 != 0: 574 nz += 1 575 continue 576 577 if poisfft is True and nz % npex != 0: 578 nz += 1 579 continue 580 581 if spectr is True and nz % npey != 0: 582 nz += 1 583 continue 584 585 if tempterton is True and nx > 1 and ny > 1: # and nz < 1: 586 587 nx_list = factors(nx + 1) 588 589 i = 0 590 nx_var = nx_list[i] 591 592 593 while i < len(nx_list): 594 if nx_var != 2 or nx_var != 3 or nx_var != 5: 595 i += 1 596 continue 597 598 i += 1 599 ny_list = factors(ny + 1) 600 i = 0 601 ny_var = ny_list[i] 602 while i < len(ny_list): 603 if ny_var != 2 or ny_var != 3 or ny_var != 5: 604 i += 1 605 continue 606 i += 1 607 608 counter += 1 609 if counter > int(result_thrs): 610 break 611 612 npxnpy = format(float(npex) / float(npey), '.2f') 613 nxpex = float(nx+1) /float(npex) 614 nypey = float(ny+1) /float(npey) 615 616 c.execute( 617 """INSERT OR REPLACE INTO grid_current(nx, ny, nz, npex, npey, npxnpy, np, ngpts, nxnpex, nynpey) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""", 618 (nx, ny, nz, npex, npey, npxnpy, (npex * npey), (nx * ny * nz), nxpex, nypey)) 619 620 nz += 1 621 nz = nz_min 622 ny += 1 623 ny = ny_min 624 nx += 1 625 nx = nx_min 626 a += 1 627 # a += 1 628 np_used += 1 629 progr_act = 100*(float(np_used-1)/float(max_procs)) 630 self.emit(QtCore.SIGNAL('check'), progr_act) 631 #print(np_used, max_procs, progr_act) 632 self.emit(QtCore.SIGNAL('progress'), progr_act) 633 634 conn.commit() 635 636 conn.commit() 637 #c.close() 638 #conn.close() 639 # 640 ## ******************************** 641 # 642 #conn = sqlite3.connect(parameters[19] + '/.palm_gf_data.db') 643 #print parameters[19] + '/.palm_gf_data.db' 644 #c = conn.cursor() 645 try: 646 c.execute("SELECT nx FROM grid_current ORDER BY nx DESC LIMIT 1") 647 mx_nx = c.fetchone()[0] 648 # print(mx_nx) 649 c.execute("SELECT nx FROM grid_current ORDER BY nx LIMIT 1") 650 mn_nx = c.fetchone()[0] 651 # print(mn_nx) 652 c.execute("SELECT ny FROM grid_current ORDER BY ny DESC LIMIT 1") 653 mx_ny = c.fetchone()[0] 654 # print(mx_ny) 655 c.execute("SELECT ny FROM grid_current ORDER BY ny LIMIT 1") 656 mn_ny = c.fetchone()[0] 657 # print(mn_ny) 658 c.execute("SELECT nz FROM grid_current ORDER BY nz DESC LIMIT 1") 659 mx_nz = c.fetchone()[0] 660 # print(mx_nz) 661 c.execute("SELECT nz FROM grid_current ORDER BY nz LIMIT 1") 662 mn_nz = c.fetchone()[0] 663 # print(mn_nz) 664 c.execute("SELECT npex FROM grid_current ORDER BY npex DESC LIMIT 1") 665 mx_npex = c.fetchone()[0] 666 # print(mx_npex) 667 c.execute("SELECT npex FROM grid_current ORDER BY npex LIMIT 1") 668 mn_npex = c.fetchone()[0] 669 # print(mn_npex) 670 c.execute("SELECT npey FROM grid_current ORDER BY npey DESC LIMIT 1") 671 mx_npey = c.fetchone()[0] 672 # print(mx_npey) 673 c.execute("SELECT npey FROM grid_current ORDER BY npey LIMIT 1") 674 mn_npey = c.fetchone()[0] 675 # print(mn_npey) 676 c.execute("SELECT npxnpy FROM grid_current ORDER BY npxnpy DESC LIMIT 1") 677 mx_npxnpy = c.fetchone()[0] 678 # print(mx_npxnpy) 679 c.execute("SELECT npxnpy FROM grid_current ORDER BY npxnpy LIMIT 1") 680 mn_npxnpy = c.fetchone()[0] 681 # print(mn_npxnpy) 682 c.execute("SELECT np FROM grid_current ORDER BY np DESC LIMIT 1") 683 mx_np = c.fetchone()[0] 684 # print(mx_np) 685 c.execute("SELECT np FROM grid_current ORDER BY np LIMIT 1") 686 mn_np = c.fetchone()[0] 687 # print(mn_np) 688 c.execute("SELECT ngpts FROM grid_current ORDER BY ngpts DESC LIMIT 1") 689 mx_ngpts = c.fetchone()[0] 690 # print(mx_ngpts) 691 c.execute("SELECT ngpts FROM grid_current ORDER BY ngpts LIMIT 1") 692 mn_ngpts = c.fetchone()[0] 693 # print(mn_ngpts) 694 c.execute("SELECT nxnpex FROM grid_current ORDER BY nxnpex DESC LIMIT 1") 695 mx_nxpex = c.fetchone()[0] 696 c.execute("SELECT nxnpex FROM grid_current ORDER BY nxnpex LIMIT 1") 697 mn_nxpex = c.fetchone()[0] 698 c.execute("SELECT nynpey FROM grid_current ORDER BY nynpey DESC LIMIT 1") 699 mx_nypey = c.fetchone()[0] 700 c.execute("SELECT nynpey FROM grid_current ORDER BY nynpey LIMIT 1") 701 mn_nypey = c.fetchone()[0] 702 703 704 705 conn.commit() 706 c.execute( 707 """INSERT OR REPLACE INTO grid_limits(nx, ny, nz, npex, npey, npxnpy, np, ngpts, nxnpex, nynpey) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""", 708 (mn_nx, mn_ny, mn_nz, mn_npex, mn_npey, mn_npxnpy, mn_np, mn_ngpts, mn_nxpex, mn_nypey)) 709 710 c.execute( 711 """INSERT OR REPLACE INTO grid_limits(nx, ny, nz, npex, npey, npxnpy, np, ngpts, nxnpex, nynpey) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""", 712 (mx_nx, mx_ny, mx_nz, mx_npex, mx_npey, mx_npxnpy, mx_np, mx_ngpts, mx_nxpex, mx_nypey)) 713 conn.commit() 714 715 c.close() 716 conn.close() 717 except TypeError: 718 719 checkfile = open(".palm_gf_tmp", "w") 720 if counter != 0: 721 checkfile.write("Gridfinder found " + str(counter) + " results.\n1") 722 else: 723 checkfile.write("Check input, no Results found.\n0") 724 checkfile.close() 725 726 checkfile = open(".palm_gf_tmp", "w") 727 if counter != 0: 728 checkfile.write("Gridfinder found " + str(counter) + " results.\n1") 729 else: 730 checkfile.write("Check input, no Results found.\n0") 731 checkfile.close() 732 self.emit(QtCore.SIGNAL('finish'), 1) 733 #print("finished with main execute") 734 735 736 737 738 739 qtpopupFile = palm_bin + '/palm_gf_files/palm_gf_settings.ui' 740 Ui_Pop, QtBaseClass = uic.loadUiType(qtpopupFile) 741 742 743 class MyPopup(QtGui.QWidget, Ui_Pop): 744 745 def __init__(self): 746 Qt.QWidget.__init__(self) 747 Ui_Pop.__init__(self) 748 749 self.setupUi(self) 750 self.show 751 self.savepath.clicked.connect(self.path_to_save) 752 self.begin_check() 753 self.buttonBox.accepted.connect(self.end_check) 754 self.buttonBox.rejected.connect(self.close) 755 756 757 def begin_check(self): 758 file_check = palm_dir + '/trunk/SCRIPTS/.palm_gf_config' 759 if os.path.isfile(file_check) is True: 760 parameters = config_wr.read_config_settings() 761 self.linepath.setText(parameters[0]) 762 self.result_thres.setValue(int(parameters[1])) 763 self.load_thres.setValue(int(parameters[2])) 764 765 def end_check(self): 766 config_wr.write_config_settings(self.linepath.text(), self.result_thres.value(), self.load_thres.value()) 767 768 self.close() 769 770 771 772 773 774 def path_to_save(self, wildcard= None): 775 import wx 776 app = wx.App(None) 777 style = wx.FD_OPEN | wx.FD_FILE_MUST_EXIST 778 dialog = wx.DirDialog(None, 'Open') 779 if dialog.ShowModal() == wx.ID_OK: 780 path = str(dialog.GetPath()) 781 782 print(path) 783 self.linepath.setText(path) 784 785 786 787 else: 788 path = None 789 dialog.Destroy() 790 return 791 792 793 794 795 796 126 switch = False 127 128 if self.psolver_combo_box.currentIndex() == 2: 129 multigrid = True 130 else: 131 multigrid = False 132 133 if self.spectra_box.checkState() == 2: 134 spectra = True 135 poisfft = True 136 else: 137 spectra = False 138 139 if self.nx_ny_ratio_check.checkState() == 2: 140 dnxny = self.nx_ny_ratio_box.value() 141 else: 142 dnxny = 0 143 144 if self.npex_npey_ratio_check.checkState() == 2: 145 dpxpy = self.npex_npey_ratio_box.value() 146 dpxpy_dev = self.npex_npey_deviation_box.value() 147 else: 148 dpxpy = 0 149 dpxpy_dev = 0 150 151 if self.strict_matching_check.checkState() == 2: 152 tpn = self.strict_matching_box.value() 153 else: 154 tpn = 0 155 156 # writing the config 157 cfg_write(self.nx_min_box.value(), self.nx_max_box.value(), self.ny_min_box.value(), 158 self.ny_max_box.value(), self.nz_min_box.value(), self.nz_max_box.value(), 159 self.proc_min_box.value(), self.proc_max_box.value(), tpn, 160 poisfft, switch, temperton, multigrid, spectra, dnxny, dpxpy, dpxpy_dev) 161 162 self.progressbar.setVisible(True) 163 self.progressbar.setValue(0) 164 # connects PyQtsignals to subroutines 165 self.thread = MyThread() 166 self.thread.change_value.connect(self.setprogressval) 167 self.thread.completed.connect(self.result_label_update) 168 self.thread.busy.connect(self.info_label_update) 169 # starts thread to calculate 170 self.thread.start() 171 172 def info_label_update(self): 173 # standby information during search of the limits of all results 174 self.results_information_label.setText('Standby please.') 175 self.results_information_label.setVisible(True) 176 177 def result_label_update(self, counter, timer): 178 self.result_visibility(True) 179 self.progressbar.setVisible(False) 180 if int(timer) == 0: 181 self.results_information_label.setText('Success! Gridfinder found ' + str(counter) + 182 ' results in less than 1 second.') 183 else: 184 self.results_information_label.setText('Success! Gridfinder found ' + str(counter) + 185 ' results in ' + str(timer) + ' seconds.') 186 187 def setprogressval(self, val): 188 # updates the value of the progressbar, data received from PyQtsignal 189 self.progressbar.setValue(val) 190 191 def startup_values(self): 192 # reads the .ini and updates default values to last used values 193 if os.path.exists('./palm_gf_config.ini') is False: 194 pass 195 else: 196 value_list = cfg_read() 197 self.nx_min_box.setValue(int(value_list[0])) 198 self.nx_max_box.setValue(int(value_list[1])) 199 self.ny_min_box.setValue(int(value_list[2])) 200 self.ny_max_box.setValue(int(value_list[3])) 201 self.nz_min_box.setValue(int(value_list[4])) 202 self.nz_max_box.setValue(int(value_list[5])) 203 self.proc_min_box.setValue(int(value_list[6])) 204 self.proc_max_box.setValue(int(value_list[7])) 205 if int(value_list[8]) != 0: 206 self.strict_matching_check.setCheckState(2) 207 self.strict_matching_box.setValue(int(value_list[8])) 208 if float(value_list[9]) != 0: 209 self.nx_ny_ratio_check.setCheckState(2) 210 self.nx_ny_ratio_box.setValue(float(value_list[9])) 211 if float(value_list[10]) != 0: 212 self.npex_npey_ratio_check.setCheckState(2) 213 self.npex_npey_ratio_box.setValue(float(value_list[10])) 214 self.npex_npey_deviation_box.setValue(float(value_list[11])) 215 216 def reset_values(self): 217 # resets values to default, does not update .ini 218 self.nx_min_box.setValue(0) 219 self.nx_max_box.setValue(1) 220 self.ny_min_box.setValue(0) 221 self.ny_max_box.setValue(1) 222 self.nz_min_box.setValue(0) 223 self.nz_max_box.setValue(1) 224 self.proc_min_box.setValue(0) 225 self.proc_max_box.setValue(1) 226 self.strict_matching_check.setCheckState(0) 227 self.nx_ny_ratio_check.setCheckState(0) 228 self.nx_ny_ratio_box.setValue(1.00) 229 self.npex_npey_ratio_check.setCheckState(0) 230 self.npex_npey_ratio_box.setValue(1.00) 231 self.npex_npey_deviation_box.setValue(1) 232 233 def input_min_max_check(self): 234 # setting chosen min values as minimum of maxima 235 self.nx_max_box.setMinimum(self.nx_min_box.value()) 236 self.ny_max_box.setMinimum(self.ny_min_box.value()) 237 self.nz_max_box.setMinimum(self.nz_min_box.value()) 238 self.proc_max_box.setMinimum(self.proc_min_box.value()) 239 240 def center_window(self): 241 # moving window to middle of the screen 242 frame = self.frameGeometry() 243 center = QDesktopWidget().availableGeometry().center() 244 frame.moveCenter(center) 245 self.move(frame.topLeft()) 246 247 def fft_method_able(self): 248 # enable/disable QComboBox of fft method 249 if self.psolver_combo_box.currentIndex() == 1: 250 self.fft_combo_box.setEnabled(True) 251 else: 252 self.fft_combo_box.setEnabled(False) 253 self.fft_combo_box.setCurrentIndex(0) 254 255 def nx_ny_ratio_able(self): 256 # enable/disable QSpinBox of nx/ny-ratio 257 if int(self.nx_ny_ratio_check.checkState()) == 0: 258 self.nx_ny_ratio_box.setEnabled(False) 259 else: 260 self.nx_ny_ratio_box.setEnabled(True) 261 262 def strict_matching_able(self): 263 # enable/disable QSpinBox of strict matching 264 if int(self.strict_matching_check.checkState()) == 0: 265 self.strict_matching_box.setEnabled(False) 266 else: 267 self.strict_matching_box.setEnabled(True) 268 269 def npex_npey_ratio_able(self): 270 # enable/disable UI elements of npex/npey-ratio 271 if int(self.npex_npey_ratio_check.checkState()) == 0: 272 self.npex_npey_ratio_box.setEnabled(False) 273 self.npex_npey_deviation_slider.setEnabled(False) 274 self.npex_npey_deviation_box.setEnabled(False) 275 else: 276 self.npex_npey_ratio_box.setEnabled(True) 277 self.npex_npey_deviation_slider.setEnabled(True) 278 self.npex_npey_deviation_box.setEnabled(True) 279 280 def result_visibility(self, boolean): 281 # making certain ui elements in/visible 282 self.progressbar.setVisible(boolean) 283 self.results_information_label.setVisible(boolean) 284 self.view_button.setVisible(boolean) 797 285 798 286 799 287 if __name__ == "__main__": 800 import time 801 app = QtGui.QApplication(sys.argv) 802 window = MyApp1() 803 window.setWindowTitle('Gridfinder') 288 app = QtWidgets.QApplication(sys.argv) 289 window = AppMain() 290 window.setWindowTitle('palm_gf') 804 291 window.show() 805 292 sys.exit(app.exec_()) -
palm/trunk/SCRIPTS/palm_gf_files/palm_gf.ui
r2308 r4869 3 3 <class>MainWindow</class> 4 4 <widget class="QMainWindow" name="MainWindow"> 5 <property name="windowModality">6 <enum>Qt::WindowModal</enum>7 </property>8 <property name="enabled">9 <bool>true</bool>10 </property>11 5 <property name="geometry"> 12 6 <rect> 13 7 <x>0</x> 14 8 <y>0</y> 15 <width> 584</width>16 <height> 386</height>9 <width>797</width> 10 <height>500</height> 17 11 </rect> 18 </property>19 <property name="sizePolicy">20 <sizepolicy hsizetype="Minimum" vsizetype="Minimum">21 <horstretch>0</horstretch>22 <verstretch>0</verstretch>23 </sizepolicy>24 </property>25 <property name="minimumSize">26 <size>27 <width>584</width>28 <height>375</height>29 </size>30 </property>31 <property name="maximumSize">32 <size>33 <width>584</width>34 <height>622</height>35 </size>36 12 </property> 37 13 <property name="windowTitle"> 38 14 <string>MainWindow</string> 39 15 </property> 16 <property name="layoutDirection"> 17 <enum>Qt::LeftToRight</enum> 18 </property> 19 <property name="locale"> 20 <locale language="German" country="Germany"/> 21 </property> 22 <property name="dockOptions"> 23 <set>QMainWindow::AllowTabbedDocks|QMainWindow::AnimatedDocks</set> 24 </property> 40 25 <widget class="QWidget" name="centralwidget"> 41 <widget class="QFrame" name="frame_2"> 26 <widget class="QWidget" name="gridLayoutWidget"> 27 <property name="geometry"> 28 <rect> 29 <x>85</x> 30 <y>60</y> 31 <width>361</width> 32 <height>111</height> 33 </rect> 34 </property> 35 <layout class="QGridLayout" name="grid_layout_1"> 36 <property name="sizeConstraint"> 37 <enum>QLayout::SetDefaultConstraint</enum> 38 </property> 39 <property name="leftMargin"> 40 <number>5</number> 41 </property> 42 <property name="topMargin"> 43 <number>0</number> 44 </property> 45 <property name="rightMargin"> 46 <number>5</number> 47 </property> 48 <property name="bottomMargin"> 49 <number>5</number> 50 </property> 51 <property name="horizontalSpacing"> 52 <number>25</number> 53 </property> 54 <item row="0" column="2"> 55 <widget class="QSpinBox" name="nz_min_box"> 56 <property name="minimumSize"> 57 <size> 58 <width>0</width> 59 <height>24</height> 60 </size> 61 </property> 62 <property name="minimum"> 63 <number>0</number> 64 </property> 65 <property name="maximum"> 66 <number>99999999</number> 67 </property> 68 </widget> 69 </item> 70 <item row="1" column="2"> 71 <widget class="QSpinBox" name="nz_max_box"> 72 <property name="minimumSize"> 73 <size> 74 <width>0</width> 75 <height>24</height> 76 </size> 77 </property> 78 <property name="minimum"> 79 <number>1</number> 80 </property> 81 <property name="maximum"> 82 <number>99999999</number> 83 </property> 84 </widget> 85 </item> 86 <item row="0" column="1"> 87 <widget class="QSpinBox" name="ny_min_box"> 88 <property name="minimumSize"> 89 <size> 90 <width>0</width> 91 <height>24</height> 92 </size> 93 </property> 94 <property name="minimum"> 95 <number>0</number> 96 </property> 97 <property name="maximum"> 98 <number>99999999</number> 99 </property> 100 </widget> 101 </item> 102 <item row="1" column="1"> 103 <widget class="QSpinBox" name="ny_max_box"> 104 <property name="minimumSize"> 105 <size> 106 <width>0</width> 107 <height>24</height> 108 </size> 109 </property> 110 <property name="minimum"> 111 <number>1</number> 112 </property> 113 <property name="maximum"> 114 <number>99999999</number> 115 </property> 116 </widget> 117 </item> 118 <item row="1" column="0"> 119 <widget class="QSpinBox" name="nx_max_box"> 120 <property name="minimumSize"> 121 <size> 122 <width>0</width> 123 <height>24</height> 124 </size> 125 </property> 126 <property name="minimum"> 127 <number>1</number> 128 </property> 129 <property name="maximum"> 130 <number>99999999</number> 131 </property> 132 </widget> 133 </item> 134 <item row="0" column="0"> 135 <widget class="QSpinBox" name="nx_min_box"> 136 <property name="minimumSize"> 137 <size> 138 <width>25</width> 139 <height>22</height> 140 </size> 141 </property> 142 <property name="minimum"> 143 <number>0</number> 144 </property> 145 <property name="maximum"> 146 <number>99999999</number> 147 </property> 148 </widget> 149 </item> 150 </layout> 151 </widget> 152 <widget class="QLabel" name="grid_header_label"> 42 153 <property name="geometry"> 43 154 <rect> 44 155 <x>0</x> 45 <y>0</y> 46 <width>361</width> 47 <height>201</height> 48 </rect> 49 </property> 50 <property name="frameShape"> 51 <enum>QFrame::StyledPanel</enum> 52 </property> 53 <property name="frameShadow"> 54 <enum>QFrame::Raised</enum> 55 </property> 56 <widget class="QLabel" name="label"> 57 <property name="geometry"> 58 <rect> 59 <x>10</x> 60 <y>10</y> 61 <width>237</width> 62 <height>16</height> 63 </rect> 64 </property> 65 <property name="font"> 66 <font> 67 <weight>75</weight> 68 <bold>true</bold> 69 </font> 70 </property> 71 <property name="text"> 72 <string>Define numerical grid</string> 73 </property> 74 </widget> 75 <widget class="QWidget" name="horizontalLayoutWidget_2"> 76 <property name="geometry"> 77 <rect> 78 <x>70</x> 79 <y>60</y> 80 <width>283</width> 81 <height>41</height> 82 </rect> 83 </property> 84 <layout class="QHBoxLayout" name="horizontalLayout_2"> 85 <item> 86 <widget class="QSpinBox" name="nx_min_box"> 87 <property name="toolTip"> 88 <string><html><head/><body><p>Minimum of number of Gridpoints in X-direction.</p></body></html></string> 89 </property> 90 <property name="minimum"> 91 <number>1</number> 92 </property> 93 <property name="maximum"> 94 <number>100000</number> 95 </property> 96 </widget> 97 </item> 98 <item> 99 <widget class="QSpinBox" name="ny_min_box"> 100 <property name="toolTip"> 101 <string><html><head/><body><p>Minimum of number of Gridpoints in Y-direction.</p></body></html></string> 102 </property> 103 <property name="minimum"> 104 <number>1</number> 105 </property> 106 <property name="maximum"> 107 <number>100000</number> 108 </property> 109 </widget> 110 </item> 111 <item> 112 <widget class="QSpinBox" name="nz_min_box"> 113 <property name="toolTip"> 114 <string><html><head/><body><p>Minimum of number of Gridpoints in Z-direction.</p></body></html></string> 115 </property> 116 <property name="minimum"> 117 <number>1</number> 118 </property> 119 <property name="maximum"> 120 <number>100000</number> 121 </property> 122 </widget> 123 </item> 124 </layout> 125 </widget> 126 <widget class="QWidget" name="horizontalLayoutWidget_3"> 127 <property name="geometry"> 128 <rect> 129 <x>70</x> 130 <y>100</y> 131 <width>283</width> 132 <height>41</height> 133 </rect> 134 </property> 135 <layout class="QHBoxLayout" name="horizontalLayout_3"> 136 <item> 137 <widget class="QSpinBox" name="nx_max_box"> 138 <property name="toolTip"> 139 <string><html><head/><body><p>Maximum of number of Gridpoints in X-direction.</p></body></html></string> 140 </property> 141 <property name="autoFillBackground"> 142 <bool>false</bool> 143 </property> 144 <property name="styleSheet"> 145 <string notr="true"/> 146 </property> 147 <property name="frame"> 148 <bool>true</bool> 149 </property> 150 <property name="minimum"> 151 <number>1</number> 152 </property> 153 <property name="maximum"> 154 <number>100000</number> 155 </property> 156 </widget> 157 </item> 158 <item> 159 <widget class="QSpinBox" name="ny_max_box"> 160 <property name="toolTip"> 161 <string><html><head/><body><p>Maxmimum of number of Gridpoints in Y-direction.</p></body></html></string> 162 </property> 163 <property name="minimum"> 164 <number>1</number> 165 </property> 166 <property name="maximum"> 167 <number>100000</number> 168 </property> 169 </widget> 170 </item> 171 <item> 172 <widget class="QSpinBox" name="nz_max_box"> 173 <property name="toolTip"> 174 <string><html><head/><body><p>Maximum of number of Gridpoints in Z-direction.</p></body></html></string> 175 </property> 176 <property name="minimum"> 177 <number>1</number> 178 </property> 179 <property name="maximum"> 180 <number>100000</number> 181 </property> 182 </widget> 183 </item> 184 </layout> 185 </widget> 186 <widget class="QDoubleSpinBox" name="dnxny_box"> 187 <property name="geometry"> 188 <rect> 189 <x>150</x> 190 <y>160</y> 191 <width>72</width> 192 <height>22</height> 193 </rect> 194 </property> 195 <property name="toolTip"> 196 <string><html><head/><body><p>Defines Ratio between the number of Gridpoints in X- and Y-direction.</p><p>If nx/ny = 0 , option is deactivated</p><p><br/></p></body></html></string> 197 </property> 198 <property name="maximum"> 199 <double>1000.000000000000000</double> 200 </property> 201 </widget> 202 <widget class="QLabel" name="label_11"> 203 <property name="geometry"> 204 <rect> 205 <x>10</x> 206 <y>160</y> 207 <width>149</width> 208 <height>21</height> 209 </rect> 210 </property> 211 <property name="toolTip"> 212 <string><html><head/><body><p>Defines Ratio between the number of Gridpoints in X- and Y-direction.</p><p>If nx/ny = 0 , option is deactivated</p><p><br/></p></body></html></string> 213 </property> 214 <property name="text"> 215 <string>Set fixed ratio (nx / ny):</string> 216 </property> 217 </widget> 218 <widget class="QLabel" name="label_3"> 219 <property name="enabled"> 220 <bool>true</bool> 221 </property> 222 <property name="geometry"> 223 <rect> 224 <x>70</x> 225 <y>41</y> 226 <width>86</width> 227 <height>27</height> 228 </rect> 229 </property> 230 <property name="sizePolicy"> 231 <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> 232 <horstretch>0</horstretch> 233 <verstretch>0</verstretch> 234 </sizepolicy> 235 </property> 236 <property name="minimumSize"> 237 <size> 238 <width>0</width> 239 <height>24</height> 240 </size> 241 </property> 242 <property name="toolTip"> 243 <string><html><head/><body><p>Number of Gridpoints in X-direction.</p></body></html></string> 244 </property> 245 <property name="text"> 246 <string> nx</string> 247 </property> 248 </widget> 249 <widget class="QLabel" name="label_5"> 250 <property name="geometry"> 251 <rect> 252 <x>260</x> 253 <y>41</y> 254 <width>41</width> 255 <height>27</height> 256 </rect> 257 </property> 258 <property name="sizePolicy"> 259 <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> 260 <horstretch>0</horstretch> 261 <verstretch>0</verstretch> 262 </sizepolicy> 263 </property> 264 <property name="minimumSize"> 265 <size> 266 <width>0</width> 267 <height>24</height> 268 </size> 269 </property> 270 <property name="toolTip"> 271 <string><html><head/><body><p>Number of Gridpoints in Y-direction.</p></body></html></string> 272 </property> 273 <property name="text"> 274 <string> nz</string> 275 </property> 276 <property name="scaledContents"> 277 <bool>false</bool> 278 </property> 279 </widget> 280 <widget class="QLabel" name="label_4"> 281 <property name="geometry"> 282 <rect> 283 <x>162</x> 284 <y>41</y> 285 <width>41</width> 286 <height>27</height> 287 </rect> 288 </property> 289 <property name="sizePolicy"> 290 <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> 291 <horstretch>0</horstretch> 292 <verstretch>0</verstretch> 293 </sizepolicy> 294 </property> 295 <property name="minimumSize"> 296 <size> 297 <width>0</width> 298 <height>27</height> 299 </size> 300 </property> 301 <property name="toolTip"> 302 <string><html><head/><body><p>Number of Gridpoints in Z-direction.</p></body></html></string> 303 </property> 304 <property name="text"> 305 <string> ny</string> 306 </property> 307 </widget> 308 <widget class="QLabel" name="label_6"> 309 <property name="geometry"> 310 <rect> 311 <x>10</x> 312 <y>60</y> 313 <width>80</width> 314 <height>37</height> 315 </rect> 316 </property> 317 <property name="text"> 318 <string>Minimum</string> 319 </property> 320 </widget> 321 <widget class="QLabel" name="label_7"> 322 <property name="geometry"> 323 <rect> 324 <x>10</x> 325 <y>104</y> 326 <width>83</width> 327 <height>31</height> 328 </rect> 329 </property> 330 <property name="text"> 331 <string>Maximum</string> 332 </property> 333 </widget> 334 <widget class="QLabel" name="warning_label"> 335 <property name="geometry"> 336 <rect> 337 <x>230</x> 338 <y>155</y> 339 <width>121</width> 340 <height>31</height> 341 </rect> 342 </property> 343 <property name="autoFillBackground"> 344 <bool>false</bool> 345 </property> 346 <property name="styleSheet"> 347 <string notr="true"/> 348 </property> 349 <property name="text"> 350 <string>Input error! Min > Max</string> 351 </property> 352 </widget> 353 </widget> 354 <widget class="QFrame" name="frame"> 355 <property name="geometry"> 356 <rect> 357 <x>360</x> 358 <y>0</y> 359 <width>211</width> 360 <height>221</height> 361 </rect> 362 </property> 363 <property name="frameShape"> 364 <enum>QFrame::StyledPanel</enum> 365 </property> 366 <property name="frameShadow"> 367 <enum>QFrame::Raised</enum> 368 </property> 369 <widget class="QLabel" name="label_2"> 370 <property name="geometry"> 371 <rect> 372 <x>10</x> 373 <y>10</y> 374 <width>204</width> 375 <height>16</height> 376 </rect> 377 </property> 378 <property name="font"> 379 <font> 380 <weight>75</weight> 381 <bold>true</bold> 382 </font> 383 </property> 384 <property name="text"> 385 <string>Define processor topology</string> 386 </property> 387 </widget> 388 <widget class="QLabel" name="label_14"> 389 <property name="geometry"> 390 <rect> 391 <x>20</x> 392 <y>40</y> 393 <width>141</width> 394 <height>16</height> 395 </rect> 396 </property> 397 <property name="sizePolicy"> 398 <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> 399 <horstretch>0</horstretch> 400 <verstretch>0</verstretch> 401 </sizepolicy> 402 </property> 403 <property name="minimumSize"> 404 <size> 405 <width>141</width> 406 <height>16</height> 407 </size> 408 </property> 409 <property name="maximumSize"> 410 <size> 411 <width>141</width> 412 <height>16</height> 413 </size> 414 </property> 415 <property name="toolTip"> 416 <string><html><head/><body><p>Number of processors used for calculation.</p></body></html></string> 417 </property> 418 <property name="text"> 419 <string>Number of processors:</string> 420 </property> 421 </widget> 422 <widget class="Line" name="line"> 423 <property name="geometry"> 424 <rect> 425 <x>0</x> 426 <y>105</y> 427 <width>201</width> 428 <height>31</height> 429 </rect> 430 </property> 431 <property name="orientation"> 432 <enum>Qt::Horizontal</enum> 433 </property> 434 </widget> 435 <widget class="QLabel" name="label_20"> 436 <property name="geometry"> 437 <rect> 438 <x>22</x> 439 <y>61</y> 440 <width>89</width> 441 <height>22</height> 442 </rect> 443 </property> 444 <property name="text"> 445 <string>Minimum</string> 446 </property> 447 </widget> 448 <widget class="QLabel" name="label_21"> 449 <property name="geometry"> 450 <rect> 451 <x>22</x> 452 <y>94</y> 453 <width>61</width> 454 <height>21</height> 455 </rect> 456 </property> 457 <property name="text"> 458 <string>Maximum</string> 459 </property> 460 </widget> 461 <widget class="QSpinBox" name="np_max_box"> 462 <property name="geometry"> 463 <rect> 464 <x>110</x> 465 <y>90</y> 466 <width>83</width> 467 <height>25</height> 468 </rect> 469 </property> 470 <property name="sizePolicy"> 471 <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> 472 <horstretch>0</horstretch> 473 <verstretch>0</verstretch> 474 </sizepolicy> 475 </property> 476 <property name="minimumSize"> 477 <size> 478 <width>83</width> 479 <height>25</height> 480 </size> 481 </property> 482 <property name="maximumSize"> 483 <size> 484 <width>83</width> 485 <height>25</height> 486 </size> 487 </property> 488 <property name="toolTip"> 489 <string><html><head/><body><p>Maximum of number of processors used for calculation.</p></body></html></string> 490 </property> 491 <property name="minimum"> 492 <number>1</number> 493 </property> 494 <property name="maximum"> 495 <number>10000000</number> 496 </property> 497 </widget> 498 <widget class="QSpinBox" name="np_min_box"> 499 <property name="geometry"> 500 <rect> 501 <x>110</x> 502 <y>59</y> 503 <width>83</width> 504 <height>25</height> 505 </rect> 506 </property> 507 <property name="sizePolicy"> 508 <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> 509 <horstretch>0</horstretch> 510 <verstretch>0</verstretch> 511 </sizepolicy> 512 </property> 513 <property name="minimumSize"> 514 <size> 515 <width>83</width> 516 <height>25</height> 517 </size> 518 </property> 519 <property name="maximumSize"> 520 <size> 521 <width>83</width> 522 <height>25</height> 523 </size> 524 </property> 525 <property name="toolTip"> 526 <string><html><head/><body><p>Minimum of number of processors used for calculation.</p></body></html></string> 527 </property> 528 <property name="minimum"> 529 <number>1</number> 530 </property> 531 <property name="maximum"> 532 <number>10000</number> 533 </property> 534 </widget> 535 <widget class="QWidget" name="layoutWidget"> 536 <property name="geometry"> 537 <rect> 538 <x>10</x> 539 <y>130</y> 540 <width>182</width> 541 <height>27</height> 542 </rect> 543 </property> 544 <layout class="QHBoxLayout" name="horizontalLayout"> 545 <item> 546 <widget class="QCheckBox" name="strict_box"> 547 <property name="toolTip"> 548 <string><html><head/><body><p>Fixed value for the tasks per node</p></body></html></string> 549 </property> 550 <property name="text"> 551 <string>Strict Matching</string> 552 </property> 553 </widget> 554 </item> 555 <item> 556 <widget class="QSpinBox" name="tpn_box"> 557 <property name="enabled"> 558 <bool>true</bool> 559 </property> 560 <property name="sizePolicy"> 561 <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> 562 <horstretch>0</horstretch> 563 <verstretch>0</verstretch> 564 </sizepolicy> 565 </property> 566 <property name="minimumSize"> 567 <size> 568 <width>72</width> 569 <height>25</height> 570 </size> 571 </property> 572 <property name="maximumSize"> 573 <size> 574 <width>72</width> 575 <height>25</height> 576 </size> 577 </property> 578 <property name="toolTip"> 579 <string><html><head/><body><p>Fixed value for the tasks per node</p></body></html></string> 580 </property> 581 <property name="maximum"> 582 <number>10000</number> 583 </property> 584 <property name="value"> 585 <number>24</number> 586 </property> 587 </widget> 588 </item> 589 </layout> 590 </widget> 591 <widget class="QSlider" name="tolerance_bar"> 592 <property name="geometry"> 593 <rect> 594 <x>10</x> 595 <y>190</y> 596 <width>121</width> 597 <height>23</height> 598 </rect> 599 </property> 600 <property name="toolTip"> 601 <string><html><head/><body><p>Tolerance for npex / npey</p></body></html></string> 602 </property> 603 <property name="value"> 604 <number>10</number> 605 </property> 606 <property name="orientation"> 607 <enum>Qt::Horizontal</enum> 608 </property> 609 </widget> 610 <widget class="QSpinBox" name="tolerance_value"> 611 <property name="geometry"> 612 <rect> 613 <x>131</x> 614 <y>190</y> 615 <width>61</width> 616 <height>22</height> 617 </rect> 618 </property> 619 <property name="toolTip"> 620 <string><html><head/><body><p>Tolerance for npex / npey in percent</p><p><br/></p><p><br/></p></body></html></string> 621 </property> 622 <property name="value"> 623 <number>10</number> 624 </property> 625 </widget> 626 <widget class="QWidget" name="layoutWidget"> 627 <property name="geometry"> 628 <rect> 629 <x>10</x> 630 <y>160</y> 631 <width>181</width> 632 <height>27</height> 633 </rect> 634 </property> 635 <layout class="QHBoxLayout" name="horizontalLayout_4"> 636 <item> 637 <widget class="QCheckBox" name="npex_npey_box"> 638 <property name="text"> 639 <string>npex / npey</string> 640 </property> 641 </widget> 642 </item> 643 <item> 644 <widget class="QDoubleSpinBox" name="d_box"> 645 <property name="sizePolicy"> 646 <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> 647 <horstretch>0</horstretch> 648 <verstretch>0</verstretch> 649 </sizepolicy> 650 </property> 651 <property name="minimumSize"> 652 <size> 653 <width>72</width> 654 <height>25</height> 655 </size> 656 </property> 657 <property name="maximumSize"> 658 <size> 659 <width>72</width> 660 <height>25</height> 661 </size> 662 </property> 663 <property name="maximum"> 664 <double>1000.000000000000000</double> 665 </property> 666 </widget> 667 </item> 668 </layout> 669 </widget> 670 </widget> 671 <widget class="QFrame" name="frame_3"> 672 <property name="geometry"> 673 <rect> 674 <x>0</x> 675 <y>200</y> 676 <width>172</width> 677 <height>131</height> 678 </rect> 679 </property> 680 <property name="frameShape"> 681 <enum>QFrame::StyledPanel</enum> 682 </property> 683 <property name="frameShadow"> 684 <enum>QFrame::Raised</enum> 685 </property> 686 <widget class="QLabel" name="label_9"> 687 <property name="geometry"> 688 <rect> 689 <x>10</x> 690 <y>10</y> 691 <width>161</width> 692 <height>16</height> 693 </rect> 694 </property> 695 <property name="font"> 696 <font> 697 <weight>75</weight> 698 <bold>true</bold> 699 </font> 700 </property> 701 <property name="text"> 702 <string>Pressure solver</string> 703 </property> 704 </widget> 705 <widget class="QLabel" name="label_12"> 706 <property name="geometry"> 707 <rect> 708 <x>12</x> 709 <y>37</y> 710 <width>119</width> 711 <height>15</height> 712 </rect> 713 </property> 714 <property name="minimumSize"> 715 <size> 716 <width>1</width> 717 <height>0</height> 718 </size> 719 </property> 720 <property name="text"> 721 <string>Method (psolver):</string> 722 </property> 723 </widget> 724 <widget class="QComboBox" name="psolver_box"> 725 <property name="geometry"> 726 <rect> 727 <x>11</x> 728 <y>57</y> 729 <width>119</width> 730 <height>20</height> 731 </rect> 732 </property> 733 <property name="sizePolicy"> 734 <sizepolicy hsizetype="Ignored" vsizetype="Fixed"> 735 <horstretch>0</horstretch> 736 <verstretch>0</verstretch> 737 </sizepolicy> 738 </property> 739 <property name="minimumSize"> 740 <size> 741 <width>0</width> 742 <height>18</height> 743 </size> 744 </property> 745 <property name="acceptDrops"> 746 <bool>true</bool> 747 </property> 748 <property name="frame"> 749 <bool>true</bool> 750 </property> 751 <item> 752 <property name="text"> 753 <string>-</string> 754 </property> 755 </item> 756 <item> 757 <property name="text"> 758 <string>poisfft</string> 759 </property> 760 </item> 761 <item> 762 <property name="text"> 763 <string>multigrid_noopt</string> 764 </property> 765 </item> 766 <item> 767 <property name="text"> 768 <string>multigrid</string> 769 </property> 770 </item> 771 <item> 772 <property name="text"> 773 <string>sor</string> 774 </property> 775 </item> 776 </widget> 777 <widget class="QLabel" name="fft_method_label"> 778 <property name="geometry"> 779 <rect> 780 <x>12</x> 781 <y>80</y> 782 <width>131</width> 783 <height>16</height> 784 </rect> 785 </property> 786 <property name="text"> 787 <string>Specify FFT-method:</string> 788 </property> 789 </widget> 790 <widget class="QComboBox" name="fft_method_box"> 791 <property name="geometry"> 792 <rect> 793 <x>11</x> 794 <y>99</y> 795 <width>119</width> 796 <height>20</height> 797 </rect> 798 </property> 799 <property name="minimumSize"> 800 <size> 801 <width>0</width> 802 <height>18</height> 803 </size> 804 </property> 805 <item> 806 <property name="text"> 807 <string>-</string> 808 </property> 809 </item> 810 <item> 811 <property name="text"> 812 <string>FFTW</string> 813 </property> 814 </item> 815 <item> 816 <property name="text"> 817 <string>Temperton</string> 818 </property> 819 </item> 820 <item> 821 <property name="text"> 822 <string>Singleton</string> 823 </property> 824 </item> 825 </widget> 826 </widget> 827 <widget class="QFrame" name="frame_4"> 828 <property name="geometry"> 829 <rect> 830 <x>170</x> 831 <y>200</y> 832 <width>181</width> 833 <height>131</height> 834 </rect> 835 </property> 836 <property name="frameShape"> 837 <enum>QFrame::StyledPanel</enum> 838 </property> 839 <property name="frameShadow"> 840 <enum>QFrame::Raised</enum> 841 </property> 842 <widget class="QLabel" name="label_16"> 843 <property name="geometry"> 844 <rect> 845 <x>10</x> 846 <y>10</y> 847 <width>91</width> 848 <height>16</height> 849 </rect> 850 </property> 851 <property name="font"> 852 <font> 853 <weight>75</weight> 854 <bold>true</bold> 855 </font> 856 </property> 857 <property name="text"> 858 <string>Misc</string> 859 </property> 860 </widget> 861 <widget class="QCheckBox" name="Oos_checkbox"> 862 <property name="geometry"> 863 <rect> 864 <x>10</x> 865 <y>30</y> 866 <width>161</width> 867 <height>21</height> 868 </rect> 869 </property> 870 <property name="toolTip"> 871 <string>Hallo, ich bin ein Test-toolTip. Hier könnte eine tolle erklÀrung zu dieser SchaltflÀche stehen.</string> 872 </property> 873 <property name="text"> 874 <string>Output of spectra</string> 875 </property> 876 </widget> 877 <widget class="QLineEdit" name="filename_line"> 878 <property name="geometry"> 879 <rect> 880 <x>24</x> 881 <y>104</y> 882 <width>100</width> 883 <height>23</height> 884 </rect> 885 </property> 886 <property name="sizePolicy"> 887 <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> 888 <horstretch>0</horstretch> 889 <verstretch>0</verstretch> 890 </sizepolicy> 891 </property> 892 <property name="minimumSize"> 893 <size> 894 <width>0</width> 895 <height>23</height> 896 </size> 897 </property> 898 <property name="maximumSize"> 899 <size> 900 <width>100</width> 901 <height>23</height> 902 </size> 903 </property> 904 <property name="text"> 905 <string>FILENAME.db</string> 906 </property> 907 </widget> 908 <widget class="QPushButton" name="save_button"> 909 <property name="geometry"> 910 <rect> 911 <x>125</x> 912 <y>104</y> 913 <width>45</width> 914 <height>23</height> 915 </rect> 916 </property> 917 <property name="sizePolicy"> 918 <sizepolicy hsizetype="Maximum" vsizetype="Fixed"> 919 <horstretch>0</horstretch> 920 <verstretch>0</verstretch> 921 </sizepolicy> 922 </property> 923 <property name="minimumSize"> 924 <size> 925 <width>0</width> 926 <height>23</height> 927 </size> 928 </property> 929 <property name="maximumSize"> 930 <size> 931 <width>45</width> 932 <height>16777215</height> 933 </size> 934 </property> 935 <property name="text"> 936 <string>Save</string> 937 </property> 938 </widget> 939 </widget> 940 <widget class="QWidget" name="verticalLayoutWidget_8"> 941 <property name="geometry"> 942 <rect> 943 <x>380</x> 944 <y>240</y> 945 <width>197</width> 946 <height>31</height> 947 </rect> 948 </property> 949 <layout class="QVBoxLayout" name="verticalLayout_8"> 950 <item> 951 <widget class="QLabel" name="result_label"> 952 <property name="text"> 953 <string>placeholder, should never be seen</string> 954 </property> 955 </widget> 956 </item> 957 </layout> 958 </widget> 959 <widget class="QLabel" name="result_headline"> 960 <property name="geometry"> 961 <rect> 962 <x>370</x> 963 <y>218</y> 964 <width>179</width> 965 <height>20</height> 156 <y>10</y> 157 <width>171</width> 158 <height>16</height> 966 159 </rect> 967 160 </property> … … 972 165 </font> 973 166 </property> 974 <property name="toolTip"> 975 <string><html><head/><body><p>tolerance for npex / npey</p></body></html></string> 976 </property> 977 <property name="text"> 978 <string>Results</string> 979 </property> 980 </widget> 981 <widget class="Line" name="line_res_down"> 982 <property name="geometry"> 983 <rect> 984 <x>360</x> 985 <y>300</y> 986 <width>201</width> 167 <property name="text"> 168 <string> Define numerical grid</string> 169 </property> 170 </widget> 171 <widget class="QLabel" name="grid_min_label"> 172 <property name="geometry"> 173 <rect> 174 <x>10</x> 175 <y>82</y> 176 <width>71</width> 177 <height>21</height> 178 </rect> 179 </property> 180 <property name="text"> 181 <string>Minimum</string> 182 </property> 183 </widget> 184 <widget class="QLabel" name="grid_max_label"> 185 <property name="geometry"> 186 <rect> 187 <x>10</x> 188 <y>128</y> 189 <width>71</width> 190 <height>21</height> 191 </rect> 192 </property> 193 <property name="text"> 194 <string>Maximum</string> 195 </property> 196 </widget> 197 <widget class="QLabel" name="grid_nx_label"> 198 <property name="geometry"> 199 <rect> 200 <x>110</x> 201 <y>53</y> 202 <width>47</width> 203 <height>13</height> 204 </rect> 205 </property> 206 <property name="text"> 207 <string>nx</string> 208 </property> 209 </widget> 210 <widget class="QLabel" name="grid_ny_label"> 211 <property name="geometry"> 212 <rect> 213 <x>240</x> 214 <y>53</y> 215 <width>47</width> 216 <height>13</height> 217 </rect> 218 </property> 219 <property name="text"> 220 <string>ny</string> 221 </property> 222 </widget> 223 <widget class="QLabel" name="grid_nz_label"> 224 <property name="geometry"> 225 <rect> 226 <x>370</x> 227 <y>53</y> 228 <width>47</width> 229 <height>13</height> 230 </rect> 231 </property> 232 <property name="text"> 233 <string>nz</string> 234 </property> 235 </widget> 236 <widget class="QWidget" name="verticalLayoutWidget"> 237 <property name="geometry"> 238 <rect> 239 <x>569</x> 240 <y>59</y> 241 <width>131</width> 242 <height>111</height> 243 </rect> 244 </property> 245 <layout class="QVBoxLayout" name="proc_layout_1"> 246 <property name="spacing"> 247 <number>5</number> 248 </property> 249 <item> 250 <widget class="QSpinBox" name="proc_min_box"> 251 <property name="minimumSize"> 252 <size> 253 <width>110</width> 254 <height>24</height> 255 </size> 256 </property> 257 <property name="maximumSize"> 258 <size> 259 <width>100</width> 260 <height>16777215</height> 261 </size> 262 </property> 263 <property name="minimum"> 264 <number>0</number> 265 </property> 266 <property name="maximum"> 267 <number>99999999</number> 268 </property> 269 </widget> 270 </item> 271 <item> 272 <widget class="QSpinBox" name="proc_max_box"> 273 <property name="minimumSize"> 274 <size> 275 <width>110</width> 276 <height>24</height> 277 </size> 278 </property> 279 <property name="maximumSize"> 280 <size> 281 <width>100</width> 282 <height>16777215</height> 283 </size> 284 </property> 285 <property name="minimum"> 286 <number>1</number> 287 </property> 288 <property name="maximum"> 289 <number>99999999</number> 290 </property> 291 </widget> 292 </item> 293 </layout> 294 </widget> 295 <widget class="QLabel" name="proc_header_label"> 296 <property name="geometry"> 297 <rect> 298 <x>500</x> 299 <y>10</y> 300 <width>191</width> 301 <height>16</height> 302 </rect> 303 </property> 304 <property name="font"> 305 <font> 306 <weight>75</weight> 307 <bold>true</bold> 308 </font> 309 </property> 310 <property name="text"> 311 <string>Define processor topology</string> 312 </property> 313 </widget> 314 <widget class="QLabel" name="proc_min_label"> 315 <property name="geometry"> 316 <rect> 317 <x>490</x> 318 <y>80</y> 319 <width>71</width> 987 320 <height>20</height> 321 </rect> 322 </property> 323 <property name="text"> 324 <string>Minimum</string> 325 </property> 326 </widget> 327 <widget class="QLabel" name="proc_max_label"> 328 <property name="geometry"> 329 <rect> 330 <x>490</x> 331 <y>130</y> 332 <width>71</width> 333 <height>20</height> 334 </rect> 335 </property> 336 <property name="text"> 337 <string>Maximum</string> 338 </property> 339 </widget> 340 <widget class="QLabel" name="proc_nr_label"> 341 <property name="geometry"> 342 <rect> 343 <x>570</x> 344 <y>50</y> 345 <width>161</width> 346 <height>16</height> 347 </rect> 348 </property> 349 <property name="text"> 350 <string>Number of Processors</string> 351 </property> 352 </widget> 353 <widget class="Line" name="line"> 354 <property name="geometry"> 355 <rect> 356 <x>460</x> 357 <y>72</y> 358 <width>21</width> 359 <height>261</height> 360 </rect> 361 </property> 362 <property name="orientation"> 363 <enum>Qt::Vertical</enum> 364 </property> 365 </widget> 366 <widget class="QLabel" name="psolver_header_label"> 367 <property name="geometry"> 368 <rect> 369 <x>9</x> 370 <y>223</y> 371 <width>141</width> 372 <height>16</height> 373 </rect> 374 </property> 375 <property name="font"> 376 <font> 377 <weight>75</weight> 378 <bold>true</bold> 379 </font> 380 </property> 381 <property name="text"> 382 <string>Pressure Solver</string> 383 </property> 384 </widget> 385 <widget class="QWidget" name="horizontalLayoutWidget"> 386 <property name="geometry"> 387 <rect> 388 <x>20</x> 389 <y>276</y> 390 <width>299</width> 391 <height>51</height> 392 </rect> 393 </property> 394 <layout class="QHBoxLayout" name="psolver_layout"> 395 <property name="spacing"> 396 <number>50</number> 397 </property> 398 <item> 399 <widget class="QComboBox" name="psolver_combo_box"> 400 <item> 401 <property name="text"> 402 <string>-</string> 403 </property> 404 </item> 405 <item> 406 <property name="text"> 407 <string>poisfft</string> 408 </property> 409 </item> 410 <item> 411 <property name="text"> 412 <string>multigrid_noopt</string> 413 </property> 414 </item> 415 <item> 416 <property name="text"> 417 <string>multigrid</string> 418 </property> 419 </item> 420 <item> 421 <property name="text"> 422 <string>sor</string> 423 </property> 424 </item> 425 </widget> 426 </item> 427 <item> 428 <widget class="QComboBox" name="fft_combo_box"> 429 <property name="enabled"> 430 <bool>false</bool> 431 </property> 432 <item> 433 <property name="text"> 434 <string>-</string> 435 </property> 436 </item> 437 <item> 438 <property name="text"> 439 <string>FFTW</string> 440 </property> 441 </item> 442 <item> 443 <property name="text"> 444 <string>Temperton</string> 445 </property> 446 </item> 447 <item> 448 <property name="text"> 449 <string>Singleton</string> 450 </property> 451 </item> 452 </widget> 453 </item> 454 </layout> 455 </widget> 456 <widget class="QLabel" name="psolver_method_label"> 457 <property name="geometry"> 458 <rect> 459 <x>9</x> 460 <y>263</y> 461 <width>141</width> 462 <height>21</height> 463 </rect> 464 </property> 465 <property name="layoutDirection"> 466 <enum>Qt::LeftToRight</enum> 467 </property> 468 <property name="text"> 469 <string>Method (psolver)</string> 470 </property> 471 <property name="alignment"> 472 <set>Qt::AlignCenter</set> 473 </property> 474 </widget> 475 <widget class="QLabel" name="psolver_fft_label"> 476 <property name="geometry"> 477 <rect> 478 <x>190</x> 479 <y>263</y> 480 <width>161</width> 481 <height>21</height> 482 </rect> 483 </property> 484 <property name="text"> 485 <string>Specify FFT-Method</string> 486 </property> 487 <property name="alignment"> 488 <set>Qt::AlignCenter</set> 489 </property> 490 </widget> 491 <widget class="QWidget" name="gridLayoutWidget_2"> 492 <property name="geometry"> 493 <rect> 494 <x>500</x> 495 <y>169</y> 496 <width>292</width> 497 <height>131</height> 498 </rect> 499 </property> 500 <layout class="QGridLayout" name="proc_layout_2"> 501 <item row="1" column="0"> 502 <widget class="QCheckBox" name="npex_npey_ratio_check"> 503 <property name="text"> 504 <string>Set fixed ratio (npex/npey)</string> 505 </property> 506 </widget> 507 </item> 508 <item row="0" column="0"> 509 <widget class="QCheckBox" name="strict_matching_check"> 510 <property name="layoutDirection"> 511 <enum>Qt::LeftToRight</enum> 512 </property> 513 <property name="text"> 514 <string>Strict Matching</string> 515 </property> 516 <property name="tristate"> 517 <bool>false</bool> 518 </property> 519 </widget> 520 </item> 521 <item row="0" column="1"> 522 <widget class="QSpinBox" name="strict_matching_box"> 523 <property name="enabled"> 524 <bool>false</bool> 525 </property> 526 <property name="minimumSize"> 527 <size> 528 <width>44</width> 529 <height>24</height> 530 </size> 531 </property> 532 <property name="maximum"> 533 <number>999</number> 534 </property> 535 <property name="value"> 536 <number>24</number> 537 </property> 538 </widget> 539 </item> 540 <item row="2" column="1"> 541 <widget class="QSpinBox" name="npex_npey_deviation_box"> 542 <property name="enabled"> 543 <bool>false</bool> 544 </property> 545 <property name="minimumSize"> 546 <size> 547 <width>0</width> 548 <height>24</height> 549 </size> 550 </property> 551 <property name="minimum"> 552 <number>1</number> 553 </property> 554 <property name="maximum"> 555 <number>3</number> 556 </property> 557 <property name="value"> 558 <number>1</number> 559 </property> 560 </widget> 561 </item> 562 <item row="2" column="0"> 563 <widget class="QSlider" name="npex_npey_deviation_slider"> 564 <property name="enabled"> 565 <bool>false</bool> 566 </property> 567 <property name="minimum"> 568 <number>1</number> 569 </property> 570 <property name="maximum"> 571 <number>3</number> 572 </property> 573 <property name="value"> 574 <number>1</number> 575 </property> 576 <property name="sliderPosition"> 577 <number>1</number> 578 </property> 579 <property name="orientation"> 580 <enum>Qt::Horizontal</enum> 581 </property> 582 </widget> 583 </item> 584 <item row="1" column="1"> 585 <widget class="QDoubleSpinBox" name="npex_npey_ratio_box"> 586 <property name="enabled"> 587 <bool>false</bool> 588 </property> 589 <property name="minimumSize"> 590 <size> 591 <width>0</width> 592 <height>24</height> 593 </size> 594 </property> 595 <property name="minimum"> 596 <double>1.000000000000000</double> 597 </property> 598 <property name="maximum"> 599 <double>100.000000000000000</double> 600 </property> 601 <property name="value"> 602 <double>1.000000000000000</double> 603 </property> 604 </widget> 605 </item> 606 </layout> 607 </widget> 608 <widget class="QWidget" name="horizontalLayoutWidget_2"> 609 <property name="geometry"> 610 <rect> 611 <x>20</x> 612 <y>170</y> 613 <width>234</width> 614 <height>41</height> 615 </rect> 616 </property> 617 <layout class="QHBoxLayout" name="grid_layout_2"> 618 <property name="spacing"> 619 <number>0</number> 620 </property> 621 <item> 622 <widget class="QCheckBox" name="nx_ny_ratio_check"> 623 <property name="minimumSize"> 624 <size> 625 <width>0</width> 626 <height>24</height> 627 </size> 628 </property> 629 <property name="text"> 630 <string>Set fixed ratio (nx/ny)</string> 631 </property> 632 </widget> 633 </item> 634 <item> 635 <widget class="QDoubleSpinBox" name="nx_ny_ratio_box"> 636 <property name="enabled"> 637 <bool>false</bool> 638 </property> 639 <property name="minimumSize"> 640 <size> 641 <width>0</width> 642 <height>24</height> 643 </size> 644 </property> 645 <property name="maximumSize"> 646 <size> 647 <width>60</width> 648 <height>16777215</height> 649 </size> 650 </property> 651 <property name="value"> 652 <double>1.000000000000000</double> 653 </property> 654 </widget> 655 </item> 656 </layout> 657 </widget> 658 <widget class="Line" name="line_2"> 659 <property name="geometry"> 660 <rect> 661 <x>480</x> 662 <y>292</y> 663 <width>241</width> 664 <height>16</height> 988 665 </rect> 989 666 </property> … … 992 669 </property> 993 670 </widget> 994 <widget class="QPushButton" name="view_result_button"> 995 <property name="geometry"> 996 <rect> 997 <x>490</x> 998 <y>281</y> 999 <width>75</width> 1000 <height>23</height> 1001 </rect> 1002 </property> 1003 <property name="sizePolicy"> 1004 <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> 1005 <horstretch>0</horstretch> 1006 <verstretch>0</verstretch> 1007 </sizepolicy> 1008 </property> 1009 <property name="text"> 1010 <string>View results</string> 1011 </property> 1012 </widget> 1013 <widget class="QLabel" name="load_text_label"> 1014 <property name="geometry"> 1015 <rect> 1016 <x>379</x> 1017 <y>281</y> 1018 <width>42</width> 1019 <height>23</height> 1020 </rect> 1021 </property> 1022 <property name="sizePolicy"> 1023 <sizepolicy hsizetype="Fixed" vsizetype="Minimum"> 1024 <horstretch>0</horstretch> 1025 <verstretch>0</verstretch> 1026 </sizepolicy> 1027 </property> 1028 <property name="minimumSize"> 1029 <size> 1030 <width>0</width> 1031 <height>23</height> 1032 </size> 1033 </property> 1034 <property name="toolTip"> 1035 <string><html><head/><body><p>Number of results you want to load in this Ui.</p></body></html></string> 1036 </property> 1037 <property name="text"> 1038 <string> Load</string> 1039 </property> 1040 </widget> 1041 <widget class="QSpinBox" name="nor_spinbox"> 1042 <property name="enabled"> 1043 <bool>false</bool> 1044 </property> 1045 <property name="geometry"> 1046 <rect> 1047 <x>420</x> 1048 <y>281</y> 1049 <width>61</width> 1050 <height>23</height> 1051 </rect> 1052 </property> 1053 <property name="sizePolicy"> 1054 <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> 1055 <horstretch>0</horstretch> 1056 <verstretch>0</verstretch> 1057 </sizepolicy> 1058 </property> 1059 <property name="minimumSize"> 1060 <size> 1061 <width>0</width> 1062 <height>23</height> 1063 </size> 1064 </property> 1065 <property name="maximum"> 1066 <number>9999</number> 1067 </property> 1068 </widget> 1069 <widget class="QPushButton" name="startbutton"> 1070 <property name="geometry"> 1071 <rect> 1072 <x>490</x> 1073 <y>324</y> 1074 <width>75</width> 1075 <height>23</height> 1076 </rect> 1077 </property> 1078 <property name="minimumSize"> 1079 <size> 1080 <width>0</width> 1081 <height>23</height> 1082 </size> 1083 </property> 1084 <property name="maximumSize"> 1085 <size> 1086 <width>16777215</width> 1087 <height>23</height> 1088 </size> 1089 </property> 1090 <property name="toolTip"> 1091 <string><html><head/><body><p>Starts calculation with the given parameters.</p></body></html></string> 671 <widget class="QCheckBox" name="spectra_box"> 672 <property name="geometry"> 673 <rect> 674 <x>500</x> 675 <y>309</y> 676 <width>151</width> 677 <height>21</height> 678 </rect> 679 </property> 680 <property name="text"> 681 <string>Output of Spectra</string> 682 </property> 683 </widget> 684 <widget class="Line" name="line_3"> 685 <property name="geometry"> 686 <rect> 687 <x>20</x> 688 <y>331</y> 689 <width>701</width> 690 <height>20</height> 691 </rect> 692 </property> 693 <property name="orientation"> 694 <enum>Qt::Horizontal</enum> 695 </property> 696 </widget> 697 <widget class="QPushButton" name="start_button"> 698 <property name="geometry"> 699 <rect> 700 <x>640</x> 701 <y>420</y> 702 <width>80</width> 703 <height>31</height> 704 </rect> 1092 705 </property> 1093 706 <property name="text"> 1094 707 <string>Start</string> 1095 708 </property> 1096 <property name="iconSize"> 1097 <size> 1098 <width>18</width> 1099 <height>18</height> 1100 </size> 1101 </property> 1102 </widget> 1103 <widget class="QPushButton" name="quitbutton"> 1104 <property name="geometry"> 1105 <rect> 1106 <x>415</x> 1107 <y>324</y> 1108 <width>75</width> 1109 <height>23</height> 1110 </rect> 1111 </property> 1112 <property name="minimumSize"> 1113 <size> 1114 <width>0</width> 1115 <height>23</height> 1116 </size> 709 </widget> 710 <widget class="QLabel" name="results_header_label"> 711 <property name="geometry"> 712 <rect> 713 <x>10</x> 714 <y>350</y> 715 <width>91</width> 716 <height>16</height> 717 </rect> 718 </property> 719 <property name="font"> 720 <font> 721 <weight>75</weight> 722 <bold>true</bold> 723 </font> 724 </property> 725 <property name="text"> 726 <string>Results</string> 727 </property> 728 </widget> 729 <widget class="QLabel" name="results_information_label"> 730 <property name="geometry"> 731 <rect> 732 <x>21</x> 733 <y>419</y> 734 <width>321</width> 735 <height>31</height> 736 </rect> 737 </property> 738 <property name="text"> 739 <string>Welcome to the Gridfinder.</string> 740 </property> 741 </widget> 742 <widget class="Line" name="line_4"> 743 <property name="geometry"> 744 <rect> 745 <x>460</x> 746 <y>346</y> 747 <width>20</width> 748 <height>111</height> 749 </rect> 750 </property> 751 <property name="orientation"> 752 <enum>Qt::Vertical</enum> 753 </property> 754 </widget> 755 <widget class="QPushButton" name="quit_button"> 756 <property name="geometry"> 757 <rect> 758 <x>510</x> 759 <y>420</y> 760 <width>50</width> 761 <height>31</height> 762 </rect> 1117 763 </property> 1118 764 <property name="text"> 1119 765 <string>Quit</string> 1120 766 </property> 1121 <property name="iconSize"> 1122 <size> 1123 <width>18</width> 1124 <height>18</height> 1125 </size> 1126 </property> 1127 </widget> 1128 <widget class="QProgressBar" name="testbar"> 1129 <property name="geometry"> 1130 <rect> 1131 <x>364</x> 1132 <y>239</y> 1133 <width>206</width> 767 </widget> 768 <widget class="QProgressBar" name="progressbar"> 769 <property name="geometry"> 770 <rect> 771 <x>20</x> 772 <y>380</y> 773 <width>441</width> 1134 774 <height>23</height> 1135 775 </rect> … … 1138 778 <number>0</number> 1139 779 </property> 1140 </widget> 1141 <widget class="QPushButton" name="question_box"> 1142 <property name="geometry"> 1143 <rect> 1144 <x>395</x> 1145 <y>324</y> 1146 <width>21</width> 1147 <height>23</height> 1148 </rect> 1149 </property> 1150 <property name="text"> 1151 <string>?</string> 780 <property name="textVisible"> 781 <bool>true</bool> 782 </property> 783 </widget> 784 <widget class="QPushButton" name="reset_button"> 785 <property name="geometry"> 786 <rect> 787 <x>560</x> 788 <y>420</y> 789 <width>80</width> 790 <height>31</height> 791 </rect> 792 </property> 793 <property name="text"> 794 <string>Reset</string> 795 </property> 796 </widget> 797 <widget class="QPushButton" name="view_button"> 798 <property name="geometry"> 799 <rect> 800 <x>350</x> 801 <y>420</y> 802 <width>100</width> 803 <height>31</height> 804 </rect> 805 </property> 806 <property name="text"> 807 <string>View Data</string> 1152 808 </property> 1153 809 </widget> … … 1158 814 <x>0</x> 1159 815 <y>0</y> 1160 <width> 584</width>1161 <height>2 0</height>816 <width>797</width> 817 <height>22</height> 1162 818 </rect> 1163 819 </property> 1164 <widget class="QMenu" name="menuGridfinder">1165 <property name="title">1166 <string>Gridfinder</string>1167 </property>1168 <addaction name="actionSetting"/>1169 <addaction name="actionSchlie_en"/>1170 </widget>1171 <addaction name="menuGridfinder"/>1172 820 </widget> 1173 821 <widget class="QStatusBar" name="statusbar"/> 1174 <action name="actionSchlie_en">1175 <property name="text">1176 <string>SchlieÃen</string>1177 </property>1178 </action>1179 <action name="actionSetting">1180 <property name="text">1181 <string>Settings</string>1182 </property>1183 </action>1184 822 </widget> 1185 823 <tabstops> … … 1190 828 <tabstop>nz_min_box</tabstop> 1191 829 <tabstop>nz_max_box</tabstop> 1192 <tabstop>np_min_box</tabstop> 1193 <tabstop>np_max_box</tabstop> 1194 <tabstop>tpn_box</tabstop> 1195 <tabstop>d_box</tabstop> 1196 <tabstop>dnxny_box</tabstop> 1197 <tabstop>psolver_box</tabstop> 1198 <tabstop>fft_method_box</tabstop> 1199 <tabstop>startbutton</tabstop> 1200 <tabstop>nor_spinbox</tabstop> 1201 <tabstop>view_result_button</tabstop> 1202 <tabstop>save_button</tabstop> 1203 <tabstop>quitbutton</tabstop> 1204 <tabstop>filename_line</tabstop> 1205 <tabstop>Oos_checkbox</tabstop> 830 <tabstop>proc_min_box</tabstop> 831 <tabstop>proc_max_box</tabstop> 832 <tabstop>psolver_combo_box</tabstop> 833 <tabstop>fft_combo_box</tabstop> 834 <tabstop>nx_ny_ratio_check</tabstop> 835 <tabstop>nx_ny_ratio_box</tabstop> 836 <tabstop>strict_matching_check</tabstop> 837 <tabstop>strict_matching_box</tabstop> 838 <tabstop>npex_npey_ratio_check</tabstop> 839 <tabstop>npex_npey_ratio_box</tabstop> 840 <tabstop>npex_npey_deviation_slider</tabstop> 841 <tabstop>npex_npey_deviation_box</tabstop> 842 <tabstop>spectra_box</tabstop> 843 <tabstop>start_button</tabstop> 844 <tabstop>quit_button</tabstop> 1206 845 </tabstops> 1207 846 <resources/> 1208 847 <connections> 1209 848 <connection> 1210 <sender>quitbutton</sender> 849 <sender>npex_npey_deviation_slider</sender> 850 <signal>valueChanged(int)</signal> 851 <receiver>npex_npey_deviation_box</receiver> 852 <slot>setValue(int)</slot> 853 <hints> 854 <hint type="sourcelabel"> 855 <x>580</x> 856 <y>295</y> 857 </hint> 858 <hint type="destinationlabel"> 859 <x>693</x> 860 <y>295</y> 861 </hint> 862 </hints> 863 </connection> 864 <connection> 865 <sender>npex_npey_deviation_box</sender> 866 <signal>valueChanged(int)</signal> 867 <receiver>npex_npey_deviation_slider</receiver> 868 <slot>setValue(int)</slot> 869 <hints> 870 <hint type="sourcelabel"> 871 <x>693</x> 872 <y>295</y> 873 </hint> 874 <hint type="destinationlabel"> 875 <x>580</x> 876 <y>295</y> 877 </hint> 878 </hints> 879 </connection> 880 <connection> 881 <sender>quit_button</sender> 1211 882 <signal>clicked()</signal> 1212 883 <receiver>MainWindow</receiver> … … 1214 885 <hints> 1215 886 <hint type="sourcelabel"> 1216 <x> 448</x>1217 <y> 335</y>887 <x>534</x> 888 <y>456</y> 1218 889 </hint> 1219 890 <hint type="destinationlabel"> 1220 <x>291</x> 1221 <y>187</y> 1222 </hint> 1223 </hints> 1224 </connection> 1225 <connection> 1226 <sender>strict_box</sender> 1227 <signal>clicked(bool)</signal> 1228 <receiver>tpn_box</receiver> 1229 <slot>setVisible(bool)</slot> 1230 <hints> 1231 <hint type="sourcelabel"> 1232 <x>422</x> 1233 <y>193</y> 1234 </hint> 1235 <hint type="destinationlabel"> 1236 <x>514</x> 1237 <y>193</y> 1238 </hint> 1239 </hints> 1240 </connection> 1241 <connection> 1242 <sender>npex_npey_box</sender> 1243 <signal>clicked(bool)</signal> 1244 <receiver>d_box</receiver> 1245 <slot>setVisible(bool)</slot> 1246 <hints> 1247 <hint type="sourcelabel"> 1248 <x>422</x> 1249 <y>193</y> 1250 </hint> 1251 <hint type="destinationlabel"> 1252 <x>513</x> 1253 <y>193</y> 1254 </hint> 1255 </hints> 1256 </connection> 1257 <connection> 1258 <sender>tolerance_bar</sender> 1259 <signal>valueChanged(int)</signal> 1260 <receiver>tolerance_value</receiver> 1261 <slot>setValue(int)</slot> 1262 <hints> 1263 <hint type="sourcelabel"> 1264 <x>430</x> 1265 <y>221</y> 1266 </hint> 1267 <hint type="destinationlabel"> 1268 <x>521</x> 1269 <y>220</y> 1270 </hint> 1271 </hints> 1272 </connection> 1273 <connection> 1274 <sender>npex_npey_box</sender> 1275 <signal>clicked(bool)</signal> 1276 <receiver>tolerance_bar</receiver> 1277 <slot>setVisible(bool)</slot> 1278 <hints> 1279 <hint type="sourcelabel"> 1280 <x>422</x> 1281 <y>193</y> 1282 </hint> 1283 <hint type="destinationlabel"> 1284 <x>430</x> 1285 <y>221</y> 1286 </hint> 1287 </hints> 1288 </connection> 1289 <connection> 1290 <sender>npex_npey_box</sender> 1291 <signal>clicked(bool)</signal> 1292 <receiver>tolerance_value</receiver> 1293 <slot>setVisible(bool)</slot> 1294 <hints> 1295 <hint type="sourcelabel"> 1296 <x>422</x> 1297 <y>193</y> 1298 </hint> 1299 <hint type="destinationlabel"> 1300 <x>521</x> 1301 <y>220</y> 1302 </hint> 1303 </hints> 1304 </connection> 1305 <connection> 1306 <sender>tolerance_value</sender> 1307 <signal>valueChanged(int)</signal> 1308 <receiver>tolerance_bar</receiver> 1309 <slot>setValue(int)</slot> 1310 <hints> 1311 <hint type="sourcelabel"> 1312 <x>521</x> 1313 <y>220</y> 1314 </hint> 1315 <hint type="destinationlabel"> 1316 <x>430</x> 1317 <y>221</y> 891 <x>370</x> 892 <y>249</y> 1318 893 </hint> 1319 894 </hints> -
palm/trunk/SCRIPTS/palm_gf_files/palm_gf_conf.py
r2308 r4869 1 def write_config(np_min, np_max, nx_min, nx_max, ny_min, ny_max, nz_min, nz_max, tpn, dnpexnpey, dnpexnpey_tolerance, dnxny, poisfft, switch, 2 temperton, mlt_grid, spectr, rslt_thrs, ld_thrs): 3 #from configparser import ConfigParser # windows 4 from ConfigParser import ConfigParser # Linux 1 #!/usr/bin/env python 2 # windows 3 from configparser import ConfigParser 4 # linux 5 #from configparser import configparser 6 import os 5 7 6 # if __name__ == "__main__": 7 cfg = ConfigParser() 8 9 import os.path 10 if os.path.exists('.palm_gf_conf') is False: 11 cfg.add_section("processor_topology") 12 cfg.add_section("numerical_grid") 13 cfg.add_section("method") 14 15 #cfg.add_section("processor_topology") 16 cfg.set("processor_topology", "np_min", np_min) 17 cfg.set("processor_topology", "np_max", np_max) 18 cfg.set("processor_topology", "tasks_per_node", tpn) 19 cfg.set("processor_topology", "dnpexnpey", dnpexnpey) 20 cfg.set("processor_topology", "dnpexnpey_tolerance", dnpexnpey_tolerance) 21 cfg.set("processor_topology", "dnxny", dnxny) 22 23 #cfgadd_section("numerical_grid"). 24 cfg.set("numerical_grid", "nx_min", nx_min) 25 cfg.set("numerical_grid", "nx_max", nx_max) 26 cfg.set("numerical_grid", "ny_min", ny_min) 27 cfg.set("numerical_grid", "ny_max", ny_max) 28 cfg.set("numerical_grid", "nz_min", nz_min) 29 cfg.set("numerical_grid", "nz_max", nz_max) 30 31 #cfg.add_section("method") 32 cfg.set("method", "poisfft", poisfft) 33 cfg.set("method", "switch", switch) 34 cfg.set("method", "temperton", temperton) 35 cfg.set("method", "mlt_grid", mlt_grid) 36 cfg.set("method", "spectr", spectr) 37 38 #cfg.add_section("settings") 39 #cfg.set("settings", "path", path) 40 #cfg.set("settings", "result_threshold", rslt_thrs) 41 #cfg.set("settings", "load_threshold", ld_thrs) 8 cfg = ConfigParser() 42 9 43 10 44 with open(".palm_gf_config", "a") as configfile: 45 cfg.write(configfile) 11 def cfg_write(nx_min, nx_max, ny_min, ny_max, nz_min, nz_max, np_min, np_max, tpn, 12 poisfft, switch, temperton, mlt_grid, spectr, dnxny, dpxpy, dpxpy_dev): 13 # receives parameters from palm_gf and creates/updates .ini file 14 if os.path.exists('./palm_gf_config.ini') is False: 15 cfg.add_section("Numerical Grid") 16 cfg.add_section("Processor Topology") 17 cfg.add_section("Method") 18 else: 19 cfg.read("palm_gf_config.ini") 20 21 cfg.set("Numerical Grid", "nx min", str(nx_min)) 22 cfg.set("Numerical Grid", "nx max", str(nx_max)) 23 cfg.set("Numerical Grid", "ny min", str(ny_min)) 24 cfg.set("Numerical Grid", "ny max", str(ny_max)) 25 cfg.set("Numerical Grid", "nz min", str(nz_min)) 26 cfg.set("Numerical Grid", "nz max", str(nz_max)) 27 28 cfg.set("Processor Topology", "np min", str(np_min)) 29 cfg.set("Processor Topology", "np max", str(np_max)) 30 cfg.set("Processor Topology", "tasks per node", str(tpn)) 31 cfg.set("Processor Topology", "ratio nx/ny", str(dnxny)) 32 cfg.set("Processor Topology", "ratio npex/npey", str(dpxpy)) 33 cfg.set("Processor Topology", "ratio npex/npey tolerance", str(dpxpy_dev)) 34 35 cfg.set("Method", "poisfft", str(poisfft)) 36 cfg.set("Method", "switch", str(switch)) 37 cfg.set("Method", "temperton", str(temperton)) 38 cfg.set("Method", "multigrid", str(mlt_grid)) 39 cfg.set("Method", "spectra", str(spectr)) 40 41 with open("./palm_gf_config.ini", 'w') as cfgfile: 42 cfg.write(cfgfile) 43 44 return True 46 45 47 46 48 def read_config(): 49 #from configparser import ConfigParser # windows 50 from ConfigParser import ConfigParser # Linux 47 def cfg_read(): 48 # reads the .ini File and returns all parameters in a list 49 cfg.read("palm_gf_config.ini") 50 return_list = [cfg.get("Numerical Grid", "nx min"), cfg.get("Numerical Grid", "nx max"), 51 cfg.get("Numerical Grid", "ny min"), cfg.get("Numerical Grid", "ny max"), 52 cfg.get("Numerical Grid", "nz min"), cfg.get("Numerical Grid", "nz max"), 53 cfg.get("Processor Topology", "np min"), cfg.get("Processor Topology", "np max"), 54 cfg.get("Processor Topology", "tasks per node"), cfg.get("Processor Topology", "ratio nx/ny"), 55 cfg.get("Processor Topology", "ratio npex/npey"), 56 cfg.get("Processor Topology", "ratio npex/npey tolerance"), cfg.get("Method", "poisfft"), 57 cfg.get("Method", "switch"), cfg.get("Method", "temperton"), cfg.get("Method", "multigrid"), 58 cfg.get("Method", "spectra")] 51 59 52 53 cfg = ConfigParser() 54 55 cfg.read(".palm_gf_config") 56 np_min = cfg.get("processor_topology", "np_min") 57 np_max = cfg.get("processor_topology", "np_max") 58 tpn = cfg.get("processor_topology", "tasks_per_node") 59 dnpexnpey = cfg.get("processor_topology", "dnpexnpey") 60 dnpexnpey_tolerance = cfg.get("processor_topology", "dnpexnpey_tolerance") 61 dnxny = cfg.get("processor_topology", "dnxny") 62 63 nx_min = cfg.get("numerical_grid", "nx_min") 64 nx_max = cfg.get("numerical_grid", "nx_max") 65 ny_min = cfg.get("numerical_grid", "ny_min") 66 ny_max = cfg.get("numerical_grid", "ny_max") 67 nz_min = cfg.get("numerical_grid", "nz_min") 68 nz_max = cfg.get("numerical_grid", "nz_max") 69 70 poisfft = cfg.get("method", "poisfft") 71 switch = cfg.get("method", "switch") 72 temperton = cfg.get("method", "temperton") 73 mlt_grid = cfg.get("method", "mlt_grid") 74 spectr = cfg.get("method", "spectr") 75 76 import ConfigParser as conf 77 try: 78 result_threshold = cfg.get("settings", "result_threshold") 79 load_threshold = cfg.get("settings", "load_threshold") 80 path = cfg.get("settings", 'path') 81 82 except conf.NoSectionError: 83 84 path = '/localdata/' 85 result_threshold = 250000 86 load_threshold = 100000 87 88 return np_min, np_max, tpn, dnpexnpey, dnpexnpey_tolerance, dnxny, nx_min, nx_max, ny_min, ny_max, nz_min, nz_max, poisfft, switch, temperton, mlt_grid, spectr, result_threshold, load_threshold, path 89 90 91 def write_config_settings(path, rslt_thrs, ld_thrs): 92 93 from ConfigParser import ConfigParser 94 95 cfg = ConfigParser() 96 97 cfg.add_section('settings') 98 99 cfg.set('settings', 'path', path) 100 cfg.set('settings', "result_threshold", rslt_thrs) 101 cfg.set('settings', "load_threshold", ld_thrs) 102 103 with open(".palm_gf_config", "a") as configfile: 104 cfg.write(configfile) 105 106 107 def read_config_settings(): 108 109 from ConfigParser import ConfigParser 110 import ConfigParser as con 111 112 cfg = ConfigParser() 113 cfg.read(".palm_gf_config") 114 115 try: 116 path = cfg.get("settings", "path") 117 result_thrs = cfg.get("settings", "result_threshold") 118 load_thrs = cfg.get("settings", "load_threshold") 119 120 except con.NoSectionError: 121 122 path = '/localdata/' 123 result_thrs = 250000 124 load_thrs = 100000 125 126 except con.NoOptionError: 127 128 path = '/localdata/' 129 result_thrs = 250000 130 load_thrs = 100000 131 132 #print path, result_thrs, load_thrs 133 134 return path, result_thrs, load_thrs 135 136 137 # *********************************************** 138 139 140 def closing_cleanup(): 141 from ConfigParser import ConfigParser # Linux 142 import ConfigParser as conf 143 import os, shutil, time 144 145 cfg = ConfigParser() 146 147 try: 148 149 cfg.read(".palm_gf_config") 150 np_min = cfg.get("processor_topology", "np_min") 151 np_max = cfg.get("processor_topology", "np_max") 152 tpn = cfg.get("processor_topology", "tasks_per_node") 153 dnpexnpey = cfg.get("processor_topology", "dnpexnpey") 154 dnpexnpey_tolerance = cfg.get("processor_topology", "dnpexnpey_tolerance") 155 dnxny = cfg.get("processor_topology", "dnxny") 156 157 nx_min = cfg.get("numerical_grid", "nx_min") 158 nx_max = cfg.get("numerical_grid", "nx_max") 159 ny_min = cfg.get("numerical_grid", "ny_min") 160 ny_max = cfg.get("numerical_grid", "ny_max") 161 nz_min = cfg.get("numerical_grid", "nz_min") 162 nz_max = cfg.get("numerical_grid", "nz_max") 163 164 poisfft = cfg.get("method", "poisfft") 165 switch = cfg.get("method", "switch") 166 temperton = cfg.get("method", "temperton") 167 mlt_grid = cfg.get("method", "mlt_grid") 168 spectr = cfg.get("method", "spectr") 169 170 var1_bool = True 171 172 except conf.NoSectionError: 173 np_min = 0 174 np_max = 0 175 tpn = 0 176 dnpexnpey = 0 177 dnpexnpey_tolerance = 0 178 dnxny = 0 179 180 nx_min = 0 181 nx_max = 0 182 ny_min = 0 183 ny_max = 0 184 nz_min = 0 185 nz_max = 0 186 187 poisfft = False 188 switch = False 189 temperton = False 190 mlt_grid = False 191 spectr = False 192 var1_bool = False 193 194 with open(".palm_gf_config", "w") as configfile: 195 cfg.write(configfile) 196 197 try: 198 cfg.read(".palm_gf_config") 199 rslt_thrs = cfg.get("settings", "result_threshold") 200 ld_thrs = cfg.get("settings", "load_threshold") 201 path = cfg.get("settings", 'path') 202 203 var2_bool = True 204 205 except conf.NoSectionError: 206 207 path = '/localdata/' 208 rslt_thrs = 250000 209 ld_thrs = 100000 210 211 var2_bool = False 212 213 214 215 with open(".palm_gf_config", "w") as configfile: 216 cfg.write(configfile) 217 218 219 220 #os.remove('.palm_gf_config') 221 222 223 224 try: 225 cfg.set("processor_topology", "np_min", np_min) 226 cfg.set("processor_topology", "np_max", np_max) 227 cfg.set("processor_topology", "tasks_per_node", tpn) 228 cfg.set("processor_topology", "dnpexnpey", dnpexnpey) 229 cfg.set("processor_topology", "dnpexnpey_tolerance", dnpexnpey_tolerance) 230 cfg.set("processor_topology", "dnxny", dnxny) 231 232 233 cfg.set("numerical_grid", "nx_min", nx_min) 234 cfg.set("numerical_grid", "nx_max", nx_max) 235 cfg.set("numerical_grid", "ny_min", ny_min) 236 cfg.set("numerical_grid", "ny_max", ny_max) 237 cfg.set("numerical_grid", "nz_min", nz_min) 238 cfg.set("numerical_grid", "nz_max", nz_max) 239 240 241 cfg.set("method", "poisfft", poisfft) 242 cfg.set("method", "switch", switch) 243 cfg.set("method", "temperton", temperton) 244 cfg.set("method", "mlt_grid", mlt_grid) 245 cfg.set("method", "spectr", spectr) 246 247 except conf.NoSectionError: 248 cfg.add_section("processor_topology") 249 cfg.set("processor_topology", "np_min", np_min) 250 cfg.set("processor_topology", "np_max", np_max) 251 cfg.set("processor_topology", "tasks_per_node", tpn) 252 cfg.set("processor_topology", "dnpexnpey", dnpexnpey) 253 cfg.set("processor_topology", "dnpexnpey_tolerance", dnpexnpey_tolerance) 254 cfg.set("processor_topology", "dnxny", dnxny) 255 256 cfg.add_section("numerical_grid") 257 cfg.set("numerical_grid", "nx_min", nx_min) 258 cfg.set("numerical_grid", "nx_max", nx_max) 259 cfg.set("numerical_grid", "ny_min", ny_min) 260 cfg.set("numerical_grid", "ny_max", ny_max) 261 cfg.set("numerical_grid", "nz_min", nz_min) 262 cfg.set("numerical_grid", "nz_max", nz_max) 263 264 cfg.add_section("method") 265 cfg.set("method", "poisfft", poisfft) 266 cfg.set("method", "switch", switch) 267 cfg.set("method", "temperton", temperton) 268 cfg.set("method", "mlt_grid", mlt_grid) 269 cfg.set("method", "spectr", spectr) 270 271 272 try: 273 cfg.set("settings", "path", path) 274 cfg.set("settings", "result_threshold", rslt_thrs) 275 cfg.set("settings", "load_threshold", ld_thrs) 276 277 except conf.NoSectionError: 278 cfg.add_section("settings") 279 cfg.set("settings", "path", path) 280 cfg.set("settings", "result_threshold", rslt_thrs) 281 cfg.set("settings", "load_threshold", ld_thrs) 282 283 284 285 286 287 288 with open(".palm_gf_config", "w") as configfile: 289 cfg.write(configfile) 290 60 return return_list -
palm/trunk/SCRIPTS/palm_gf_files/palm_gf_exec.py
r2308 r4869 1 def grid_executer(): 2 import palm_gf_conf as config_wr 3 import sqlite3 4 conn = sqlite3.connect(".palm_gf_data.db") 5 c = conn.cursor() 6 c.execute("DROP TABLE IF EXISTS grid_current") 7 c.execute("DROP TABLE IF EXISTS grid_limits") 8 c.execute("CREATE TABLE IF NOT EXISTS grid_current(nx INT, ny INT, nz INT, npex INT, npey INT, npxnpy FLOAT, np INT, ngpts INT)") 9 c.execute("CREATE TABLE IF NOT EXISTS grid_limits(nx INT, ny INT, nz INT, npex INT, npey INT, npxnpy FLOAT, np INT, ngpts INT)") 10 conn.commit() 11 main_bool = True 12 parameters = config_wr.read_config() 13 print(parameters) 14 min_procs = int(parameters[0]) 15 max_procs = int(parameters[1]) 16 tpn = int(parameters[2]) 17 dnpexnpey = float(parameters[3]) 18 dnxny = float(parameters[4]) 19 nx_min = int(parameters[5]) 20 nx_max = int(parameters[6]) 21 ny_min = int(parameters[7]) 22 ny_max = int(parameters[8]) 23 nz_min = int(parameters[9]) 24 nz_max = int(parameters[10]) 25 poisfft = parameters[11] 26 switch = parameters[12] 27 tempterton = parameters[13] 28 mlt_grid = parameters[14] 29 spectr = parameters[15] 30 31 if poisfft == str(True): 32 poisfft = True 33 else: 34 poisfft = False 35 36 if switch == str(True): 37 switch = True 38 else: 39 switch = False 40 41 if tempterton == str(True): 42 tempterton = True 43 else: 44 tempterton = False 45 46 if mlt_grid == str(True): 47 mlt_grid = True 48 else: 49 mlt_grid = False 50 51 if spectr == str(True): 52 spectr = True 53 else: 54 spectr = False 55 56 print(spectr, type(spectr)) 57 print(poisfft, switch, tempterton, mlt_grid, spectr) 58 59 np_used = min_procs 60 counter = 0 61 62 nx = nx_min 63 ny = ny_min 64 nz = nz_min 65 66 from math import floor 67 68 def factors(n): 69 result = [] 70 for i in range(2, n + 1): # test all integers between 2 and n 71 s = 0 72 while n / i == floor(n / float(i)): # is n/i an integer? 73 n = n / float(i) 74 s += 1 75 if s > 0: 76 for k in range(s): 77 result.append(i) # i is a pf s times 78 if n == 1: 79 return result 80 81 while np_used <= max_procs: 82 a = 1 83 84 while a <= np_used: 85 prcs_var = np_used % a 86 if prcs_var != 0: 87 a += 1 88 elif prcs_var == 0: 89 npex = a 90 npey = int(np_used / npex) 91 92 if tpn != 0: 93 if np_used % tpn != 0: 94 a += 1 95 continue 96 97 if dnpexnpey != 0 and npex / npey != dnpexnpey: 1 #!/usr/bin/env python 2 from PyQt5.QtCore import pyqtSignal, QThread 3 from math import floor 4 from palm_gf_files.palm_gf_conf import cfg_read 5 from datetime import datetime 6 import sqlite3 7 8 9 class MyThread(QThread): 10 change_value = pyqtSignal(int) 11 completed = pyqtSignal(int, int) 12 busy = pyqtSignal() 13 14 def run(self): 15 # has to be defined in QThread class 16 # starts calculation 17 self.mainroutine() 18 19 def mainroutine(self): 20 # determines all possible solutions for given parameters 21 start = datetime.now() 22 conn = sqlite3.connect("palm_gf_data.db") 23 c = conn.cursor() 24 c.execute("DROP TABLE IF EXISTS grid_current") 25 c.execute("DROP TABLE IF EXISTS grid_limits") 26 c.execute("CREATE TABLE IF NOT EXISTS grid_current(nx INT, ny INT, nz INT, npex INT, npey INT, pxpy FLOAT," 27 "np INT, ngpts FLOAT, nxnpex FLOAT, nynpey FLOAT)") 28 c.execute("CREATE TABLE IF NOT EXISTS grid_limits(nx INT, ny INT, nz INT, npex INT, npey INT, pxpy FLOAT," 29 "np INT, ngpts FLOAT, nxnpex FLOAT, nynpey FLOAT)") 30 conn.commit() 31 var = cfg_read() 32 33 for j in range(12, 17): 34 if var[j] == "True": 35 var[j] = True 36 else: 37 var[j] = False 38 39 nx_min = int(var[0]) 40 nx_max = int(var[1]) 41 ny_min = int(var[2]) 42 ny_max = int(var[3]) 43 nz_min = int(var[4]) 44 nz_max = int(var[5]) 45 procs_min = int(var[6]) 46 procs_max = int(var[7]) 47 tpn = int(var[8]) 48 dnxny = float(var[9]) 49 dpxpy = float(var[10]) 50 dpxpy_dev = int(var[11]) 51 poisfft = var[12] 52 switch = var[13] 53 temperton = var[14] 54 mlt_grid = var[15] 55 spectr = var[16] 56 57 np_used = procs_min 58 counter = 0 59 cnt = 0 60 nx = nx_min 61 ny = ny_min 62 nz = nz_min 63 64 def factors(n): 65 # prime factorization 66 result = [] 67 for i in range(2, n + 1): 68 s = 0 69 while n / i == floor(n / float(i)): 70 n = n / float(i) 71 s += 1 72 if s > 0: 73 for k in range(s): 74 result.append(i) 75 if n == 1: 76 return result 77 78 def temperton_check(nx_, ny_): 79 # uses previously defined prime factorization and determines if ny+1/nx+1 is multiple of 2,3,5 80 nx_list = factors(nx_ + 1) 81 ny_list = factors(ny_ + 1) 82 return_value = 1 83 i = 0 84 if nx_list is not None: 85 while i < len(nx_list): 86 if not (nx_list[i] == 2 or nx_list[i] == 3 or nx_list[i] == 5): 87 return_value = 0 88 i += 1 89 j = 0 90 if ny_list is not None: 91 while j < len(ny_list): 92 if not (ny_list[j] == 2 or ny_list[j] == 3 or ny_list[j] == 5): 93 return_value = 0 94 j += 1 95 96 if nx_list is None: 97 return_value = 0 98 if ny_list is None: 99 return_value = 0 100 101 return return_value 102 # * * * 103 104 while np_used <= procs_max: 105 a = 1 106 while a <= np_used: 107 if cnt != ((np_used - procs_min) / (procs_max - procs_min)) * 100: 108 cnt = ((np_used - procs_min) / (procs_max - procs_min)) * 100 109 self.change_value.emit(cnt) 110 procs_var = np_used % a 111 if procs_var != 0: 98 112 a += 1 99 continue 100 101 while nx <= nx_max: 102 if (nx + 1) % npex != 0: 113 elif procs_var == 0: 114 npex = a 115 npey = int(np_used / npex) 116 117 if tpn != 0: 118 if np_used % tpn != 0: 119 a += 1 120 continue 121 122 if dpxpy != 0.: 123 if (dpxpy - dpxpy_dev*dpxpy) > (float(npex)/float(npey)) or \ 124 (float(npex)/float(npey)) > (dpxpy + dpxpy_dev*dpxpy): 125 a += 1 126 continue 127 128 # if dpxpy != 0. and float(npex) / float(npey) != dpxpy: 129 # a += 1 130 # continue 131 132 while nx <= nx_max: 133 if (nx + 1) % npex != 0: 134 nx += 1 135 continue 136 137 if mlt_grid is True and nx % 2 != 0: 138 nx += 1 139 continue 140 141 if switch is True and (nx + 1) % npey != 0: 142 nx += 1 143 continue 144 145 if npex > nx: 146 nx += 1 147 continue 148 149 while ny <= ny_max: 150 151 if dnxny != 0. and float(nx) / float(ny) != float(dnxny): 152 ny += 1 153 continue 154 155 if (ny + 1) % npey != 0: 156 ny += 1 157 continue 158 159 if mlt_grid is True and ny % 2 != 0: 160 ny += 1 161 continue 162 163 if switch is True and (ny + 1) % npex != 0: 164 ny += 1 165 continue 166 167 if npey > ny: 168 ny += 1 169 continue 170 171 while nz <= nz_max: 172 173 if mlt_grid is True and nz % 2 != 0: 174 nz += 1 175 continue 176 177 if poisfft is True and nz % npex != 0: 178 nz += 1 179 continue 180 181 if spectr is True and nz % npey != 0: 182 nz += 1 183 continue 184 185 if temperton is True and nx > 1 and ny > 1 and temperton_check(nx, ny) == 0: 186 nz += 1 187 continue 188 189 npxnpy = format(float(npex) / float(npey), '.2f') 190 nxnpex = float(nx + 1) / float(npex) 191 nynpey = float(ny + 1) / float(npey) 192 193 c.execute("""INSERT OR REPLACE INTO grid_current(nx, ny, nz, npex, npey, pxpy, 194 np, ngpts, nxnpex, nynpey) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""", 195 (nx, ny, nz, npex, npey, npxnpy, (npex * npey), (nx * ny * nz), 196 nxnpex, nynpey)) 197 198 counter += 1 199 nz += 1 200 nz = nz_min 201 ny += 1 202 ny = ny_min 103 203 nx += 1 104 continue 105 106 if mlt_grid is True and (nx + 1) % 2 != 0: 107 nx += 1 108 continue 109 110 if switch is True and (nx + 1) % npey != 0: 111 nx += 1 112 continue 113 if npex > nx: 114 nx += 1 115 continue 116 117 while ny <= ny_max: 118 119 if dnxny != 0 and float(nx) / float(ny) != float(dnxny): 120 ny += 1 121 continue 122 if (ny + 1) % npey != 0: 123 ny += 1 124 continue 125 126 if mlt_grid is True and ny % 2 != 0: 127 ny += 1 128 continue 129 130 if (ny + 1) % npex != 0 and switch is True: 131 ny += 1 132 continue 133 if npey > ny: 134 ny += 1 135 continue 136 137 while nz <= nz_max: 138 139 if mlt_grid is True and nz % 2 != 0: 140 nz += 1 141 continue 142 143 if poisfft is True and nz % npex != 0: 144 nz += 1 145 continue 146 147 if spectr is True and nz % npey != 0: 148 nz += 1 149 continue 150 151 if tempterton is True and nx > 1 and ny > 1: # and nz < 1: 152 153 nx_list = factors(nx + 1) 154 i = 0 155 nx_var = nx_list[i] 156 157 while i < len(nx_list): 158 if nx_var != 2 or nx_var != 3 or nx_var != 5: 159 160 i += 1 161 continue 162 163 i += 1 164 ny_list = factors(ny + 1) 165 i = 0 166 ny_var = ny_list[i] 167 while i < len(ny_list): 168 if ny_var != 2 or ny_var != 3 or ny_var != 5: 169 170 i += 1 171 continue 172 i += 1 173 174 counter += 1 175 176 npxnpy = format(float(npex)/float(npey), '.2f') 177 c.execute("""INSERT OR REPLACE INTO grid_current(nx, ny, nz, npex, npey, npxnpy, np, ngpts) VALUES (?, ?, ?, ?, ?, ?, ?, ?)""", 178 (nx, ny, nz, npex, npey, npxnpy, (npex * npey), (nx*ny*nz))) 179 180 nz += 11 181 nz = nz_min 182 ny += 1 183 ny = ny_min 184 nx += 1 185 nx = nx_min 186 a += 1 187 # a += 1 188 np_used += 1 204 nx = nx_min 205 a += 1 206 np_used += 1 207 conn.commit() 189 208 190 209 conn.commit() 191 192 193 194 conn.commit() 195 c.close() 196 conn.close() 197 198 #******************************** 199 200 conn = sqlite3.connect(".palm_gf_data.db") 201 c = conn.cursor() 202 try: 203 c.execute("SELECT nx FROM grid_current ORDER BY nx DESC LIMIT 1") 204 mx_nx = c.fetchone()[0] 205 #print(mx_nx) 206 c.execute("SELECT nx FROM grid_current ORDER BY nx LIMIT 1") 207 mn_nx = c.fetchone()[0] 208 #print(mn_nx) 209 c.execute("SELECT ny FROM grid_current ORDER BY ny DESC LIMIT 1") 210 mx_ny = c.fetchone()[0] 211 #print(mx_ny) 212 c.execute("SELECT ny FROM grid_current ORDER BY ny LIMIT 1") 213 mn_ny = c.fetchone()[0] 214 #print(mn_ny) 215 c.execute("SELECT nz FROM grid_current ORDER BY nz DESC LIMIT 1") 216 mx_nz = c.fetchone()[0] 217 #print(mx_nz) 218 c.execute("SELECT nz FROM grid_current ORDER BY nz LIMIT 1") 219 mn_nz = c.fetchone()[0] 220 #print(mn_nz) 221 c.execute("SELECT npex FROM grid_current ORDER BY npex DESC LIMIT 1") 222 mx_npex = c.fetchone()[0] 223 #print(mx_npex) 224 c.execute("SELECT npex FROM grid_current ORDER BY npex LIMIT 1") 225 mn_npex = c.fetchone()[0] 226 #print(mn_npex) 227 c.execute("SELECT npey FROM grid_current ORDER BY npey DESC LIMIT 1") 228 mx_npey = c.fetchone()[0] 229 #print(mx_npey) 230 c.execute("SELECT npey FROM grid_current ORDER BY npey LIMIT 1") 231 mn_npey = c.fetchone()[0] 232 #print(mn_npey) 233 c.execute("SELECT npxnpy FROM grid_current ORDER BY npxnpy DESC LIMIT 1") 234 mx_npxnpy = c.fetchone()[0] 235 #print(mx_npxnpy) 236 c.execute("SELECT npxnpy FROM grid_current ORDER BY npxnpy LIMIT 1") 237 mn_npxnpy = c.fetchone()[0] 238 #print(mn_npxnpy) 239 c.execute("SELECT np FROM grid_current ORDER BY np DESC LIMIT 1") 240 mx_np = c.fetchone()[0] 241 #print(mx_np) 242 c.execute("SELECT np FROM grid_current ORDER BY np LIMIT 1") 243 mn_np = c.fetchone()[0] 244 #print(mn_np) 245 c.execute("SELECT ngpts FROM grid_current ORDER BY ngpts DESC LIMIT 1") 246 mx_ngpts = c.fetchone()[0] 247 #print(mx_ngpts) 248 c.execute("SELECT ngpts FROM grid_current ORDER BY ngpts LIMIT 1") 249 mn_ngpts = c.fetchone()[0] 250 #print(mn_ngpts) 251 252 conn.commit() 253 c.execute( 254 """INSERT OR REPLACE INTO grid_limits(nx, ny, nz, npex, npey, npxnpy, np, ngpts) VALUES (?, ?, ?, ?, ?, ?, ?, ?)""", 255 (mn_nx, mn_ny, mn_nz, mn_npex, mn_npey, mn_npxnpy, mn_np, mn_ngpts)) 256 #conn.commit() 257 #print("test", mn_nx) 258 c.execute( 259 """INSERT OR REPLACE INTO grid_limits(nx, ny, nz, npex, npey, npxnpy, np, ngpts) VALUES (?, ?, ?, ?, ?, ?, ?, ?)""", 260 (mx_nx, mx_ny, mx_nz, mx_npex, mx_npey, mx_npxnpy, mx_np, mx_ngpts)) 261 conn.commit() 262 263 c.close() 264 conn.close() 265 except TypeError: 266 267 checkfile = open(".palm_gf_tmp", "w") 268 if counter != 0: 269 checkfile.write("Gridfinder found " + str(counter) + " results.\n1") 270 else: 271 checkfile.write("Check input, no Results found.\n0") 272 checkfile.close() 273 274 275 276 checkfile = open(".palm_gf_tmp", "w") 277 if counter != 0: 278 checkfile.write("Gridfinder found " + str(counter) + " results.\n1") 279 else: 280 checkfile.write("Check input, no Results found.\n0") 281 checkfile.close() 282 return main_bool 283 284 285 286 def grid_maxmin(): 287 288 import palm_gf_conf 289 import sqlite3 290 291 conn = sqlite3.connect("grid_current.db") 292 c = conn.cursor() 293 c.execute("DROP TABLE IF EXISTS grid_maxmin") 294 c.execute("CREATE TABLE IF NOT EXISTS grid_maxmin(np_min INT,np_max INT, npex_min INT,npex_max INT, npey_min INT,npey_max INT, nx_min INT,nx_max INT," 295 " ny_min INT,ny_max INT, nz_min INT, nz_max INT)") 296 parm = config_wr.read_config() 297 min_procs = int(parm[0]) 298 max_procs = int(parameters[1]) 299 tpn = int(parameters[2]) 300 dnpexnpey = float(parameters[3]) 301 dnxny = float(parameters[4]) 302 nx_min = int(parameters[5]) 303 nx_max = int(parameters[6]) 304 ny_min = int(parameters[7]) 305 ny_max = int(parameters[8]) 306 nz_min = int(parameters[9]) 307 nz_max = int(parameters[10]) 308 309 310 311 312 313 c.execute( 314 """INSERT OR REPLACE INTO grid_maxmin(np_min, np_max, npex_min, npex_max, npey_min, npey_max, nx_min, nx_max, 315 ny_min, ny_max, nz_min, nz_max) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""", 316 (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)) 317 318 conn.commit() 319 c.close() 320 conn.close() 210 self.busy.emit() 211 # read out limits of data in .db 212 try: 213 c.execute("SELECT nx FROM grid_current ORDER BY nx DESC LIMIT 1") 214 mx_nx = c.fetchone()[0] 215 c.execute("SELECT nx FROM grid_current ORDER BY nx LIMIT 1") 216 mn_nx = c.fetchone()[0] 217 c.execute("SELECT ny FROM grid_current ORDER BY ny DESC LIMIT 1") 218 mx_ny = c.fetchone()[0] 219 c.execute("SELECT ny FROM grid_current ORDER BY ny LIMIT 1") 220 mn_ny = c.fetchone()[0] 221 c.execute("SELECT nz FROM grid_current ORDER BY nz DESC LIMIT 1") 222 mx_nz = c.fetchone()[0] 223 c.execute("SELECT nz FROM grid_current ORDER BY nz LIMIT 1") 224 mn_nz = c.fetchone()[0] 225 c.execute("SELECT npex FROM grid_current ORDER BY npex DESC LIMIT 1") 226 mx_npex = c.fetchone()[0] 227 c.execute("SELECT npex FROM grid_current ORDER BY npex LIMIT 1") 228 mn_npex = c.fetchone()[0] 229 c.execute("SELECT npey FROM grid_current ORDER BY npey DESC LIMIT 1") 230 mx_npey = c.fetchone()[0] 231 c.execute("SELECT npey FROM grid_current ORDER BY npey LIMIT 1") 232 mn_npey = c.fetchone()[0] 233 c.execute("SELECT pxpy FROM grid_current ORDER BY pxpy DESC LIMIT 1") 234 mx_npxnpy = c.fetchone()[0] 235 c.execute("SELECT pxpy FROM grid_current ORDER BY pxpy LIMIT 1") 236 mn_npxnpy = c.fetchone()[0] 237 c.execute("SELECT np FROM grid_current ORDER BY np DESC LIMIT 1") 238 mx_np = c.fetchone()[0] 239 c.execute("SELECT np FROM grid_current ORDER BY np LIMIT 1") 240 mn_np = c.fetchone()[0] 241 c.execute("SELECT ngpts FROM grid_current ORDER BY ngpts DESC LIMIT 1") 242 mx_ngpts = c.fetchone()[0] 243 c.execute("SELECT ngpts FROM grid_current ORDER BY ngpts LIMIT 1") 244 mn_ngpts = c.fetchone()[0] 245 c.execute("SELECT nxnpex FROM grid_current ORDER BY nxnpex DESC LIMIT 1") 246 mx_nxpex = c.fetchone()[0] 247 c.execute("SELECT nxnpex FROM grid_current ORDER BY nxnpex LIMIT 1") 248 mn_nxpex = c.fetchone()[0] 249 c.execute("SELECT nynpey FROM grid_current ORDER BY nynpey DESC LIMIT 1") 250 mx_nypey = c.fetchone()[0] 251 c.execute("SELECT nynpey FROM grid_current ORDER BY nynpey LIMIT 1") 252 mn_nypey = c.fetchone()[0] 253 254 conn.commit() 255 c.execute( 256 """INSERT OR REPLACE INTO grid_limits(nx, ny, nz, npex, npey, 257 pxpy, np, ngpts, nxnpex, nynpey) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""", 258 (mn_nx, mn_ny, mn_nz, mn_npex, mn_npey, mn_npxnpy, mn_np, mn_ngpts, mn_nxpex, mn_nypey)) 259 260 c.execute( 261 """INSERT OR REPLACE INTO grid_limits(nx, ny, nz, npex, npey, 262 pxpy, np, ngpts, nxnpex, nynpey) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""", 263 (mx_nx, mx_ny, mx_nz, mx_npex, mx_npey, mx_npxnpy, mx_np, mx_ngpts, mx_nxpex, mx_nypey)) 264 conn.commit() 265 266 c.close() 267 conn.close() 268 except TypeError: 269 pass 270 271 finish = datetime.now() 272 timedelta = finish - start 273 timer = (int(timedelta.seconds)) 274 self.completed.emit(counter, timer) -
palm/trunk/SCRIPTS/palm_gf_files/palm_gf_table.ui
r2309 r4869 8 8 <y>0</y> 9 9 <width>1030</width> 10 <height> 439</height>10 <height>536</height> 11 11 </rect> 12 12 </property> … … 20 20 <y>166</y> 21 21 <width>1005</width> 22 <height> 266</height>22 <height>361</height> 23 23 </rect> 24 24 </property> … … 38 38 <bool>true</bool> 39 39 </property> 40 <property name="editTriggers"> 41 <set>QAbstractItemView::NoEditTriggers</set> 42 </property> 40 43 <property name="dragEnabled"> 41 44 <bool>false</bool> … … 48 51 </property> 49 52 <property name="selectionBehavior"> 50 <enum>QAbstractItemView::Select Items</enum>53 <enum>QAbstractItemView::SelectRows</enum> 51 54 </property> 52 55 <property name="sortingEnabled"> … … 54 57 </property> 55 58 <property name="rowCount"> 56 <number> 8</number>59 <number>11</number> 57 60 </property> 58 61 <property name="columnCount"> … … 75 78 <row> 76 79 <property name="text"> 80 <string>11</string> 81 </property> 82 </row> 83 <row> 84 <property name="text"> 85 <string>10</string> 86 </property> 87 </row> 88 <row> 89 <property name="text"> 90 <string>9</string> 91 </property> 92 </row> 93 <row> 94 <property name="text"> 77 95 <string>8</string> 78 96 </property> … … 150 168 <property name="geometry"> 151 169 <rect> 152 <x>8 31</x>170 <x>847</x> 153 171 <y>60</y> 154 172 <width>30</width> … … 163 181 <property name="geometry"> 164 182 <rect> 165 <x>8 51</x>166 <y> 112</y>183 <x>867</x> 184 <y>52</y> 167 185 <width>131</width> 168 186 <height>17</height> … … 176 194 <property name="geometry"> 177 195 <rect> 178 <x>1 45</x>196 <x>161</x> 179 197 <y>110</y> 180 198 <width>62</width> … … 210 228 <property name="geometry"> 211 229 <rect> 212 <x>2 08</x>230 <x>224</x> 213 231 <y>110</y> 214 232 <width>62</width> … … 244 262 <property name="geometry"> 245 263 <rect> 246 <x>2 71</x>264 <x>287</x> 247 265 <y>110</y> 248 266 <width>62</width> … … 278 296 <property name="geometry"> 279 297 <rect> 280 <x>3 34</x>298 <x>350</x> 281 299 <y>110</y> 282 300 <width>62</width> … … 312 330 <property name="geometry"> 313 331 <rect> 314 <x> 397</x>332 <x>413</x> 315 333 <y>110</y> 316 334 <width>62</width> … … 346 364 <property name="geometry"> 347 365 <rect> 348 <x>4 60</x>366 <x>476</x> 349 367 <y>110</y> 350 368 <width>62</width> … … 377 395 <property name="geometry"> 378 396 <rect> 379 <x>5 23</x>397 <x>539</x> 380 398 <y>110</y> 381 399 <width>62</width> … … 408 426 </property> 409 427 </widget> 410 <widget class="QSpinBox" name="ngpts_max"> 411 <property name="geometry"> 412 <rect> 413 <x>587</x> 414 <y>110</y> 415 <width>80</width> 416 <height>22</height> 417 </rect> 418 </property> 419 <property name="sizePolicy"> 420 <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> 421 <horstretch>0</horstretch> 422 <verstretch>0</verstretch> 423 </sizepolicy> 424 </property> 425 <property name="minimumSize"> 426 <size> 427 <width>80</width> 428 <height>22</height> 429 </size> 430 </property> 431 <property name="maximumSize"> 432 <size> 433 <width>80</width> 434 <height>22</height> 435 </size> 436 </property> 437 <property name="autoFillBackground"> 438 <bool>false</bool> 439 </property> 440 <property name="wrapping"> 441 <bool>false</bool> 442 </property> 443 <property name="frame"> 444 <bool>true</bool> 445 </property> 446 <property name="buttonSymbols"> 447 <enum>QAbstractSpinBox::UpDownArrows</enum> 448 </property> 449 <property name="correctionMode"> 450 <enum>QAbstractSpinBox::CorrectToNearestValue</enum> 451 </property> 452 <property name="maximum"> 453 <number>99999999</number> 454 </property> 455 <property name="value"> 456 <number>0</number> 457 </property> 458 </widget> 459 <widget class="QLabel" name="label_2"> 460 <property name="geometry"> 461 <rect> 462 <x>115</x> 428 <widget class="QLabel" name="max_label"> 429 <property name="geometry"> 430 <rect> 431 <x>131</x> 463 432 <y>107</y> 464 433 <width>47</width> … … 470 439 </property> 471 440 </widget> 472 <widget class="QLabel" name=" label">473 <property name="geometry"> 474 <rect> 475 <x>1 15</x>441 <widget class="QLabel" name="min_label"> 442 <property name="geometry"> 443 <rect> 444 <x>131</x> 476 445 <y>83</y> 477 446 <width>48</width> … … 486 455 <property name="geometry"> 487 456 <rect> 488 <x>1 46</x>457 <x>162</x> 489 458 <y>86</y> 490 459 <width>62</width> … … 520 489 <property name="geometry"> 521 490 <rect> 522 <x>2 09</x>491 <x>225</x> 523 492 <y>86</y> 524 493 <width>62</width> … … 554 523 <property name="geometry"> 555 524 <rect> 556 <x>2 72</x>525 <x>288</x> 557 526 <y>86</y> 558 527 <width>62</width> … … 588 557 <property name="geometry"> 589 558 <rect> 590 <x>3 35</x>559 <x>351</x> 591 560 <y>86</y> 592 561 <width>62</width> … … 622 591 <property name="geometry"> 623 592 <rect> 624 <x> 398</x>593 <x>414</x> 625 594 <y>86</y> 626 595 <width>62</width> … … 656 625 <property name="geometry"> 657 626 <rect> 658 <x>4 61</x>627 <x>477</x> 659 628 <y>86</y> 660 629 <width>62</width> … … 687 656 <property name="geometry"> 688 657 <rect> 689 <x>5 24</x>658 <x>540</x> 690 659 <y>86</y> 691 660 <width>62</width> … … 718 687 </property> 719 688 </widget> 720 <widget class="QSpinBox" name="ngpts_min"> 721 <property name="geometry"> 722 <rect> 723 <x>587</x> 724 <y>86</y> 725 <width>80</width> 726 <height>22</height> 727 </rect> 728 </property> 729 <property name="sizePolicy"> 730 <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> 731 <horstretch>0</horstretch> 732 <verstretch>0</verstretch> 733 </sizepolicy> 734 </property> 735 <property name="minimumSize"> 736 <size> 737 <width>80</width> 738 <height>22</height> 739 </size> 740 </property> 741 <property name="maximumSize"> 742 <size> 743 <width>80</width> 744 <height>22</height> 745 </size> 746 </property> 747 <property name="correctionMode"> 748 <enum>QAbstractSpinBox::CorrectToNearestValue</enum> 749 </property> 750 <property name="maximum"> 751 <number>99999999</number> 752 </property> 753 </widget> 754 <widget class="QLabel" name="label_12"> 755 <property name="geometry"> 756 <rect> 757 <x>851</x> 758 <y>70</y> 759 <width>52</width> 760 <height>14</height> 689 <widget class="QLabel" name="status_text"> 690 <property name="geometry"> 691 <rect> 692 <x>867</x> 693 <y>66</y> 694 <width>61</width> 695 <height>20</height> 761 696 </rect> 762 697 </property> … … 768 703 <property name="geometry"> 769 704 <rect> 770 <x>8 51</x>771 <y> 90</y>705 <x>867</x> 706 <y>30</y> 772 707 <width>131</width> 773 708 <height>16</height> … … 781 716 <property name="geometry"> 782 717 <rect> 783 <x>1 00</x>718 <x>120</x> 784 719 <y>55</y> 785 720 <width>8</width> … … 791 726 </property> 792 727 </widget> 793 <widget class="QLabel" name=" label_3">794 <property name="geometry"> 795 <rect> 796 <x>1 49</x>728 <widget class="QLabel" name="nx_label"> 729 <property name="geometry"> 730 <rect> 731 <x>165</x> 797 732 <y>67</y> 798 733 <width>58</width> … … 822 757 </property> 823 758 </widget> 824 <widget class="QLabel" name=" label_4">759 <widget class="QLabel" name="ny_label"> 825 760 <property name="enabled"> 826 761 <bool>true</bool> … … 828 763 <property name="geometry"> 829 764 <rect> 830 <x>2 13</x>765 <x>229</x> 831 766 <y>67</y> 832 767 <width>57</width> … … 856 791 </property> 857 792 </widget> 858 <widget class="QLabel" name=" label_5">859 <property name="geometry"> 860 <rect> 861 <x>2 75</x>793 <widget class="QLabel" name="nz_label"> 794 <property name="geometry"> 795 <rect> 796 <x>291</x> 862 797 <y>67</y> 863 798 <width>57</width> … … 887 822 </property> 888 823 </widget> 889 <widget class="QLabel" name=" label_6">890 <property name="geometry"> 891 <rect> 892 <x>3 40</x>824 <widget class="QLabel" name="npex_label"> 825 <property name="geometry"> 826 <rect> 827 <x>356</x> 893 828 <y>67</y> 894 829 <width>57</width> … … 918 853 </property> 919 854 </widget> 920 <widget class="QLabel" name=" label_8">921 <property name="geometry"> 922 <rect> 923 <x>4 00</x>855 <widget class="QLabel" name="npey_label"> 856 <property name="geometry"> 857 <rect> 858 <x>416</x> 924 859 <y>67</y> 925 860 <width>57</width> … … 949 884 </property> 950 885 </widget> 951 <widget class="QLabel" name=" label_7">952 <property name="geometry"> 953 <rect> 954 <x>4 61</x>886 <widget class="QLabel" name="npxnpy_label"> 887 <property name="geometry"> 888 <rect> 889 <x>470</x> 955 890 <y>67</y> 956 <width> 57</width>957 <height>19</height> 958 </rect> 959 </property> 960 <property name="sizePolicy"> 961 <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> 962 <horstretch>0</horstretch> 963 <verstretch>0</verstretch> 964 </sizepolicy> 965 </property> 966 <property name="minimumSize"> 967 <size> 968 <width> 57</width>969 <height>19</height> 970 </size> 971 </property> 972 <property name="maximumSize"> 973 <size> 974 <width> 57</width>891 <width>65</width> 892 <height>19</height> 893 </rect> 894 </property> 895 <property name="sizePolicy"> 896 <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> 897 <horstretch>0</horstretch> 898 <verstretch>0</verstretch> 899 </sizepolicy> 900 </property> 901 <property name="minimumSize"> 902 <size> 903 <width>65</width> 904 <height>19</height> 905 </size> 906 </property> 907 <property name="maximumSize"> 908 <size> 909 <width>65</width> 975 910 <height>19</height> 976 911 </size> … … 980 915 </property> 981 916 </widget> 982 <widget class="QLabel" name=" label_9">983 <property name="geometry"> 984 <rect> 985 <x>5 25</x>917 <widget class="QLabel" name="np_label"> 918 <property name="geometry"> 919 <rect> 920 <x>541</x> 986 921 <y>67</y> 987 922 <width>57</width> … … 1011 946 </property> 1012 947 </widget> 1013 <widget class="QLabel" name=" label_10">1014 <property name="geometry"> 1015 <rect> 1016 <x> 590</x>948 <widget class="QLabel" name="ngpts_label"> 949 <property name="geometry"> 950 <rect> 951 <x>606</x> 1017 952 <y>67</y> 1018 953 <width>57</width> … … 1189 1124 <rect> 1190 1125 <x>5</x> 1191 <y> 25</y>1192 <width> 97</width>1193 <height>1 06</height>1126 <y>10</y> 1127 <width>111</width> 1128 <height>131</height> 1194 1129 </rect> 1195 1130 </property> 1196 1131 <layout class="QVBoxLayout" name="verticalLayout"> 1197 1132 <item> 1198 <widget class="QPushButton" name="save_ to_file_button">1133 <widget class="QPushButton" name="save_button"> 1199 1134 <property name="enabled"> 1200 <bool>false</bool> 1135 <bool>true</bool> 1136 </property> 1137 <property name="minimumSize"> 1138 <size> 1139 <width>0</width> 1140 <height>25</height> 1141 </size> 1201 1142 </property> 1202 1143 <property name="toolTip"> 1203 <string><html><head/><body><p> Currently Disabled</p></body></html></string>1144 <string><html><head/><body><p>Save SELECTED results</p></body></html></string> 1204 1145 </property> 1205 1146 <property name="text"> … … 1209 1150 </item> 1210 1151 <item> 1211 <widget class="QPushButton" name="pushButton_3"> 1152 <widget class="QPushButton" name="load_all_button"> 1153 <property name="minimumSize"> 1154 <size> 1155 <width>0</width> 1156 <height>25</height> 1157 </size> 1158 </property> 1212 1159 <property name="toolTip"> 1213 <string><html><head/><body><p>Load s all calculated results.</p></body></html></string>1160 <string><html><head/><body><p>Load all data that was previously calculated.</p><p>CAUTION: Can take some time to load</p></body></html></string> 1214 1161 </property> 1215 1162 <property name="text"> … … 1219 1166 </item> 1220 1167 <item> 1221 <widget class="QPushButton" name="pushButton"> 1168 <widget class="QPushButton" name="exec_button"> 1169 <property name="minimumSize"> 1170 <size> 1171 <width>0</width> 1172 <height>25</height> 1173 </size> 1174 </property> 1175 <property name="toolTip"> 1176 <string><html><head/><body><p>Loads results that fit within set minima/maxima</p><p><br/></p></body></html></string> 1177 </property> 1222 1178 <property name="text"> 1223 1179 <string>Execute filter</string> … … 1226 1182 </item> 1227 1183 <item> 1228 <widget class="QPushButton" name="pushButton_2"> 1184 <widget class="QPushButton" name="reset_button"> 1185 <property name="minimumSize"> 1186 <size> 1187 <width>0</width> 1188 <height>25</height> 1189 </size> 1190 </property> 1191 <property name="toolTip"> 1192 <string><html><head/><body><p>Reset Min/Max to original values</p><p><br/></p></body></html></string> 1193 </property> 1229 1194 <property name="text"> 1230 1195 <string>Reset limits</string> … … 1266 1231 </property> 1267 1232 </widget> 1268 <widget class="QLabel" name=" label_13">1269 <property name="geometry"> 1270 <rect> 1271 <x>6 77</x>1233 <widget class="QLabel" name="nxnpex_label"> 1234 <property name="geometry"> 1235 <rect> 1236 <x>693</x> 1272 1237 <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>1238 <width>65</width> 1239 <height>19</height> 1240 </rect> 1241 </property> 1242 <property name="sizePolicy"> 1243 <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> 1244 <horstretch>0</horstretch> 1245 <verstretch>0</verstretch> 1246 </sizepolicy> 1247 </property> 1248 <property name="minimumSize"> 1249 <size> 1250 <width>65</width> 1251 <height>19</height> 1252 </size> 1253 </property> 1254 <property name="maximumSize"> 1255 <size> 1256 <width>65</width> 1292 1257 <height>19</height> 1293 1258 </size> … … 1297 1262 </property> 1298 1263 </widget> 1299 <widget class="QLabel" name=" label_14">1300 <property name="geometry"> 1301 <rect> 1302 <x>7 55</x>1264 <widget class="QLabel" name="nynpey_label"> 1265 <property name="geometry"> 1266 <rect> 1267 <x>771</x> 1303 1268 <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>1269 <width>65</width> 1270 <height>19</height> 1271 </rect> 1272 </property> 1273 <property name="sizePolicy"> 1274 <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> 1275 <horstretch>0</horstretch> 1276 <verstretch>0</verstretch> 1277 </sizepolicy> 1278 </property> 1279 <property name="minimumSize"> 1280 <size> 1281 <width>65</width> 1282 <height>19</height> 1283 </size> 1284 </property> 1285 <property name="maximumSize"> 1286 <size> 1287 <width>65</width> 1323 1288 <height>19</height> 1324 1289 </size> … … 1331 1296 <property name="geometry"> 1332 1297 <rect> 1333 <x>6 70</x>1298 <x>686</x> 1334 1299 <y>86</y> 1335 1300 <width>71</width> … … 1344 1309 <property name="geometry"> 1345 1310 <rect> 1346 <x>6 70</x>1311 <x>686</x> 1347 1312 <y>110</y> 1348 1313 <width>71</width> … … 1357 1322 <property name="geometry"> 1358 1323 <rect> 1359 <x>7 47</x>1324 <x>763</x> 1360 1325 <y>86</y> 1361 1326 <width>71</width> … … 1370 1335 <property name="geometry"> 1371 1336 <rect> 1372 <x>7 47</x>1337 <x>763</x> 1373 1338 <y>110</y> 1374 1339 <width>71</width> … … 1380 1345 </property> 1381 1346 </widget> 1347 <widget class="QLabel" name="status_label"> 1348 <property name="geometry"> 1349 <rect> 1350 <x>870</x> 1351 <y>90</y> 1352 <width>151</width> 1353 <height>41</height> 1354 </rect> 1355 </property> 1356 <property name="text"> 1357 <string/> 1358 </property> 1359 </widget> 1360 <widget class="QDoubleSpinBox" name="ngpts_max"> 1361 <property name="geometry"> 1362 <rect> 1363 <x>603</x> 1364 <y>110</y> 1365 <width>80</width> 1366 <height>22</height> 1367 </rect> 1368 </property> 1369 <property name="sizePolicy"> 1370 <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> 1371 <horstretch>0</horstretch> 1372 <verstretch>0</verstretch> 1373 </sizepolicy> 1374 </property> 1375 <property name="minimumSize"> 1376 <size> 1377 <width>80</width> 1378 <height>22</height> 1379 </size> 1380 </property> 1381 <property name="maximumSize"> 1382 <size> 1383 <width>80</width> 1384 <height>22</height> 1385 </size> 1386 </property> 1387 <property name="correctionMode"> 1388 <enum>QAbstractSpinBox::CorrectToNearestValue</enum> 1389 </property> 1390 <property name="decimals"> 1391 <number>0</number> 1392 </property> 1393 <property name="maximum"> 1394 <double>9999999999999999464902769475481793196872414789632.000000000000000</double> 1395 </property> 1396 </widget> 1397 <widget class="QDoubleSpinBox" name="ngpts_min"> 1398 <property name="geometry"> 1399 <rect> 1400 <x>603</x> 1401 <y>86</y> 1402 <width>80</width> 1403 <height>22</height> 1404 </rect> 1405 </property> 1406 <property name="sizePolicy"> 1407 <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> 1408 <horstretch>0</horstretch> 1409 <verstretch>0</verstretch> 1410 </sizepolicy> 1411 </property> 1412 <property name="minimumSize"> 1413 <size> 1414 <width>80</width> 1415 <height>22</height> 1416 </size> 1417 </property> 1418 <property name="maximumSize"> 1419 <size> 1420 <width>80</width> 1421 <height>22</height> 1422 </size> 1423 </property> 1424 <property name="correctionMode"> 1425 <enum>QAbstractSpinBox::CorrectToNearestValue</enum> 1426 </property> 1427 <property name="decimals"> 1428 <number>0</number> 1429 </property> 1430 <property name="maximum"> 1431 <double>10000000000000000725314363815292351261583744096465219555182101554790400.000000000000000</double> 1432 </property> 1433 </widget> 1382 1434 </widget> 1383 1435 <tabstops> 1384 <tabstop>pushButton_3</tabstop>1385 1436 <tabstop>nx_min</tabstop> 1386 1437 <tabstop>nx_max</tabstop> … … 1397 1448 <tabstop>np_min</tabstop> 1398 1449 <tabstop>np_max</tabstop> 1399 <tabstop>ngpts_min</tabstop> 1400 <tabstop>ngpts_max</tabstop> 1401 <tabstop>pushButton</tabstop> 1402 <tabstop>pushButton_2</tabstop> 1450 <tabstop>reset_button</tabstop> 1403 1451 <tabstop>tableWidget</tabstop> 1404 1452 </tabstops> -
palm/trunk/SCRIPTS/palm_gf_files/palm_gf_tools.py
r4843 r4869 1 1 #!/usr/bin/env python 2 # -*- coding: utf-8 -*- 3 #--------------------------------------------------------------------------------# 4 # This file is part of the PALM model system. 5 # 6 # PALM is free software: you can redistribute it and/or modify it under the terms 7 # of the GNU General Public License as published by the Free Software Foundation, 8 # either version 3 of the License, or (at your option) any later version. 9 # 10 # PALM is distributed in the hope that it will be useful, but WITHOUT ANY 11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 12 # A PARTICULAR PURPOSE. See the GNU General Public License for more details. 13 # 14 # You should have received a copy of the GNU General Public License along with 15 # PALM. If not, see <http://www.gnu.org/licenses/>. 16 # 17 # Copyright 1997-2021 Leibniz Universitaet Hannover 18 #--------------------------------------------------------------------------------# 19 # 20 # Current revisions: 21 # ----------------- 22 # 23 # 24 # Former revisions: 25 # ----------------- 26 # $Id$ 27 # Initial revision 28 # 29 # 30 # 31 # 32 # 33 # Description: 34 # ------------ 35 # 36 # 37 # Instructions: 38 # ------------- 39 # 40 #------------------------------------------------------------------------------! 41 2 from PyQt5 import QtWidgets, uic 3 from PyQt5.QtWidgets import QFileDialog 42 4 import sys 5 import sqlite3 43 6 import os 44 import sqlite3 45 from PyQt4 import QtCore, QtGui, uic 46 import subprocess as sub 47 import palm_gf_conf as configwr 48 7 49 8 palm_dir = os.getcwd() 50 9 palm_bin = palm_dir + '/trunk/SCRIPTS' 51 10 52 qtCreatorFile = palm_bin + '/palm_gf_files/palm_gf_table.ui' 53 54 Ui_MainWindow, QtBaseClass = uic.loadUiType(qtCreatorFile) 55 56 class MyApp3(QtGui.QMainWindow, Ui_MainWindow): 57 58 class MyTableWidgetItem(QtGui.QTableWidgetItem): 11 12 class MyTable(QtWidgets.QDialog): 13 14 class MyTableWidgetItem(QtWidgets.QTableWidgetItem): 59 15 def __init__(self, text, sortKey): 60 Qt Gui.QTableWidgetItem.__init__(self, text, QtGui.QTableWidgetItem.UserType)16 QtWidgets.QTableWidgetItem.__init__(self, text, QtWidgets.QTableWidgetItem.UserType) 61 17 self.sortKey = sortKey 62 18 … … 64 20 return self.sortKey < other.sortKey 65 21 66 def __init__(self): # def __init__(self, parent=None): 67 QtGui.QMainWindow.__init__(self) 68 Ui_MainWindow.__init__(self) 69 70 framegm = self.frameGeometry() 71 screen = QtGui.QApplication.desktop().screenNumber(QtGui.QApplication.desktop().cursor().pos()) 72 centerpoint = QtGui.QApplication.desktop().screenGeometry(screen).center() 73 framegm.moveCenter(centerpoint) 74 75 #centerpoint = str(centerpoint) 76 #xcenter = centerpoint.split('(')[1].split(',')[0] 77 #ycenter = centerpoint.split('(')[1].split(',')[1].split(')')[0] 78 ##print xcenter, ycenter 79 #centerpoint = QtCore.QPoint(int(xcenter) + 418, int(ycenter)) 80 #framegm.moveCenter(centerpoint) 81 self.move(framegm.topLeft()) 82 83 84 85 self.setupUi(self) 86 self.pushButton_3.clicked.connect(self.load_result) 87 #self.nx_min.valueChanged.connect(self.check) 88 self.load_trigger() 89 self.pushButton.clicked.connect(self.filter_results) 90 #self.Sortnow_button.clicked.connect(self.sort_order) 91 self.pushButton_2.clicked.connect(self.load_trigger) 92 self.tableWidget.horizontalHeader().setClickable(True) 93 94 22 def __init__(self): 23 super(MyTable, self).__init__() 24 uic.loadUi(palm_bin + '/palm_gf_files/palm_gf_table.ui', self) 25 self.center_window() 26 self.load_limits() 27 self.exec_button.clicked.connect(self.filter_data) 28 # connects labels of table to sorting subroutine 95 29 self.nx_table.clicked.connect(lambda: self.sort_table(str("nx"))) 96 30 self.ny_table.clicked.connect(lambda: self.sort_table(str("ny"))) … … 98 32 self.npex_table.clicked.connect(lambda: self.sort_table(str("npex"))) 99 33 self.npey_table.clicked.connect(lambda: self.sort_table(str("npey"))) 100 self.npexnpey_table.clicked.connect(lambda: self.sort_table(str(" npexnpey")))34 self.npexnpey_table.clicked.connect(lambda: self.sort_table(str("pxpy"))) 101 35 self.np_table.clicked.connect(lambda: self.sort_table(str("np"))) 102 36 self.ngpts_table.clicked.connect(lambda: self.sort_table(str("ngpts"))) 103 37 self.nxpex_table.clicked.connect(lambda: self.sort_table(str("nxnpex"))) 104 38 self.nypey_table.clicked.connect(lambda: self.sort_table(str("nynpey"))) 105 106 self.instant() 107 108 self.save_to_file_button.clicked.connect(self.get_path) 109 110 def instant(self): 111 checkfile = open(".palm_gf_tmp", "r") 112 # self.result_label.setText(str(checkfile.readline())) 113 res_text = str(checkfile.readline()) # XXX 114 result_nr = res_text.split(' ')[2] 115 checkfile.close() 116 if int(result_nr) < 100000: 117 self.load_result() 118 119 120 121 def load_trigger(self): 122 pathx = configwr.read_config() 123 pathx = pathx[19] 124 125 126 dtb = str('.palm_gf_data.db') 127 #con = sqlite3.connect("/localdata/.palm_gf_data.db") 128 129 pathx = pathx + '/.palm_gf_data.db' 130 con = sqlite3.connect(pathx) 39 # connects main buttons to subroutines 40 self.load_all_button.clicked.connect(self.load_all) 41 self.reset_button.clicked.connect(self.load_limits) 42 self.save_button.clicked.connect(self.save) 43 44 def center_window(self): 45 # centers window in the middle of screen 46 frame = self.frameGeometry() 47 center = QtWidgets.QDesktopWidget().availableGeometry().center() 48 frame.moveCenter(center) 49 self.move(frame.topLeft()) 50 51 def load_limits(self): 52 # reads out the .db and sets limits of results as Min/Max 53 con = sqlite3.connect('palm_gf_data.db') 131 54 c = con.cursor() 132 55 c.execute("SELECT * FROM " + 'grid_limits') 133 mini = c.fetchone() 134 max = c.fetchone() 135 self.nx_min.setValue(mini[0]) 136 self.nx_max.setValue(max[0]) 137 138 self.ny_min.setValue(mini[1]) 139 self.ny_max.setValue(max[1]) 140 self.nz_min.setValue(mini[2]) 141 self.nz_max.setValue(max[2]) 142 self.npex_min.setValue(mini[3]) 143 self.npex_max.setValue(max[3]) 144 self.npey_min.setValue(mini[4]) 145 self.npey_max.setValue(max[4]) 146 self.npxnpy_min.setValue(mini[5]) 147 self.npxnpy_max.setValue(max[5]) 148 self.np_min.setValue(mini[6]) 149 self.np_max.setValue(max[6]) 150 self.ngpts_min.setValue(mini[7]) 151 self.ngpts_max.setValue(max[7]) 152 self.nxpex_min.setValue(mini[8]) 153 self.nxpex_max.setValue(max[8]) 154 self.nypey_min.setValue(mini[9]) 155 self.nypey_max.setValue(max[9]) 156 157 self.nx_min.setMinimum(mini[0]) 158 self.nx_max.setMaximum(max[0]) 159 self.ny_min.setMinimum(mini[1]) 160 self.ny_max.setMaximum(max[1]) 161 self.nz_min.setMinimum(mini[2]) 162 self.nz_max.setMaximum(max[2]) 163 self.npex_min.setMinimum(mini[3]) 164 self.npex_max.setMaximum(max[3]) 165 self.npey_min.setMinimum(mini[4]) 166 self.npey_max.setMaximum(max[4]) 167 self.npxnpy_min.setMinimum(mini[5]) 168 self.npxnpy_max.setMaximum(max[5]) 169 self.np_min.setMinimum(mini[6]) 170 self.np_max.setMaximum(max[6]) 171 172 self.ngpts_min.setMinimum(mini[7]) 173 self.ngpts_max.setMaximum(max[7]) 174 self.ngpts_min.setMaximum(max[7]) 175 self.ngpts_max.setMinimum(mini[7]) 176 177 self.nxpex_min.setMinimum(mini[8]) 178 self.nxpex_max.setMaximum(max[8]) 179 self.nxpex_min.setMaximum(max[8]) 180 self.nxpex_max.setMinimum(mini[8]) 181 182 self.nypey_min.setMinimum(mini[9]) 183 self.nypey_max.setMaximum(max[9]) 184 self.nypey_min.setMaximum(max[9]) 185 self.nypey_max.setMinimum(mini[9]) 186 187 188 189 56 Min = c.fetchone() 57 Max = c.fetchone() 58 59 self.nx_min.setValue(Min[0]) 60 self.nx_min.setMinimum(Min[0]) 61 self.nx_max.setValue(Max[0]) 62 self.nx_max.setMaximum(Max[0]) 63 64 self.ny_min.setValue(Min[1]) 65 self.ny_min.setMinimum(Min[1]) 66 self.ny_max.setValue(Max[1]) 67 self.ny_max.setMaximum(Max[1]) 68 69 self.nz_min.setValue(Min[2]) 70 self.nz_min.setMinimum(Min[2]) 71 self.nz_max.setValue(Max[2]) 72 self.nz_max.setMaximum(Max[2]) 73 74 self.npex_min.setValue(Min[3]) 75 self.npex_min.setMinimum(Min[3]) 76 self.npex_max.setValue(Max[3]) 77 self.npex_max.setMaximum(Max[3]) 78 79 self.npey_min.setValue(Min[4]) 80 self.npey_min.setMinimum(Min[4]) 81 self.npey_max.setValue(Max[4]) 82 self.npey_max.setMaximum(Max[4]) 83 84 self.npxnpy_min.setValue(Min[5]) 85 self.npxnpy_min.setMinimum(Min[5]) 86 self.npxnpy_max.setValue(Max[5]) 87 self.npxnpy_max.setMaximum(Max[5]) 88 89 self.np_min.setValue(Min[6]) 90 self.np_min.setMinimum(Min[6]) 91 self.np_max.setValue(Max[6]) 92 self.np_max.setMaximum(Max[6]) 93 # try statement, as ngpts could be too huge to handle for PyQt5 (>10^8) 94 try: 95 self.ngpts_min.setValue(Min[7]) 96 self.ngpts_min.setMinimum(Min[7]) 97 self.ngpts_max.setValue(Max[7]) 98 self.ngpts_max.setMaximum(Max[7]) 99 100 except OverflowError: 101 self.ngpts_min.setEnabled(False) 102 self.ngpts_max.setEnabled(False) 103 self.ngpts_table.setEnabled(False) 104 self.ngpts_label.setStyleSheet('color: grey') 105 self.exec_button.setEnabled(False) 106 self.status_label.setText('ngpts overflow') 107 108 self.nxpex_min.setValue(Min[8]) 109 self.nxpex_min.setMinimum(Min[8]) 110 self.nxpex_max.setValue(Max[8]) 111 self.nxpex_max.setMaximum(Max[8]) 112 113 self.nypey_min.setValue(Min[9]) 114 self.nypey_min.setMinimum(Min[9]) 115 self.nypey_max.setValue(Max[9]) 116 self.nypey_max.setMaximum(Max[9]) 190 117 191 118 con.commit() … … 193 120 con.close() 194 121 195 196 197 198 def check(self): 199 pathx = configwr.read_config() 200 pathx = pathx[19] 201 202 dtb = str('.palm_gf_data.db') 203 #con = sqlite3.connect("/localdata/.palm_gf_data.db") 204 con = sqlite3.connect(pathx + '/.palm_gf_data.db') 122 def load_all(self): 123 # shows all results found in .db file 124 con = sqlite3.connect('palm_gf_data.db') 205 125 c = con.cursor() 206 c.execute("SELECT * FROM " + 'grid_limits')207 mini = c.fetchone()208 max = c.fetchone()209 if self.nx_min.value() < mini[0]:210 211 self.nx_min.setValue(mini[0])212 213 214 def process1(self):215 self.calc_label.setText('loading...')216 QtGui.QApplication.processEvents()217 218 219 220 def load_result(self):221 #print("LOADED!!!")222 import decimal223 224 pathx = configwr.read_config()225 pathx = pathx[19]226 227 self.setEnabled(False)228 QtGui.QApplication.processEvents()229 self.load_trigger()230 self.process1()231 database = str('.palm_gf_data.db')232 conn = sqlite3.connect(pathx + '/.palm_gf_data.db')233 c = conn.cursor()234 126 c.execute("SELECT * FROM " + 'grid_current') 235 results = c.fetchall() 236 237 self.tableWidget.setRowCount(len(results)) 238 239 i = 0 240 j = 0 241 k = 0 242 243 while i < len(results): 244 line = results[i] 245 while j < 10: 246 var = line[j] 127 data = c.fetchall() 128 129 self.tableWidget.setRowCount(len(data)) 130 row_cnt = -1 131 for i in range(0, len(data)): 132 line = data[i] 133 row_cnt += 1 134 for j in range(0, 10): 135 value = line[j] 247 136 248 137 if j == 7: 249 self.tableWidget.setItem( i, j, self.MyTableWidgetItem(str("%.1e" % var), j + i))250 #print("%.2e" % int(var), "%.4e" % int(1782))138 self.tableWidget.setItem(row_cnt, j, self.MyTableWidgetItem( 139 str("%.1e" % value), i)) 251 140 252 141 else: 253 self.tableWidget.setItem(i, j, self.MyTableWidgetItem(str(var), j+i)) 254 #item = self.MyTableWidgetItem(str(var), k) 255 #self.tableWidget.setItem(i, j, item) 256 257 j += 1 258 #if j == 3: 259 #print(k) 260 #k += 1 261 #k -= 7 262 k += 1 263 j = 0 264 i += 1 142 self.tableWidget.setItem(row_cnt, j, self.MyTableWidgetItem( 143 str(value), i)) 265 144 266 145 c.close() 267 conn.close() 268 self.calc_label.setText('loading completed') 269 self.label_11.setText(str(len(results)) + ' results ') 270 self.setEnabled(True) 271 QtGui.QApplication.processEvents() 272 273 def filter_results(self): 274 275 pathx = configwr.read_config() 276 pathx = pathx[19] 277 278 self.setEnabled(False) 279 self.calc_label.setText('calculating...') 280 QtGui.QApplication.processEvents() 281 database = str('.palm_gf_data.db') 282 conn = sqlite3.connect(pathx + '/.palm_gf_data.db') 283 c = conn.cursor() 284 c.execute("SELECT * FROM " + "grid_current") 285 results = c.fetchall() 286 #print(results) 287 288 self.tableWidget.setRowCount(len(results)) 289 290 i = 0 291 j = 0 146 con.close() 147 self.tableWidget.setRowCount(row_cnt + 1) 148 self.status_label.setText(str(row_cnt + 1) + ' results loaded') 149 150 def filter_data(self): 151 # filters data according to set Min/Max. Reads out .db to find all fitting data 152 con = sqlite3.connect('palm_gf_data.db') 153 c = con.cursor() 154 c.execute("SELECT * FROM " + 'grid_current') 155 data = c.fetchall() 156 157 self.tableWidget.setRowCount(len(data)) 158 292 159 row_cnt = -1 293 while i < len(results): 294 line = results[i] 295 296 if line[0] <= self.nx_max.value(): 297 298 if line[0] >= self.nx_min.value(): 299 300 if line[1] <= self.ny_max.value(): 301 302 if line[1] >= self.ny_min.value(): 303 304 if line[2] <= self.nz_max.value(): 305 306 if line[2] >= self.nz_min.value(): 307 308 if line[3] <= self.npex_max.value(): 309 310 if line[3] >= self.npex_min.value(): 311 312 if line[4] <= self.npey_max.value(): 313 314 if line[4] >= self.npey_min.value(): 315 316 if line[5] <= self.npxnpy_max.value(): 317 318 if line[5] >= self.npxnpy_min.value(): 319 320 if line[6] <= self.np_max.value(): 321 322 if line[6] >= self.np_min.value(): 323 324 if line[7] <= self.ngpts_max.value(): 325 326 if line[7] >= self.ngpts_min.value(): 327 328 if line[8] <= self.nxpex_max.value(): 329 330 if line[8] >= self.nxpex_min.value(): 331 332 if line[9] <= self.nypey_max.value(): 333 334 if line[9] >= self.nypey_min.value(): 335 336 row_cnt += 1 337 while j < 10: 338 var = line[j] 339 340 if j == 7: 341 self.tableWidget.setItem(row_cnt, j, self.MyTableWidgetItem(str("%.1e" % var), i)) 342 343 else: 344 self.tableWidget.setItem(row_cnt, j, self.MyTableWidgetItem(str(var), i)) 345 346 j += 1 347 348 j = 0 349 i += 1 160 for i in range(0, len(data)): 161 line = data[i] 162 if self.nx_min.value() <= line[0] <= self.nx_max.value(): 163 if self.ny_min.value() <= line[1] <= self.ny_max.value(): 164 if self.nz_min.value() <= line[2] <= self.nz_max.value(): 165 if self.npex_min.value() <= line[3] <= self.npex_max.value(): 166 if self.npey_min.value() <= line[4] <= self.npey_max.value(): 167 if self.npxnpy_min.value() <= line[5] <= self.npxnpy_max.value(): 168 if self.np_min.value() <= line[6] <= self.np_max.value(): 169 if self.ngpts_min.value() <= line[7] <= self.ngpts_max.value(): 170 if self.nxpex_min.value() <= line[8] <= self.nxpex_max.value(): 171 if self.nypey_min.value() <= line[9] <= self.nypey_max.value(): 172 row_cnt += 1 173 for j in range(0, 10): 174 value = line[j] 175 176 if j == 7: 177 self.tableWidget.setItem(row_cnt, j, self.MyTableWidgetItem( 178 str("%.1e" % value), i)) 179 else: 180 self.tableWidget.setItem(row_cnt, j, self.MyTableWidgetItem( 181 str(value), i)) 350 182 351 183 c.close() 352 con n.close()184 con.close() 353 185 self.tableWidget.setRowCount(row_cnt + 1) 354 self.setEnabled(True) 355 self.calc_label.setText('calculation completed') 356 self.label_11.setText(str(row_cnt + 1) + ' results') 357 QtGui.QApplication.processEvents() 358 359 186 self.status_label.setText(str(row_cnt + 1) + ' results found') 360 187 361 188 def sort_table(self, column): 362 189 # with argument as chosen column, read not from table but from .db and reloads sorted data into table 363 190 fnx_mn = self.nx_min.value() 364 191 fnx_mx = self.nx_max.value() … … 382 209 nypey_mx = self.nypey_max.value() 383 210 384 385 if column == str("nx"): 386 sorted_col = "nx" 387 211 if column == 'nx': 212 sorted_col = 'nx' 388 213 if self.nx_table.isChecked() is True: 389 214 order = " DESC" 390 391 else: 392 393 order = " ASC" 394 395 self.ny_table.setChecked(False) 396 self.nz_table.setChecked(False) 397 self.npex_table.setChecked(False) 398 self.npey_table.setChecked(False) 399 self.npexnpey_table.setChecked(False) 215 else: 216 order = " ASC" 217 self.ny_table.setChecked(False) 218 self.nz_table.setChecked(False) 219 self.npex_table.setChecked(False) 220 self.npey_table.setChecked(False) 400 221 self.np_table.setChecked(False) 401 222 self.ngpts_table.setChecked(False) … … 405 226 if column == str("ny"): 406 227 sorted_col = "ny" 407 408 228 if self.ny_table.isChecked() is True: 409 229 order = " DESC" 410 411 else: 412 230 else: 413 231 order = " ASC" 414 232 … … 425 243 if column == str("nz"): 426 244 sorted_col = "nz" 427 428 245 if self.nz_table.isChecked() is True: 429 246 order = " DESC" 430 431 else: 432 247 else: 433 248 order = " ASC" 434 249 … … 445 260 if column == str("npex"): 446 261 sorted_col = "npex" 447 448 262 if self.npex_table.isChecked() is True: 449 263 order = " DESC" 450 451 else: 452 264 else: 453 265 order = " ASC" 454 266 … … 465 277 if column == str("npey"): 466 278 sorted_col = "npey" 467 468 279 if self.npey_table.isChecked() is True: 469 280 order = " DESC" 470 471 else: 472 473 order = " ASC" 474 475 476 self.ny_table.setChecked(False) 477 self.nz_table.setChecked(False) 478 self.npex_table.setChecked(False) 479 self.nx_table.setChecked(False) 480 self.npexnpey_table.setChecked(False) 481 self.np_table.setChecked(False) 482 self.ngpts_table.setChecked(False) 483 self.nxpex_table.setChecked(False) 484 self.nypey_table.setChecked(False) 485 486 if column == str("npexnpey"): 487 sorted_col = "npxnpy" 488 281 else: 282 order = " ASC" 283 284 self.ny_table.setChecked(False) 285 self.nz_table.setChecked(False) 286 self.npex_table.setChecked(False) 287 self.nx_table.setChecked(False) 288 self.npexnpey_table.setChecked(False) 289 self.np_table.setChecked(False) 290 self.ngpts_table.setChecked(False) 291 self.nxpex_table.setChecked(False) 292 self.nypey_table.setChecked(False) 293 294 if column == str("pxpy"): 295 sorted_col = "pxpy" 489 296 if self.npexnpey_table.isChecked() is True: 490 297 order = " DESC" 491 492 else: 493 298 else: 494 299 order = " ASC" 495 300 … … 506 311 if column == str("np"): 507 312 sorted_col = "np" 508 509 313 if self.np_table.isChecked() is True: 510 314 order = " DESC" 511 512 else: 513 315 else: 514 316 order = " ASC" 515 317 … … 526 328 if column == str("ngpts"): 527 329 sorted_col = "ngpts" 528 529 330 if self.ngpts_table.isChecked() is True: 530 331 order = " DESC" 531 532 else: 533 332 else: 534 333 order = " ASC" 535 334 … … 546 345 if column == str("nxnpex"): 547 346 sorted_col = "nxnpex" 548 549 347 if self.nxpex_table.isChecked() is True: 550 348 order = " DESC" 551 552 else: 553 349 else: 554 350 order = " ASC" 555 351 … … 566 362 if column == str("nynpey"): 567 363 sorted_col = "nynpey" 568 569 364 if self.nypey_table.isChecked() is True: 570 365 order = " DESC" 571 572 else: 573 574 order = " ASC" 575 576 self.ny_table.setChecked(False) 577 self.nz_table.setChecked(False) 578 self.npex_table.setChecked(False) 579 self.npey_table.setChecked(False) 580 self.npexnpey_table.setChecked(False) 581 self.np_table.setChecked(False) 582 self.nx_table.setChecked(False) 583 self.ngpts_table.setChecked(False) 584 self.nxpex_table.setChecked(False) 585 586 else: 587 pass 588 589 pathx = configwr.read_config() 590 pathx = pathx[19] 591 592 593 conn = sqlite3.connect(pathx + "/.palm_gf_data.db") 366 else: 367 order = " ASC" 368 369 self.ny_table.setChecked(False) 370 self.nz_table.setChecked(False) 371 self.npex_table.setChecked(False) 372 self.npey_table.setChecked(False) 373 self.npexnpey_table.setChecked(False) 374 self.np_table.setChecked(False) 375 self.nx_table.setChecked(False) 376 self.ngpts_table.setChecked(False) 377 self.nxpex_table.setChecked(False) 378 379 conn = sqlite3.connect('palm_gf_data.db') 594 380 c = conn.cursor() 595 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) + 381 c.execute("SELECT * FROM grid_current WHERE nx <= " + str(fnx_mx) + " AND nx >= " + str( 382 fnx_mn) + " AND ny <= " + str(fny_mx) + " AND ny >= " + str(fny_mn) + " AND nz <= " + str(fnz_mx) + 596 383 " AND nz >= " + str(fnz_mn) + " AND npex <= " + str(fnpex_mx) + " AND npex >= " + 597 str(fnpex_mn) + " AND npey <= " + str(fnpey_mx) + " AND npey >= " + str(fnpey_mn) + " AND " 598 "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) + 599 " AND nxnpex <= " + str(nxpex_mx) + " AND nxnpex >= " + str(nxpex_mn) + " AND nynpey <= " + str(nypey_mx) + " AND nynpey >= " + str(nypey_mn) + 600 " ORDER BY " + str(sorted_col) + str(order)) 601 602 384 str(fnpex_mn) + " AND npey <= " + str(fnpey_mx) + " AND npey >= " + str(fnpey_mn) + " AND " 385 "pxpy <= " + str( 386 fnpxnpy_mx) + " AND pxpy >= " + str(fnpxnpy_mn) + " AND np <= " + str(fnp_mx) + " AND np >= " + str( 387 fnp_mn) + " AND ngpts <= " + str(fngpts_mx) + " AND ngpts >= " + str(fngpts_mn) + 388 " AND nxnpex <= " + str(nxpex_mx) + " AND nxnpex >= " + str(nxpex_mn) + " AND nynpey <= " + str( 389 nypey_mx) + " AND nynpey >= " + str(nypey_mn) + 390 " ORDER BY " + str(sorted_col) + str(order)) 603 391 604 392 sorted = c.fetchall() 605 606 607 393 c.close() 608 394 conn.close() 609 395 self.tableWidget.setRowCount(len(sorted)) 610 611 for row_indx in range(0,len(sorted)): 612 613 for col_indx in range(0,10): 396 for row_indx in range(0, len(sorted)): 397 for col_indx in range(0, 10): 614 398 row = sorted[row_indx] 615 399 value = row[col_indx] 616 400 if col_indx == 7: 617 self.tableWidget.setItem(row_indx, col_indx, QtGui.QTableWidgetItem(str("%.1e" % value)))401 self.tableWidget.setItem(row_indx, col_indx, self.MyTableWidgetItem(str("%.1e" % value), col_indx)) 618 402 else: 619 self.tableWidget.setItem(row_indx, col_indx, QtGui.QTableWidgetItem(str(value))) 620 621 622 623 def sort_order(self): 624 625 sorted = 0 626 fnx_mn = self.nx_min.value() 627 fnx_mx = self.nx_max.value() 628 fny_mn = self.ny_min.value() 629 fny_mx = self.ny_max.value() 630 fnz_mn = self.nz_min.value() 631 fnz_mx = self.nz_max.value() 632 fnpex_mn = self.npex_min.value() 633 fnpex_mx = self.npex_max.value() 634 fnpey_mn = self.npex_min.value() 635 fnpey_mx = self.npey_max.value() 636 fnpxnpy_mn = self.npxnpy_min.value() 637 fnpxnpy_mx = self.npxnpy_max.value() 638 fnp_mn = self.np_min.value() 639 fnp_mx = self.np_max.value() 640 fngpts_mn = self.ngpts_min.value() 641 fngpts_mx = self.ngpts_max.value() 642 643 if str(self.Sortvariable_box.currentIndex()) == str(1): 644 645 646 sorted_col = "nx" 647 if str(self.Sortvariable_box.currentIndex()) == str(2): 648 649 sorted_col = "ny" 650 if str(self.Sortvariable_box.currentIndex()) == str(3): 651 652 sorted_col = "nz" 653 if str(self.Sortvariable_box.currentIndex()) == str(4): 654 655 sorted_col = "npex" 656 if str(self.Sortvariable_box.currentIndex()) == str(5): 657 658 sorted_col = "npey" 659 if str(self.Sortvariable_box.currentIndex()) == str(6): 660 661 sorted_col = "npxnpy" 662 if str(self.Sortvariable_box.currentIndex()) == str(7): 663 664 sorted_col = "np" 665 if str(self.Sortvariable_box.currentIndex()) == str(8): 666 667 sorted_col = "ngpts" 668 669 #print(self.Sortvariable_box.currentIndex()) 670 671 if str(self.Sortorder_box.currentIndex()) == str(1): 672 673 order = " ASC" 674 675 if str(self.Sortorder_box.currentIndex()) == str(2): 676 677 order = " DESC" 678 679 680 681 conn = sqlite3.connect("/localdata/.palm_gf_data.db") 682 c = conn.cursor() 683 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) + 684 " AND nz >= " + str(fnz_mn) + " AND npex <= " + str(fnpex_mx) + " AND npex >= " + 685 str(fnpex_mn) + " AND npey <= " + str(fnpey_mx) + " AND npey >= " + str(fnpey_mn) + " AND " 686 "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) + 687 " ORDER BY " + str(sorted_col) + str(order)) 688 689 690 691 sorted = c.fetchall() 692 693 c.close() 694 conn.close() 695 self.tableWidget.setRowCount(len(sorted)) 696 697 for row_indx in range(0,len(sorted)): 698 699 for col_indx in range(0,8): 700 row = sorted[row_indx] 701 value = row[col_indx] 702 self.tableWidget.setItem(row_indx, col_indx, QtGui.QTableWidgetItem(str(var))) 703 704 705 706 707 708 709 #print(len(sorted)) 710 #print(sorted) 711 712 def get_path(wildcard): 713 import wx 714 app = wx.App(None) 715 style = wx.FD_OPEN | wx.FD_FILE_MUST_EXIST 716 dialog = wx.FileDialog(None, 'Open', wildcard='*.db') 717 if dialog.ShowModal() == wx.ID_OK: 718 path = dialog.GetPath() 719 720 print(path, file) 721 else: 722 path = None 723 dialog.Destroy() 724 return 725 726 727 728 729 730 731 732 733 403 self.tableWidget.setItem(row_indx, col_indx, self.MyTableWidgetItem(str(value), col_indx)) 404 405 self.status_label.setText(str(len(sorted)) + ' results found') 406 407 def save_dialog(self): 408 # calling native PyQt5 Dialog to get desired save path 409 options = QFileDialog.Options() 410 options |= QFileDialog.DontUseNativeDialog 411 fileName, _ = QFileDialog.getSaveFileName(self, "Save .txt File", ".txt", 412 "All Files (*.txt);;Text Files (*.txt)", options=options) 413 if fileName: 414 return fileName 415 416 def save(self): 417 # saves the file 418 # try because QFileDialog could be closed without choosing path 419 try: 420 if len(self.tableWidget.selectedItems()) != 0: 421 location = self.save_dialog() 422 data2safe = self.tableWidget.selectedItems() 423 if location is not None: 424 with open(location, 'w') as file: 425 file.write('nx ' + 'ny ' + 'nz ' + 'npex ' + 'npey' + "\n") 426 for row in range(0, int(len(data2safe)), 10): 427 file.write(str(data2safe[0+row].text()) + ' ' + str(data2safe[1+row].text()) + ' ' + 428 str(data2safe[2+row].text()) + ' ' + str(data2safe[3+row].text()) + ' ' + 429 str(data2safe[4+row].text()) + "\n") 430 file.close() 431 else: 432 self.status_label.setText('Select to save') 433 except AttributeError: 434 pass 734 435 735 436 736 437 if __name__ == "__main__": 737 app = Qt Gui.QApplication(sys.argv)738 window = My App3()739 window.setWindowTitle(' Gridfilter')438 app = QtWidgets.QApplication(sys.argv) 439 window = MyTable() 440 window.setWindowTitle('palm_gf Table') 740 441 window.show() 741 442 sys.exit(app.exec_()) 742
Note: See TracChangeset
for help on using the changeset viewer.