Changeset 2309 for palm/trunk/SCRIPTS


Ignore:
Timestamp:
Jul 10, 2017 3:55:55 PM (7 years ago)
Author:
gronemeier
Message:

some further bugfixes for palm_gf

Location:
palm/trunk/SCRIPTS
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SCRIPTS/palm_gf

    r2308 r2309  
    422422        c.execute("DROP TABLE IF EXISTS grid_limits")
    423423        c.execute(
    424             "CREATE TABLE IF NOT EXISTS grid_current(nx INT, ny INT, nz INT, npex INT, npey INT, npxnpy FLOAT, np INT, ngpts INT)")
     424            "CREATE TABLE IF NOT EXISTS grid_current(nx INT, ny INT, nz INT, npex INT, npey INT, npxnpy FLOAT, np INT, ngpts INT, nxnpex FLOAT, nynpey FLOAT)")
    425425        c.execute(
    426             "CREATE TABLE IF NOT EXISTS grid_limits(nx INT, ny INT, nz INT, npex INT, npey INT, npxnpy FLOAT, np INT, ngpts INT)")
     426            "CREATE TABLE IF NOT EXISTS grid_limits(nx INT, ny INT, nz INT, npex INT, npey INT, npxnpy FLOAT, np INT, ngpts INT, nxnpex FLOAT, nynpey FLOAT)")
    427427        conn.commit()
    428428        main_bool = True
     
    591591
    592592                                npxnpy = format(float(npex) / float(npey), '.2f')
     593                                nxpex = float(nx+1) /float(npex)
     594                                nypey = float(ny+1) /float(npey)
     595
    593596                                c.execute(
    594                                     """INSERT OR REPLACE INTO grid_current(nx, ny, nz, npex, npey, npxnpy, np, ngpts) VALUES (?, ?, ?, ?, ?, ?, ?, ?)""",
    595                                     (nx, ny, nz, npex, npey, npxnpy, (npex * npey), (nx * ny * nz)))
     597                                    """INSERT OR REPLACE INTO grid_current(nx, ny, nz, npex, npey, npxnpy, np, ngpts, nxnpex, nynpey) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""",
     598                                    (nx, ny, nz, npex, npey, npxnpy, (npex * npey), (nx * ny * nz), nxpex, nypey))
    596599
    597600                                nz += 1
     
    669672            mn_ngpts = c.fetchone()[0]
    670673            # print(mn_ngpts)
     674            c.execute("SELECT nxnpex FROM grid_current ORDER BY nxnpex DESC LIMIT 1")
     675            mx_nxpex = c.fetchone()[0]
     676            c.execute("SELECT nxnpex FROM grid_current ORDER BY nxnpex LIMIT 1")
     677            mn_nxpex = c.fetchone()[0]
     678            c.execute("SELECT nynpey FROM grid_current ORDER BY nynpey DESC LIMIT 1")
     679            mx_nypey = c.fetchone()[0]
     680            c.execute("SELECT nynpey FROM grid_current ORDER BY nynpey LIMIT 1")
     681            mn_nypey = c.fetchone()[0]
     682
     683
    671684
    672685            conn.commit()
    673686            c.execute(
    674                 """INSERT OR REPLACE INTO grid_limits(nx, ny, nz, npex, npey, npxnpy, np, ngpts) VALUES (?, ?, ?, ?, ?, ?, ?, ?)""",
    675                 (mn_nx, mn_ny, mn_nz, mn_npex, mn_npey, mn_npxnpy, mn_np, mn_ngpts))
     687                """INSERT OR REPLACE INTO grid_limits(nx, ny, nz, npex, npey, npxnpy, np, ngpts, nxnpex, nynpey) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""",
     688                (mn_nx, mn_ny, mn_nz, mn_npex, mn_npey, mn_npxnpy, mn_np, mn_ngpts, mn_nxpex, mn_nypey))
    676689
    677690            c.execute(
    678                 """INSERT OR REPLACE INTO grid_limits(nx, ny, nz, npex, npey, npxnpy, np, ngpts) VALUES (?, ?, ?, ?, ?, ?, ?, ?)""",
    679                 (mx_nx, mx_ny, mx_nz, mx_npex, mx_npey, mx_npxnpy, mx_np, mx_ngpts))
     691                """INSERT OR REPLACE INTO grid_limits(nx, ny, nz, npex, npey, npxnpy, np, ngpts, nxnpex, nynpey) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""",
     692                (mx_nx, mx_ny, mx_nz, mx_npex, mx_npey, mx_npxnpy, mx_np, mx_ngpts, mx_nxpex, mx_nypey))
    680693            conn.commit()
    681694
  • palm/trunk/SCRIPTS/palm_gf_files/palm_gf_table.ui

    r2308 r2309  
    77    <x>0</x>
    88    <y>0</y>
    9     <width>817</width>
     9    <width>1030</width>
    1010    <height>439</height>
    1111   </rect>
     
    1919     <x>5</x>
    2020     <y>166</y>
    21      <width>805</width>
     21     <width>1005</width>
    2222     <height>266</height>
    2323    </rect>
     
    5555   <property name="rowCount">
    5656    <number>8</number>
     57   </property>
     58   <property name="columnCount">
     59    <number>10</number>
    5760   </property>
    5861   <attribute name="horizontalHeaderVisible">
     
    7275   <row>
    7376    <property name="text">
    74      <string>2</string>
     77     <string>8</string>
    7578    </property>
    7679   </row>
     
    141144    </property>
    142145   </column>
     146   <column/>
     147   <column/>
    143148  </widget>
    144149  <widget class="Line" name="line">
    145150   <property name="geometry">
    146151    <rect>
    147      <x>655</x>
     152     <x>831</x>
    148153     <y>60</y>
    149154     <width>30</width>
     
    158163   <property name="geometry">
    159164    <rect>
    160      <x>675</x>
     165     <x>851</x>
    161166     <y>112</y>
    162167     <width>131</width>
     
    750755   <property name="geometry">
    751756    <rect>
    752      <x>675</x>
     757     <x>851</x>
    753758     <y>70</y>
    754759     <width>52</width>
     
    763768   <property name="geometry">
    764769    <rect>
    765      <x>675</x>
     770     <x>851</x>
    766771     <y>90</y>
    767772     <width>131</width>
     
    12291234   </layout>
    12301235  </widget>
     1236  <widget class="QPushButton" name="nxpex_table">
     1237   <property name="geometry">
     1238    <rect>
     1239     <x>806</x>
     1240     <y>149</y>
     1241     <width>104</width>
     1242     <height>23</height>
     1243    </rect>
     1244   </property>
     1245   <property name="text">
     1246    <string>nx+1 / npex</string>
     1247   </property>
     1248   <property name="checkable">
     1249    <bool>true</bool>
     1250   </property>
     1251  </widget>
     1252  <widget class="QPushButton" name="nypey_table">
     1253   <property name="geometry">
     1254    <rect>
     1255     <x>907</x>
     1256     <y>149</y>
     1257     <width>104</width>
     1258     <height>23</height>
     1259    </rect>
     1260   </property>
     1261   <property name="text">
     1262    <string>ny+1 / npey</string>
     1263   </property>
     1264   <property name="checkable">
     1265    <bool>true</bool>
     1266   </property>
     1267  </widget>
     1268  <widget class="QLabel" name="label_13">
     1269   <property name="geometry">
     1270    <rect>
     1271     <x>677</x>
     1272     <y>67</y>
     1273     <width>57</width>
     1274     <height>19</height>
     1275    </rect>
     1276   </property>
     1277   <property name="sizePolicy">
     1278    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
     1279     <horstretch>0</horstretch>
     1280     <verstretch>0</verstretch>
     1281    </sizepolicy>
     1282   </property>
     1283   <property name="minimumSize">
     1284    <size>
     1285     <width>57</width>
     1286     <height>19</height>
     1287    </size>
     1288   </property>
     1289   <property name="maximumSize">
     1290    <size>
     1291     <width>57</width>
     1292     <height>19</height>
     1293    </size>
     1294   </property>
     1295   <property name="text">
     1296    <string>nx / npex</string>
     1297   </property>
     1298  </widget>
     1299  <widget class="QLabel" name="label_14">
     1300   <property name="geometry">
     1301    <rect>
     1302     <x>755</x>
     1303     <y>67</y>
     1304     <width>57</width>
     1305     <height>19</height>
     1306    </rect>
     1307   </property>
     1308   <property name="sizePolicy">
     1309    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
     1310     <horstretch>0</horstretch>
     1311     <verstretch>0</verstretch>
     1312    </sizepolicy>
     1313   </property>
     1314   <property name="minimumSize">
     1315    <size>
     1316     <width>57</width>
     1317     <height>19</height>
     1318    </size>
     1319   </property>
     1320   <property name="maximumSize">
     1321    <size>
     1322     <width>57</width>
     1323     <height>19</height>
     1324    </size>
     1325   </property>
     1326   <property name="text">
     1327    <string>ny / npey</string>
     1328   </property>
     1329  </widget>
     1330  <widget class="QDoubleSpinBox" name="nxpex_min">
     1331   <property name="geometry">
     1332    <rect>
     1333     <x>670</x>
     1334     <y>86</y>
     1335     <width>71</width>
     1336     <height>22</height>
     1337    </rect>
     1338   </property>
     1339   <property name="maximum">
     1340    <double>1000000.000000000000000</double>
     1341   </property>
     1342  </widget>
     1343  <widget class="QDoubleSpinBox" name="nxpex_max">
     1344   <property name="geometry">
     1345    <rect>
     1346     <x>670</x>
     1347     <y>110</y>
     1348     <width>71</width>
     1349     <height>22</height>
     1350    </rect>
     1351   </property>
     1352   <property name="maximum">
     1353    <double>1000000.000000000000000</double>
     1354   </property>
     1355  </widget>
     1356  <widget class="QDoubleSpinBox" name="nypey_min">
     1357   <property name="geometry">
     1358    <rect>
     1359     <x>747</x>
     1360     <y>86</y>
     1361     <width>71</width>
     1362     <height>22</height>
     1363    </rect>
     1364   </property>
     1365   <property name="maximum">
     1366    <double>1000000.000000000000000</double>
     1367   </property>
     1368  </widget>
     1369  <widget class="QDoubleSpinBox" name="nypey_max">
     1370   <property name="geometry">
     1371    <rect>
     1372     <x>747</x>
     1373     <y>110</y>
     1374     <width>71</width>
     1375     <height>22</height>
     1376    </rect>
     1377   </property>
     1378   <property name="maximum">
     1379    <double>1000000.000000000000000</double>
     1380   </property>
     1381  </widget>
    12311382 </widget>
    12321383 <tabstops>
  • palm/trunk/SCRIPTS/palm_gf_files/palm_gf_tools.py

    r2308 r2309  
    6060        self.np_table.clicked.connect(lambda: self.sort_table(str("np")))
    6161        self.ngpts_table.clicked.connect(lambda: self.sort_table(str("ngpts")))
     62        self.nxpex_table.clicked.connect(lambda: self.sort_table(str("nxnpex")))
     63        self.nypey_table.clicked.connect(lambda: self.sort_table(str("nynpey")))
    6264
    6365        self.instant()
     
    8385        dtb = str('.palm_gf_data.db')
    8486        #con = sqlite3.connect("/localdata/.palm_gf_data.db")
    85         con = sqlite3.connect(pathx + '.palm_gf_data.db')
     87
     88        pathx = pathx + '/.palm_gf_data.db'
     89        con = sqlite3.connect(pathx)
    8690        c = con.cursor()
    8791        c.execute("SELECT * FROM " + 'grid_limits')
     
    9094        self.nx_min.setValue(mini[0])
    9195        self.nx_max.setValue(max[0])
     96
    9297        self.ny_min.setValue(mini[1])
    9398        self.ny_max.setValue(max[1])
     
    104109        self.ngpts_min.setValue(mini[7])
    105110        self.ngpts_max.setValue(max[7])
     111        self.nxpex_min.setValue(mini[8])
     112        self.nxpex_max.setValue(max[8])
     113        self.nypey_min.setValue(mini[9])
     114        self.nypey_max.setValue(max[9])
    106115
    107116        self.nx_min.setMinimum(mini[0])
     
    119128        self.np_min.setMinimum(mini[6])
    120129        self.np_max.setMaximum(max[6])
     130
    121131        self.ngpts_min.setMinimum(mini[7])
    122132        self.ngpts_max.setMaximum(max[7])
     
    124134        self.ngpts_max.setMinimum(mini[7])
    125135
     136        self.nxpex_min.setMinimum(mini[8])
     137        self.nxpex_max.setMaximum(max[8])
     138        self.nxpex_min.setMaximum(max[8])
     139        self.nxpex_max.setMinimum(mini[8])
     140
     141        self.nypey_min.setMinimum(mini[9])
     142        self.nypey_max.setMaximum(max[9])
     143        self.nypey_min.setMaximum(max[9])
     144        self.nypey_max.setMinimum(mini[9])
     145
     146
     147
    126148
    127149
     
    134156
    135157    def check(self):
     158        pathx = configwr.read_config()
     159        pathx = pathx[19]
     160
    136161        dtb = str('.palm_gf_data.db')
    137         con = sqlite3.connect("/localdata/.palm_gf_data.db")
     162        #con = sqlite3.connect("/localdata/.palm_gf_data.db")
     163        con = sqlite3.connect(pathx + '/.palm_gf_data.db')
    138164        c = con.cursor()
    139165        c.execute("SELECT * FROM " + 'grid_limits')
     
    154180        #print("LOADED!!!")
    155181        import decimal
     182
     183        pathx = configwr.read_config()
     184        pathx = pathx[19]
     185
    156186        self.setEnabled(False)
    157187        QtGui.QApplication.processEvents()
     
    159189        self.process1()
    160190        database = str('.palm_gf_data.db')
    161         conn = sqlite3.connect("/localdata/.palm_gf_data.db")
     191        conn = sqlite3.connect(pathx + '/.palm_gf_data.db')
    162192        c = conn.cursor()
    163193        c.execute("SELECT * FROM " + 'grid_current')
     
    172202        while i < len(results):
    173203            line = results[i]
    174             while j < 8:
     204            while j < 10:
    175205                var = line[j]
    176206
     
    202232    def filter_results(self):
    203233
     234        pathx = configwr.read_config()
     235        pathx = pathx[19]
     236
    204237        self.setEnabled(False)
    205238        self.calc_label.setText('calculating...')
    206239        QtGui.QApplication.processEvents()
    207240        database = str('.palm_gf_data.db')
    208         conn = sqlite3.connect("/localdata/.palm_gf_data.db")
     241        conn = sqlite3.connect(pathx + '/.palm_gf_data.db')
    209242        c = conn.cursor()
    210243        c.execute("SELECT * FROM " + "grid_current")
     
    252285                                                                        if line[7] >= self.ngpts_min.value():
    253286
    254                                                                             row_cnt += 1
    255                                                                             while j < 8:
    256                                                                                 var = line[j]
    257 
    258                                                                                 if j == 7:
    259                                                                                     self.tableWidget.setItem(row_cnt, j, self.MyTableWidgetItem(str("%.1e" % var), i))
    260 
    261                                                                                 else:
    262                                                                                     self.tableWidget.setItem(row_cnt, j, self.MyTableWidgetItem(str(var), i))
    263 
    264                                                                                 j += 1
     287                                                                            if line[8] <= self.nxpex_max.value():
     288
     289                                                                                if line[8] >= self.nxpex_min.value():
     290
     291                                                                                    if line[9] <= self.nypey_max.value():
     292
     293                                                                                        if line[9] >= self.nypey_min.value():
     294
     295                                                                                            row_cnt += 1
     296                                                                                            while j < 10:
     297                                                                                                var = line[j]
     298
     299                                                                                                if j == 7:
     300                                                                                                    self.tableWidget.setItem(row_cnt, j, self.MyTableWidgetItem(str("%.1e" % var), i))
     301
     302                                                                                                else:
     303                                                                                                    self.tableWidget.setItem(row_cnt, j, self.MyTableWidgetItem(str(var), i))
     304
     305                                                                                                j += 1
    265306
    266307            j = 0
     
    295336        fngpts_mn = self.ngpts_min.value()
    296337        fngpts_mx = self.ngpts_max.value()
     338        nxpex_mn = self.nxpex_min.value()
     339        nxpex_mx = self.nxpex_max.value()
     340        nypey_mn = self.nypey_min.value()
     341        nypey_mx = self.nypey_max.value()
     342
    297343
    298344        if column == str("nx"):
     
    313359            self.np_table.setChecked(False)
    314360            self.ngpts_table.setChecked(False)
     361            self.nxpex_table.setChecked(False)
     362            self.nypey_table.setChecked(False)
    315363
    316364        if column == str("ny"):
     
    331379            self.np_table.setChecked(False)
    332380            self.ngpts_table.setChecked(False)
     381            self.nxpex_table.setChecked(False)
     382            self.nypey_table.setChecked(False)
    333383
    334384        if column == str("nz"):
     
    349399            self.np_table.setChecked(False)
    350400            self.ngpts_table.setChecked(False)
     401            self.nxpex_table.setChecked(False)
     402            self.nypey_table.setChecked(False)
    351403
    352404        if column == str("npex"):
     
    367419            self.np_table.setChecked(False)
    368420            self.ngpts_table.setChecked(False)
     421            self.nxpex_table.setChecked(False)
     422            self.nypey_table.setChecked(False)
    369423
    370424        if column == str("npey"):
     
    386440            self.np_table.setChecked(False)
    387441            self.ngpts_table.setChecked(False)
     442            self.nxpex_table.setChecked(False)
     443            self.nypey_table.setChecked(False)
    388444
    389445        if column == str("npexnpey"):
     
    404460            self.np_table.setChecked(False)
    405461            self.ngpts_table.setChecked(False)
     462            self.nxpex_table.setChecked(False)
     463            self.nypey_table.setChecked(False)
    406464
    407465        if column == str("np"):
     
    422480            self.nx_table.setChecked(False)
    423481            self.ngpts_table.setChecked(False)
     482            self.nxpex_table.setChecked(False)
     483            self.nypey_table.setChecked(False)
    424484
    425485        if column == str("ngpts"):
     
    440500            self.np_table.setChecked(False)
    441501            self.nx_table.setChecked(False)
    442 
    443 
    444 
    445         conn = sqlite3.connect("/localdata/.palm_gf_data.db")
     502            self.nxpex_table.setChecked(False)
     503            self.nypey_table.setChecked(False)
     504
     505        if column == str("nxnpex"):
     506            sorted_col = "nxnpex"
     507
     508            if self.nxpex_table.isChecked() is True:
     509                order = " DESC"
     510
     511            else:
     512
     513                order = " ASC"
     514
     515            self.ny_table.setChecked(False)
     516            self.nz_table.setChecked(False)
     517            self.npex_table.setChecked(False)
     518            self.npey_table.setChecked(False)
     519            self.npexnpey_table.setChecked(False)
     520            self.np_table.setChecked(False)
     521            self.nx_table.setChecked(False)
     522            self.ngpts_table.setChecked(False)
     523            self.nypey_table.setChecked(False)
     524
     525        if column == str("nynpey"):
     526            sorted_col = "nynpey"
     527
     528            if self.nypey_table.isChecked() is True:
     529                order = " DESC"
     530
     531            else:
     532
     533                order = " ASC"
     534
     535            self.ny_table.setChecked(False)
     536            self.nz_table.setChecked(False)
     537            self.npex_table.setChecked(False)
     538            self.npey_table.setChecked(False)
     539            self.npexnpey_table.setChecked(False)
     540            self.np_table.setChecked(False)
     541            self.nx_table.setChecked(False)
     542            self.ngpts_table.setChecked(False)
     543            self.nxpex_table.setChecked(False)
     544
     545        else:
     546            pass
     547
     548        pathx = configwr.read_config()
     549        pathx = pathx[19]
     550
     551
     552        conn = sqlite3.connect(pathx + "/.palm_gf_data.db")
    446553        c = conn.cursor()
    447554        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) +
     
    449556        str(fnpex_mn) + " AND npey <= " + str(fnpey_mx) + " AND npey >= " + str(fnpey_mn) + " AND "
    450557                  "npxnpy <= " + str(fnpxnpy_mx) + " AND npxnpy >= " + str(fnpxnpy_mn) + " AND np <= " + str(fnp_mx) + " AND np >= " + str(fnp_mn) + " AND ngpts <= " + str(fngpts_mx) + " AND ngpts >= " + str(fngpts_mn) +
     558        " AND nxnpex <= " + str(nxpex_mx) + " AND nxnpex >= " + str(nxpex_mn) + " AND nynpey <= " + str(nypey_mx) + " AND nynpey >= " + str(nypey_mn) +
    451559        " ORDER BY " + str(sorted_col) + str(order))
    452560
     
    454562
    455563        sorted = c.fetchall()
     564
    456565
    457566        c.close()
     
    461570        for row_indx in range(0,len(sorted)):
    462571
    463             for col_indx in range(0,8):
     572            for col_indx in range(0,10):
    464573                row = sorted[row_indx]
    465574                value = row[col_indx]
Note: See TracChangeset for help on using the changeset viewer.