Skip to content

Commit

Permalink
Changed readAnalysisInfo in sqlite3MDIO to return a dict.
Browse files Browse the repository at this point in the history
  • Loading branch information
abalijepalli committed Apr 13, 2017
1 parent 89e4e3b commit 338df21
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
19 changes: 11 additions & 8 deletions mosaic/mdio/sqlite3MDIO.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,17 @@ def readAnalysisInfo(self):
self.db.commit()
c = self.db.cursor()

c.execute('PRAGMA table_info(analysisinfo);')
infoheadings=[ idx[1] for idx in c.fetchall() ]

c.execute( 'select * from analysisinfo' )
infolist=c.fetchall()

return list(infolist[0])[:-1]
# return base64.b64decode(list(settstr[0])[0])
infolist=c.fetchall()[0]

infodict={}
for k,v in zip(infoheadings, infolist)[:-1]:
infodict[k]=v

return infodict
except sqlite3.OperationalError, err:
raise

Expand Down Expand Up @@ -378,8 +384,6 @@ def _decoderecord(self, colnames, colnames_t, rec):
return [ d[col] for col in colnames ]

if __name__=="__main__":
dbname=resource_path('eventMD-PEG28-stepResponseAnalysis.sqlite')

try:
c=sqlite3MDIO()
c.openDB(dbname)
Expand All @@ -391,8 +395,7 @@ def _decoderecord(self, colnames, colnames_t, rec):
print c.readSettings()
print c.readAnalysisLog()
print c.readAnalysisInfo()

print zip( c.mdColumnNames, c.mdColumnTypes )
# print zip( c.mdColumnNames, c.mdColumnTypes )
print
# print [ c for c in zip( c.mdColumnNames, c.mdColumnTypes ) if c[1] != 'REAL_LIST' ]

Expand Down
2 changes: 1 addition & 1 deletion mosaicgui/datamodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def UpdateDataModelFromSettings(self, dbfile=None):
print "Settings not found in ", dbfile, "\n"

try:
self["dbInfoFsHz"]=db.readAnalysisInfo()[7]
self["dbInfoFsHz"]=db.readAnalysisInfo()['FsHz']
except:
pass

Expand Down
2 changes: 1 addition & 1 deletion mosaicgui/fiteventsview/fiteventsview.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def openDBFile(self, dbfile, FskHz, updateOnIdle=True):

# Store the analysis algorithm
try:
self.analysisAlgorithm=str(self.queryDatabase.readAnalysisInfo()[3])
self.analysisAlgorithm=str(self.queryDatabase.readAnalysisInfo()['processingAlgorithm'])
except:
# If the database doesn't have information on the alogirthm type,
# default to adept2State
Expand Down
2 changes: 1 addition & 1 deletion mosaicgui/statisticsview/statisticsview.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def openDBFile(self, dbfile, updateOnIdle=True):
self.dbHnd.openDB(self.dbFile)

# set the length of the trajectory in sec.
self.trajLength=self.dbHnd.readAnalysisInfo()[-1]
self.trajLength=self.dbHnd.readAnalysisInfo()['dataLengthSec']

# Connect signals and slots
self.qWorker.resultsReady2.connect(self.OnDataReady)
Expand Down

0 comments on commit 338df21

Please sign in to comment.