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

some further bugfixes for palm_gf

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.