Changeset 2308 for palm/trunk/SCRIPTS/palm_gf_files
- Timestamp:
- Jul 10, 2017 12:15:43 PM (7 years ago)
- Location:
- palm/trunk/SCRIPTS/palm_gf_files
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SCRIPTS/palm_gf_files/palm_gf.ui
r2116 r2308 6 6 <enum>Qt::WindowModal</enum> 7 7 </property> 8 <property name="enabled"> 9 <bool>true</bool> 10 </property> 8 11 <property name="geometry"> 9 12 <rect> … … 11 14 <y>0</y> 12 15 <width>584</width> 13 <height>3 75</height>16 <height>386</height> 14 17 </rect> 15 18 </property> … … 82 85 <item> 83 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> 84 90 <property name="minimum"> 85 91 <number>1</number> … … 92 98 <item> 93 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> 94 103 <property name="minimum"> 95 104 <number>1</number> … … 102 111 <item> 103 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> 104 116 <property name="minimum"> 105 117 <number>1</number> … … 124 136 <item> 125 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> 126 150 <property name="minimum"> 127 151 <number>1</number> … … 134 158 <item> 135 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> 136 163 <property name="minimum"> 137 164 <number>1</number> … … 144 171 <item> 145 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> 146 176 <property name="minimum"> 147 177 <number>1</number> … … 162 192 <height>22</height> 163 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> 164 197 </property> 165 198 <property name="maximum"> … … 239 272 </property> 240 273 <property name="text"> 241 <string> n y</string>274 <string> nz</string> 242 275 </property> 243 276 <property name="scaledContents"> … … 270 303 </property> 271 304 <property name="text"> 272 <string> n z</string>305 <string> ny</string> 273 306 </property> 274 307 </widget> … … 297 330 <property name="text"> 298 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> 299 351 </property> 300 352 </widget> … … 306 358 <y>0</y> 307 359 <width>211</width> 308 <height>2 01</height>360 <height>221</height> 309 361 </rect> 310 362 </property> … … 399 451 <x>22</x> 400 452 <y>94</y> 401 <width> 51</width>453 <width>61</width> 402 454 <height>21</height> 403 455 </rect> … … 405 457 <property name="text"> 406 458 <string>Maximum</string> 407 </property>408 </widget>409 <widget class="QLabel" name="label_8">410 <property name="geometry">411 <rect>412 <x>16</x>413 <y>130</y>414 <width>89</width>415 <height>27</height>416 </rect>417 </property>418 <property name="toolTip">419 <string><html><head/><body><p>Tasks per node. Default value: 24</p><p>If Tasks / Node = 0 , option is deactivated (not recommended).</p></body></html></string>420 </property>421 <property name="text">422 <string>Tasks / Node</string>423 </property>424 </widget>425 <widget class="QLabel" name="label_10">426 <property name="geometry">427 <rect>428 <x>16</x>429 <y>164</y>430 <width>89</width>431 <height>21</height>432 </rect>433 </property>434 <property name="toolTip">435 <string><html><head/><body><p>Ratio between number of processors in X- and Y-direction.</p><p>If npex / npey = 0,00 , option is deactivated.</p></body></html></string>436 </property>437 <property name="text">438 <string>npex / npey</string>439 459 </property> 440 460 </widget> … … 466 486 </size> 467 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> 468 491 <property name="minimum"> 469 492 <number>1</number> … … 500 523 </size> 501 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> 502 528 <property name="minimum"> 503 529 <number>1</number> … … 507 533 </property> 508 534 </widget> 509 <widget class="Q SpinBox" name="tpn_box">510 <property name="geometry"> 511 <rect> 512 <x>1 10</x>535 <widget class="QWidget" name="layoutWidget"> 536 <property name="geometry"> 537 <rect> 538 <x>10</x> 513 539 <y>130</y> 514 <width>72</width> 515 <height>25</height> 516 </rect> 517 </property> 518 <property name="sizePolicy"> 519 <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> 520 <horstretch>0</horstretch> 521 <verstretch>0</verstretch> 522 </sizepolicy> 523 </property> 524 <property name="minimumSize"> 525 <size> 526 <width>72</width> 527 <height>25</height> 528 </size> 529 </property> 530 <property name="maximumSize"> 531 <size> 532 <width>72</width> 533 <height>25</height> 534 </size> 535 </property> 536 <property name="maximum"> 537 <number>10000</number> 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> 538 602 </property> 539 603 <property name="value"> 540 <number>24</number> 541 </property> 542 </widget> 543 <widget class="QDoubleSpinBox" name="d_box"> 544 <property name="geometry"> 545 <rect> 546 <x>110</x> 547 <y>162</y> 548 <width>72</width> 549 <height>25</height> 550 </rect> 551 </property> 552 <property name="sizePolicy"> 553 <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> 554 <horstretch>0</horstretch> 555 <verstretch>0</verstretch> 556 </sizepolicy> 557 </property> 558 <property name="minimumSize"> 559 <size> 560 <width>72</width> 561 <height>25</height> 562 </size> 563 </property> 564 <property name="maximumSize"> 565 <size> 566 <width>72</width> 567 <height>25</height> 568 </size> 569 </property> 570 <property name="maximum"> 571 <double>1000.000000000000000</double> 572 </property> 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> 573 669 </widget> 574 670 </widget> … … 665 761 <item> 666 762 <property name="text"> 667 <string>multigrid </string>763 <string>multigrid_noopt</string> 668 764 </property> 669 765 </item> 670 766 <item> 671 767 <property name="text"> 672 <string>multigrid _fast</string>768 <string>multigrid</string> 673 769 </property> 674 770 </item> … … 846 942 <rect> 847 943 <x>380</x> 848 <y>2 20</y>944 <y>240</y> 849 945 <width>197</width> 850 946 <height>31</height> … … 865 961 <rect> 866 962 <x>370</x> 867 <y> 180</y>963 <y>218</y> 868 964 <width>179</width> 869 <height> 59</height>965 <height>20</height> 870 966 </rect> 871 967 </property> … … 876 972 </font> 877 973 </property> 974 <property name="toolTip"> 975 <string><html><head/><body><p>tolerance for npex / npey</p></body></html></string> 976 </property> 878 977 <property name="text"> 879 978 <string>Results</string> 880 </property>881 </widget>882 <widget class="Line" name="line_res_up">883 <property name="geometry">884 <rect>885 <x>360</x>886 <y>190</y>887 <width>201</width>888 <height>20</height>889 </rect>890 </property>891 <property name="orientation">892 <enum>Qt::Horizontal</enum>893 979 </property> 894 980 </widget> … … 897 983 <rect> 898 984 <x>360</x> 899 <y> 280</y>985 <y>300</y> 900 986 <width>201</width> 901 987 <height>20</height> … … 910 996 <rect> 911 997 <x>490</x> 912 <y>2 61</y>998 <y>281</y> 913 999 <width>75</width> 914 1000 <height>23</height> … … 925 1011 </property> 926 1012 </widget> 927 <widget class="QTableWidget" name="tableWidget">928 <property name="geometry">929 <rect>930 <x>10</x>931 <y>340</y>932 <width>491</width>933 <height>241</height>934 </rect>935 </property>936 <property name="sizePolicy">937 <sizepolicy hsizetype="Maximum" vsizetype="Expanding">938 <horstretch>0</horstretch>939 <verstretch>0</verstretch>940 </sizepolicy>941 </property>942 <property name="maximumSize">943 <size>944 <width>900</width>945 <height>16777215</height>946 </size>947 </property>948 <property name="layoutDirection">949 <enum>Qt::LeftToRight</enum>950 </property>951 <property name="frameShape">952 <enum>QFrame::Box</enum>953 </property>954 <property name="frameShadow">955 <enum>QFrame::Sunken</enum>956 </property>957 <property name="lineWidth">958 <number>1</number>959 </property>960 <property name="horizontalScrollBarPolicy">961 <enum>Qt::ScrollBarAlwaysOff</enum>962 </property>963 <property name="showGrid">964 <bool>true</bool>965 </property>966 <property name="sortingEnabled">967 <bool>true</bool>968 </property>969 <attribute name="horizontalHeaderVisible">970 <bool>true</bool>971 </attribute>972 <attribute name="horizontalHeaderCascadingSectionResizes">973 <bool>false</bool>974 </attribute>975 <attribute name="horizontalHeaderDefaultSectionSize">976 <number>80</number>977 </attribute>978 <column>979 <property name="text">980 <string>np</string>981 </property>982 </column>983 <column>984 <property name="text">985 <string>npex</string>986 </property>987 </column>988 <column>989 <property name="text">990 <string>npey</string>991 </property>992 </column>993 <column>994 <property name="text">995 <string>nx</string>996 </property>997 </column>998 <column>999 <property name="text">1000 <string>ny</string>1001 </property>1002 </column>1003 <column>1004 <property name="text">1005 <string>nz</string>1006 </property>1007 </column>1008 </widget>1009 1013 <widget class="QLabel" name="load_text_label"> 1010 1014 <property name="geometry"> 1011 1015 <rect> 1012 1016 <x>379</x> 1013 <y>2 61</y>1017 <y>281</y> 1014 1018 <width>42</width> 1015 1019 <height>23</height> … … 1042 1046 <rect> 1043 1047 <x>420</x> 1044 <y>2 61</y>1048 <y>281</y> 1045 1049 <width>61</width> 1046 1050 <height>23</height> … … 1067 1071 <rect> 1068 1072 <x>490</x> 1069 <y>3 04</y>1073 <y>324</y> 1070 1074 <width>75</width> 1071 1075 <height>23</height> … … 1101 1105 <rect> 1102 1106 <x>415</x> 1103 <y>3 04</y>1107 <y>324</y> 1104 1108 <width>75</width> 1105 1109 <height>23</height> … … 1120 1124 <height>18</height> 1121 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> 1134 <height>23</height> 1135 </rect> 1136 </property> 1137 <property name="value"> 1138 <number>0</number> 1139 </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> 1122 1152 </property> 1123 1153 </widget> … … 1129 1159 <y>0</y> 1130 1160 <width>584</width> 1131 <height>2 1</height>1161 <height>20</height> 1132 1162 </rect> 1133 1163 </property> … … 1136 1166 <string>Gridfinder</string> 1137 1167 </property> 1168 <addaction name="actionSetting"/> 1138 1169 <addaction name="actionSchlie_en"/> 1139 1170 </widget> … … 1144 1175 <property name="text"> 1145 1176 <string>SchlieÃen</string> 1177 </property> 1178 </action> 1179 <action name="actionSetting"> 1180 <property name="text"> 1181 <string>Settings</string> 1146 1182 </property> 1147 1183 </action> … … 1167 1203 <tabstop>quitbutton</tabstop> 1168 1204 <tabstop>filename_line</tabstop> 1169 <tabstop>tableWidget</tabstop>1170 1205 <tabstop>Oos_checkbox</tabstop> 1171 1206 </tabstops> … … 1188 1223 </hints> 1189 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> 1318 </hint> 1319 </hints> 1320 </connection> 1190 1321 </connections> 1191 1322 </ui> -
palm/trunk/SCRIPTS/palm_gf_files/palm_gf_conf.py
r2116 r2308 1 def write_config(np_min, np_max, nx_min, nx_max, ny_min, ny_max, nz_min, nz_max, tpn, dnpexnpey, dn xny, poisfft, switch,2 temperton, mlt_grid, spectr ):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 3 #from configparser import ConfigParser # windows 4 4 from ConfigParser import ConfigParser # Linux … … 7 7 cfg = ConfigParser() 8 8 9 cfg.add_section("processor_topology") 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") 10 16 cfg.set("processor_topology", "np_min", np_min) 11 17 cfg.set("processor_topology", "np_max", np_max) 12 18 cfg.set("processor_topology", "tasks_per_node", tpn) 13 19 cfg.set("processor_topology", "dnpexnpey", dnpexnpey) 20 cfg.set("processor_topology", "dnpexnpey_tolerance", dnpexnpey_tolerance) 14 21 cfg.set("processor_topology", "dnxny", dnxny) 15 22 16 cfg.add_section("numerical_grid")23 #cfgadd_section("numerical_grid"). 17 24 cfg.set("numerical_grid", "nx_min", nx_min) 18 25 cfg.set("numerical_grid", "nx_max", nx_max) … … 22 29 cfg.set("numerical_grid", "nz_max", nz_max) 23 30 24 cfg.add_section("method")31 #cfg.add_section("method") 25 32 cfg.set("method", "poisfft", poisfft) 26 33 cfg.set("method", "switch", switch) … … 29 36 cfg.set("method", "spectr", spectr) 30 37 31 with open(".palm_gf_config", "w") as configfile: 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) 42 43 44 with open(".palm_gf_config", "a") as configfile: 32 45 cfg.write(configfile) 33 46 … … 36 49 #from configparser import ConfigParser # windows 37 50 from ConfigParser import ConfigParser # Linux 51 38 52 39 53 cfg = ConfigParser() … … 44 58 tpn = cfg.get("processor_topology", "tasks_per_node") 45 59 dnpexnpey = cfg.get("processor_topology", "dnpexnpey") 60 dnpexnpey_tolerance = cfg.get("processor_topology", "dnpexnpey_tolerance") 46 61 dnxny = cfg.get("processor_topology", "dnxny") 47 62 … … 59 74 spectr = cfg.get("method", "spectr") 60 75 61 return np_min, np_max, tpn, dnpexnpey, dnxny, nx_min, nx_max, ny_min, ny_max, nz_min, nz_max, poisfft, switch, temperton, mlt_grid, spectr 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 -
palm/trunk/SCRIPTS/palm_gf_files/palm_gf_exec.py
r2116 r2308 6 6 c.execute("DROP TABLE IF EXISTS grid_current") 7 7 c.execute("DROP TABLE IF EXISTS grid_limits") 8 #c.execute("CREATE TABLE IF NOT EXISTS grid_current(np INT, npex INT, npey INT, nx INT, ny INT, nz INT)")9 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)") 10 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)") … … 56 55 57 56 print(spectr, type(spectr)) 58 results = open(".palm_gf_results", "w")59 57 print(poisfft, switch, tempterton, mlt_grid, spectr) 60 58 … … 177 175 178 176 npxnpy = format(float(npex)/float(npey), '.2f') 179 results.write(180 str(" npex: ") + str(npex) + str(" npey: ") + str(npey) + str(" nx: ") + str(nx) + str(181 " ny: ") + str(ny) + str(" nz: ") + str(nz) + "\n")182 177 c.execute("""INSERT OR REPLACE INTO grid_current(nx, ny, nz, npex, npey, npxnpy, np, ngpts) VALUES (?, ?, ?, ?, ?, ?, ?, ?)""", 183 178 (nx, ny, nz, npex, npey, npxnpy, (npex * npey), (nx*ny*nz))) 184 #print(npxnpy) 185 186 nz += 1 179 180 nz += 11 187 181 nz = nz_min 188 182 ny += 1 … … 198 192 199 193 200 results.close()201 194 conn.commit() 202 195 c.close() -
palm/trunk/SCRIPTS/palm_gf_files/palm_gf_table.ui
r2116 r2308 7 7 <x>0</x> 8 8 <y>0</y> 9 <width>8 22</width>10 <height>4 83</height>9 <width>817</width> 10 <height>439</height> 11 11 </rect> 12 12 </property> … … 14 14 <string>Dialog</string> 15 15 </property> 16 <widget class="QPushButton" name="pushButton">17 <property name="geometry">18 <rect>19 <x>19</x>20 <y>79</y>21 <width>80</width>22 <height>27</height>23 </rect>24 </property>25 <property name="text">26 <string>Execute filter</string>27 </property>28 </widget>29 <widget class="QPushButton" name="pushButton_2">30 <property name="geometry">31 <rect>32 <x>19</x>33 <y>107</y>34 <width>80</width>35 <height>27</height>36 </rect>37 </property>38 <property name="text">39 <string>Reset limits</string>40 </property>41 </widget>42 16 <widget class="QTableWidget" name="tableWidget"> 43 17 <property name="geometry"> 44 18 <rect> 45 <x> 2</x>46 <y>1 71</y>19 <x>5</x> 20 <y>166</y> 47 21 <width>805</width> 48 22 <height>266</height> … … 61 35 <enum>Qt::ScrollBarAlwaysOff</enum> 62 36 </property> 37 <property name="autoScroll"> 38 <bool>true</bool> 39 </property> 63 40 <property name="dragEnabled"> 64 41 <bool>false</bool> … … 67 44 <bool>false</bool> 68 45 </property> 46 <property name="selectionMode"> 47 <enum>QAbstractItemView::MultiSelection</enum> 48 </property> 69 49 <property name="selectionBehavior"> 70 <enum>QAbstractItemView::Select Rows</enum>50 <enum>QAbstractItemView::SelectItems</enum> 71 51 </property> 72 52 <property name="sortingEnabled"> … … 76 56 <number>8</number> 77 57 </property> 58 <attribute name="horizontalHeaderVisible"> 59 <bool>false</bool> 60 </attribute> 61 <attribute name="horizontalHeaderShowSortIndicator" stdset="0"> 62 <bool>true</bool> 63 </attribute> 78 64 <attribute name="verticalHeaderVisible"> 79 65 <bool>false</bool> … … 117 103 <column> 118 104 <property name="text"> 119 <string >nx</string>105 <string/> 120 106 </property> 121 107 </column> 122 108 <column> 123 109 <property name="text"> 124 <string >ny</string>110 <string/> 125 111 </property> 126 112 </column> 127 113 <column> 128 114 <property name="text"> 129 <string >nz</string>115 <string/> 130 116 </property> 131 117 </column> 132 118 <column> 133 119 <property name="text"> 134 <string >npex</string>120 <string/> 135 121 </property> 136 122 </column> 137 123 <column> 138 124 <property name="text"> 139 <string >npey</string>125 <string/> 140 126 </property> 141 127 </column> 142 128 <column> 143 129 <property name="text"> 144 <string >npex/npey</string>130 <string/> 145 131 </property> 146 132 </column> 147 133 <column> 148 134 <property name="text"> 149 <string >np</string>135 <string/> 150 136 </property> 151 137 </column> 152 138 <column> 153 139 <property name="text"> 154 <string >ngpts</string>140 <string/> 155 141 </property> 156 142 </column> 157 <item row="0" column="0">158 <property name="text">159 <string/>160 </property>161 </item>162 <item row="1" column="0">163 <property name="text">164 <string/>165 </property>166 </item>167 <item row="2" column="0">168 <property name="text">169 <string/>170 </property>171 </item>172 <item row="3" column="0">173 <property name="text">174 <string/>175 </property>176 </item>177 <item row="4" column="0">178 <property name="text">179 <string/>180 </property>181 </item>182 <item row="5" column="0">183 <property name="text">184 <string/>185 </property>186 </item>187 <item row="6" column="0">188 <property name="text">189 <string/>190 </property>191 </item>192 </widget>193 <widget class="QPushButton" name="pushButton_3">194 <property name="geometry">195 <rect>196 <x>19</x>197 <y>51</y>198 <width>80</width>199 <height>27</height>200 </rect>201 </property>202 <property name="text">203 <string>Load all</string>204 </property>205 143 </widget> 206 144 <widget class="Line" name="line"> … … 848 786 </property> 849 787 </widget> 850 <widget class="QComboBox" name="Sortvariable_box">851 <property name="geometry">852 <rect>853 <x>146</x>854 <y>140</y>855 <width>111</width>856 <height>23</height>857 </rect>858 </property>859 <item>860 <property name="text">861 <string>Sorting...</string>862 </property>863 </item>864 <item>865 <property name="text">866 <string>nx</string>867 </property>868 </item>869 <item>870 <property name="text">871 <string>ny</string>872 </property>873 </item>874 <item>875 <property name="text">876 <string>nz</string>877 </property>878 </item>879 <item>880 <property name="text">881 <string>npex</string>882 </property>883 </item>884 <item>885 <property name="text">886 <string>npey</string>887 </property>888 </item>889 <item>890 <property name="text">891 <string>npex/npey</string>892 </property>893 </item>894 <item>895 <property name="text">896 <string>np</string>897 </property>898 </item>899 <item>900 <property name="text">901 <string>ngpts</string>902 </property>903 </item>904 </widget>905 <widget class="QComboBox" name="Sortorder_box">906 <property name="geometry">907 <rect>908 <x>260</x>909 <y>140</y>910 <width>101</width>911 <height>23</height>912 </rect>913 </property>914 <item>915 <property name="text">916 <string>Order...</string>917 </property>918 </item>919 <item>920 <property name="text">921 <string>Ascending</string>922 </property>923 </item>924 <item>925 <property name="text">926 <string>Descending</string>927 </property>928 </item>929 </widget>930 <widget class="QPushButton" name="Sortnow_button">931 <property name="geometry">932 <rect>933 <x>365</x>934 <y>140</y>935 <width>90</width>936 <height>23</height>937 </rect>938 </property>939 <property name="text">940 <string>Sort now</string>941 </property>942 </widget>943 788 <widget class="QLabel" name="label_3"> 944 789 <property name="geometry"> … … 1191 1036 <string> ngpts</string> 1192 1037 </property> 1038 </widget> 1039 <widget class="QPushButton" name="nx_table"> 1040 <property name="geometry"> 1041 <rect> 1042 <x>6</x> 1043 <y>149</y> 1044 <width>102</width> 1045 <height>23</height> 1046 </rect> 1047 </property> 1048 <property name="text"> 1049 <string>nx</string> 1050 </property> 1051 <property name="checkable"> 1052 <bool>true</bool> 1053 </property> 1054 <property name="autoRepeat"> 1055 <bool>false</bool> 1056 </property> 1057 <property name="autoDefault"> 1058 <bool>true</bool> 1059 </property> 1060 <property name="default"> 1061 <bool>false</bool> 1062 </property> 1063 <property name="flat"> 1064 <bool>false</bool> 1065 </property> 1066 </widget> 1067 <widget class="QPushButton" name="ny_table"> 1068 <property name="geometry"> 1069 <rect> 1070 <x>105</x> 1071 <y>149</y> 1072 <width>104</width> 1073 <height>23</height> 1074 </rect> 1075 </property> 1076 <property name="text"> 1077 <string>ny</string> 1078 </property> 1079 <property name="checkable"> 1080 <bool>true</bool> 1081 </property> 1082 </widget> 1083 <widget class="QPushButton" name="nz_table"> 1084 <property name="geometry"> 1085 <rect> 1086 <x>206</x> 1087 <y>149</y> 1088 <width>102</width> 1089 <height>23</height> 1090 </rect> 1091 </property> 1092 <property name="text"> 1093 <string>nz</string> 1094 </property> 1095 <property name="checkable"> 1096 <bool>true</bool> 1097 </property> 1098 </widget> 1099 <widget class="QPushButton" name="npex_table"> 1100 <property name="geometry"> 1101 <rect> 1102 <x>305</x> 1103 <y>149</y> 1104 <width>103</width> 1105 <height>23</height> 1106 </rect> 1107 </property> 1108 <property name="text"> 1109 <string>npex</string> 1110 </property> 1111 <property name="checkable"> 1112 <bool>true</bool> 1113 </property> 1114 <property name="autoRepeat"> 1115 <bool>false</bool> 1116 </property> 1117 </widget> 1118 <widget class="QPushButton" name="npey_table"> 1119 <property name="geometry"> 1120 <rect> 1121 <x>405</x> 1122 <y>149</y> 1123 <width>104</width> 1124 <height>23</height> 1125 </rect> 1126 </property> 1127 <property name="text"> 1128 <string>npey</string> 1129 </property> 1130 <property name="checkable"> 1131 <bool>true</bool> 1132 </property> 1133 </widget> 1134 <widget class="QPushButton" name="npexnpey_table"> 1135 <property name="geometry"> 1136 <rect> 1137 <x>506</x> 1138 <y>149</y> 1139 <width>102</width> 1140 <height>23</height> 1141 </rect> 1142 </property> 1143 <property name="text"> 1144 <string>npex/npey</string> 1145 </property> 1146 <property name="checkable"> 1147 <bool>true</bool> 1148 </property> 1149 </widget> 1150 <widget class="QPushButton" name="np_table"> 1151 <property name="geometry"> 1152 <rect> 1153 <x>605</x> 1154 <y>149</y> 1155 <width>103</width> 1156 <height>23</height> 1157 </rect> 1158 </property> 1159 <property name="text"> 1160 <string>np</string> 1161 </property> 1162 <property name="checkable"> 1163 <bool>true</bool> 1164 </property> 1165 </widget> 1166 <widget class="QPushButton" name="ngpts_table"> 1167 <property name="geometry"> 1168 <rect> 1169 <x>705</x> 1170 <y>149</y> 1171 <width>104</width> 1172 <height>23</height> 1173 </rect> 1174 </property> 1175 <property name="text"> 1176 <string>ngpts</string> 1177 </property> 1178 <property name="checkable"> 1179 <bool>true</bool> 1180 </property> 1181 </widget> 1182 <widget class="QWidget" name="layoutWidget"> 1183 <property name="geometry"> 1184 <rect> 1185 <x>5</x> 1186 <y>25</y> 1187 <width>97</width> 1188 <height>106</height> 1189 </rect> 1190 </property> 1191 <layout class="QVBoxLayout" name="verticalLayout"> 1192 <item> 1193 <widget class="QPushButton" name="save_to_file_button"> 1194 <property name="enabled"> 1195 <bool>false</bool> 1196 </property> 1197 <property name="toolTip"> 1198 <string><html><head/><body><p>Currently Disabled</p></body></html></string> 1199 </property> 1200 <property name="text"> 1201 <string>Save to file</string> 1202 </property> 1203 </widget> 1204 </item> 1205 <item> 1206 <widget class="QPushButton" name="pushButton_3"> 1207 <property name="toolTip"> 1208 <string><html><head/><body><p>Loads all calculated results. </p></body></html></string> 1209 </property> 1210 <property name="text"> 1211 <string>Load all</string> 1212 </property> 1213 </widget> 1214 </item> 1215 <item> 1216 <widget class="QPushButton" name="pushButton"> 1217 <property name="text"> 1218 <string>Execute filter</string> 1219 </property> 1220 </widget> 1221 </item> 1222 <item> 1223 <widget class="QPushButton" name="pushButton_2"> 1224 <property name="text"> 1225 <string>Reset limits</string> 1226 </property> 1227 </widget> 1228 </item> 1229 </layout> 1193 1230 </widget> 1194 1231 </widget> … … 1212 1249 <tabstop>ngpts_max</tabstop> 1213 1250 <tabstop>pushButton</tabstop> 1214 <tabstop>Sortvariable_box</tabstop>1215 <tabstop>Sortorder_box</tabstop>1216 <tabstop>Sortnow_button</tabstop>1217 1251 <tabstop>pushButton_2</tabstop> 1218 1252 <tabstop>tableWidget</tabstop> -
palm/trunk/SCRIPTS/palm_gf_files/palm_gf_tools.py
r2116 r2308 4 4 from PyQt4 import QtCore, QtGui, uic 5 5 import subprocess as sub 6 import palm_gf_conf as configwr 6 7 7 8 out = sub.check_output("echo $PALM_BIN", shell=True, stderr=sub.STDOUT) … … 22 23 return self.sortKey < other.sortKey 23 24 24 25 25 def __init__(self): # def __init__(self, parent=None): 26 26 QtGui.QMainWindow.__init__(self) … … 31 31 centerpoint = QtGui.QApplication.desktop().screenGeometry(screen).center() 32 32 framegm.moveCenter(centerpoint) 33 34 #centerpoint = str(centerpoint) 35 #xcenter = centerpoint.split('(')[1].split(',')[0] 36 #ycenter = centerpoint.split('(')[1].split(',')[1].split(')')[0] 37 ##print xcenter, ycenter 38 #centerpoint = QtCore.QPoint(int(xcenter) + 418, int(ycenter)) 39 #framegm.moveCenter(centerpoint) 33 40 self.move(framegm.topLeft()) 41 42 43 34 44 self.setupUi(self) 35 45 self.pushButton_3.clicked.connect(self.load_result) … … 37 47 self.load_trigger() 38 48 self.pushButton.clicked.connect(self.filter_results) 39 self.Sortnow_button.clicked.connect(self.sort_order)49 #self.Sortnow_button.clicked.connect(self.sort_order) 40 50 self.pushButton_2.clicked.connect(self.load_trigger) 51 self.tableWidget.horizontalHeader().setClickable(True) 52 53 54 self.nx_table.clicked.connect(lambda: self.sort_table(str("nx"))) 55 self.ny_table.clicked.connect(lambda: self.sort_table(str("ny"))) 56 self.nz_table.clicked.connect(lambda: self.sort_table(str("nz"))) 57 self.npex_table.clicked.connect(lambda: self.sort_table(str("npex"))) 58 self.npey_table.clicked.connect(lambda: self.sort_table(str("npey"))) 59 self.npexnpey_table.clicked.connect(lambda: self.sort_table(str("npexnpey"))) 60 self.np_table.clicked.connect(lambda: self.sort_table(str("np"))) 61 self.ngpts_table.clicked.connect(lambda: self.sort_table(str("ngpts"))) 62 63 self.instant() 64 65 self.save_to_file_button.clicked.connect(self.get_path) 66 67 def instant(self): 68 checkfile = open(".palm_gf_tmp", "r") 69 # self.result_label.setText(str(checkfile.readline())) 70 res_text = str(checkfile.readline()) # XXX 71 result_nr = res_text.split(' ')[2] 72 checkfile.close() 73 if int(result_nr) < 100000: 74 self.load_result() 41 75 42 76 43 77 44 78 def load_trigger(self): 79 pathx = configwr.read_config() 80 pathx = pathx[19] 81 82 45 83 dtb = str('.palm_gf_data.db') 46 con = sqlite3.connect(dtb) 84 #con = sqlite3.connect("/localdata/.palm_gf_data.db") 85 con = sqlite3.connect(pathx + '.palm_gf_data.db') 47 86 c = con.cursor() 48 87 c.execute("SELECT * FROM " + 'grid_limits') … … 96 135 def check(self): 97 136 dtb = str('.palm_gf_data.db') 98 con = sqlite3.connect( dtb)137 con = sqlite3.connect("/localdata/.palm_gf_data.db") 99 138 c = con.cursor() 100 139 c.execute("SELECT * FROM " + 'grid_limits') … … 113 152 114 153 def load_result(self): 154 #print("LOADED!!!") 155 import decimal 115 156 self.setEnabled(False) 116 157 QtGui.QApplication.processEvents() … … 118 159 self.process1() 119 160 database = str('.palm_gf_data.db') 120 conn = sqlite3.connect( database)161 conn = sqlite3.connect("/localdata/.palm_gf_data.db") 121 162 c = conn.cursor() 122 163 c.execute("SELECT * FROM " + 'grid_current') … … 134 175 var = line[j] 135 176 136 self.tableWidget.setItem(i, j, self.MyTableWidgetItem(str(var), j+i)) 177 if j == 7: 178 self.tableWidget.setItem(i, j, self.MyTableWidgetItem(str("%.1e" % var), j + i)) 179 #print("%.2e" % int(var), "%.4e" % int(1782)) 180 181 else: 182 self.tableWidget.setItem(i, j, self.MyTableWidgetItem(str(var), j+i)) 137 183 #item = self.MyTableWidgetItem(str(var), k) 138 184 #self.tableWidget.setItem(i, j, item) … … 155 201 156 202 def filter_results(self): 203 157 204 self.setEnabled(False) 158 205 self.calc_label.setText('calculating...') 159 206 QtGui.QApplication.processEvents() 160 207 database = str('.palm_gf_data.db') 161 conn = sqlite3.connect( database)208 conn = sqlite3.connect("/localdata/.palm_gf_data.db") 162 209 c = conn.cursor() 163 210 c.execute("SELECT * FROM " + "grid_current") … … 208 255 while j < 8: 209 256 var = line[j] 210 self.tableWidget.setItem(row_cnt, j, self.MyTableWidgetItem(str(var), i)) 257 258 if j == 7: 259 self.tableWidget.setItem(row_cnt, j, self.MyTableWidgetItem(str("%.1e" % var), i)) 260 261 else: 262 self.tableWidget.setItem(row_cnt, j, self.MyTableWidgetItem(str(var), i)) 211 263 212 264 j += 1 … … 224 276 225 277 278 279 def sort_table(self, column): 280 281 fnx_mn = self.nx_min.value() 282 fnx_mx = self.nx_max.value() 283 fny_mn = self.ny_min.value() 284 fny_mx = self.ny_max.value() 285 fnz_mn = self.nz_min.value() 286 fnz_mx = self.nz_max.value() 287 fnpex_mn = self.npex_min.value() 288 fnpex_mx = self.npex_max.value() 289 fnpey_mn = self.npex_min.value() 290 fnpey_mx = self.npey_max.value() 291 fnpxnpy_mn = self.npxnpy_min.value() 292 fnpxnpy_mx = self.npxnpy_max.value() 293 fnp_mn = self.np_min.value() 294 fnp_mx = self.np_max.value() 295 fngpts_mn = self.ngpts_min.value() 296 fngpts_mx = self.ngpts_max.value() 297 298 if column == str("nx"): 299 sorted_col = "nx" 300 301 if self.nx_table.isChecked() is True: 302 order = " DESC" 303 304 else: 305 306 order = " ASC" 307 308 self.ny_table.setChecked(False) 309 self.nz_table.setChecked(False) 310 self.npex_table.setChecked(False) 311 self.npey_table.setChecked(False) 312 self.npexnpey_table.setChecked(False) 313 self.np_table.setChecked(False) 314 self.ngpts_table.setChecked(False) 315 316 if column == str("ny"): 317 sorted_col = "ny" 318 319 if self.ny_table.isChecked() is True: 320 order = " DESC" 321 322 else: 323 324 order = " ASC" 325 326 self.nx_table.setChecked(False) 327 self.nz_table.setChecked(False) 328 self.npex_table.setChecked(False) 329 self.npey_table.setChecked(False) 330 self.npexnpey_table.setChecked(False) 331 self.np_table.setChecked(False) 332 self.ngpts_table.setChecked(False) 333 334 if column == str("nz"): 335 sorted_col = "nz" 336 337 if self.nz_table.isChecked() is True: 338 order = " DESC" 339 340 else: 341 342 order = " ASC" 343 344 self.nx_table.setChecked(False) 345 self.ny_table.setChecked(False) 346 self.npex_table.setChecked(False) 347 self.npey_table.setChecked(False) 348 self.npexnpey_table.setChecked(False) 349 self.np_table.setChecked(False) 350 self.ngpts_table.setChecked(False) 351 352 if column == str("npex"): 353 sorted_col = "npex" 354 355 if self.npex_table.isChecked() is True: 356 order = " DESC" 357 358 else: 359 360 order = " ASC" 361 362 self.ny_table.setChecked(False) 363 self.nz_table.setChecked(False) 364 self.nx_table.setChecked(False) 365 self.npey_table.setChecked(False) 366 self.npexnpey_table.setChecked(False) 367 self.np_table.setChecked(False) 368 self.ngpts_table.setChecked(False) 369 370 if column == str("npey"): 371 sorted_col = "npey" 372 373 if self.npey_table.isChecked() is True: 374 order = " DESC" 375 376 else: 377 378 order = " ASC" 379 380 381 self.ny_table.setChecked(False) 382 self.nz_table.setChecked(False) 383 self.npex_table.setChecked(False) 384 self.nx_table.setChecked(False) 385 self.npexnpey_table.setChecked(False) 386 self.np_table.setChecked(False) 387 self.ngpts_table.setChecked(False) 388 389 if column == str("npexnpey"): 390 sorted_col = "npxnpy" 391 392 if self.npexnpey_table.isChecked() is True: 393 order = " DESC" 394 395 else: 396 397 order = " ASC" 398 399 self.ny_table.setChecked(False) 400 self.nz_table.setChecked(False) 401 self.npex_table.setChecked(False) 402 self.npey_table.setChecked(False) 403 self.nx_table.setChecked(False) 404 self.np_table.setChecked(False) 405 self.ngpts_table.setChecked(False) 406 407 if column == str("np"): 408 sorted_col = "np" 409 410 if self.np_table.isChecked() is True: 411 order = " DESC" 412 413 else: 414 415 order = " ASC" 416 417 self.ny_table.setChecked(False) 418 self.nz_table.setChecked(False) 419 self.npex_table.setChecked(False) 420 self.npey_table.setChecked(False) 421 self.npexnpey_table.setChecked(False) 422 self.nx_table.setChecked(False) 423 self.ngpts_table.setChecked(False) 424 425 if column == str("ngpts"): 426 sorted_col = "ngpts" 427 428 if self.ngpts_table.isChecked() is True: 429 order = " DESC" 430 431 else: 432 433 order = " ASC" 434 435 self.ny_table.setChecked(False) 436 self.nz_table.setChecked(False) 437 self.npex_table.setChecked(False) 438 self.npey_table.setChecked(False) 439 self.npexnpey_table.setChecked(False) 440 self.np_table.setChecked(False) 441 self.nx_table.setChecked(False) 442 443 444 445 conn = sqlite3.connect("/localdata/.palm_gf_data.db") 446 c = conn.cursor() 447 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) + 448 " AND nz >= " + str(fnz_mn) + " AND npex <= " + str(fnpex_mx) + " AND npex >= " + 449 str(fnpex_mn) + " AND npey <= " + str(fnpey_mx) + " AND npey >= " + str(fnpey_mn) + " AND " 450 "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) + 451 " ORDER BY " + str(sorted_col) + str(order)) 452 453 454 455 sorted = c.fetchall() 456 457 c.close() 458 conn.close() 459 self.tableWidget.setRowCount(len(sorted)) 460 461 for row_indx in range(0,len(sorted)): 462 463 for col_indx in range(0,8): 464 row = sorted[row_indx] 465 value = row[col_indx] 466 if col_indx == 7: 467 self.tableWidget.setItem(row_indx, col_indx, QtGui.QTableWidgetItem(str("%.1e" % value))) 468 else: 469 self.tableWidget.setItem(row_indx, col_indx, QtGui.QTableWidgetItem(str(value))) 226 470 227 471 … … 273 517 sorted_col = "ngpts" 274 518 275 print(self.Sortvariable_box.currentIndex())519 #print(self.Sortvariable_box.currentIndex()) 276 520 277 521 if str(self.Sortorder_box.currentIndex()) == str(1): … … 285 529 286 530 287 288 289 290 291 292 conn = sqlite3.connect(".palm_gf_data.db") 531 conn = sqlite3.connect("/localdata/.palm_gf_data.db") 293 532 c = conn.cursor() 294 533 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) + … … 311 550 row = sorted[row_indx] 312 551 value = row[col_indx] 313 self.tableWidget.setItem(row_indx, col_indx, QtGui.QTableWidgetItem(str(va lue)))314 315 316 317 318 319 320 print(len(sorted))552 self.tableWidget.setItem(row_indx, col_indx, QtGui.QTableWidgetItem(str(var))) 553 554 555 556 557 558 559 #print(len(sorted)) 321 560 #print(sorted) 561 562 def get_path(wildcard): 563 import wx 564 app = wx.App(None) 565 style = wx.FD_OPEN | wx.FD_FILE_MUST_EXIST 566 dialog = wx.FileDialog(None, 'Open', wildcard='*.db') 567 if dialog.ShowModal() == wx.ID_OK: 568 path = dialog.GetPath() 569 570 print(path, file) 571 else: 572 path = None 573 dialog.Destroy() 574 return 575 576 577 578 579 580 581 322 582 323 583
Note: See TracChangeset
for help on using the changeset viewer.