Dokumentatiion of emLibrary

emLibrary Tutorial

Import emLibrary as emIF, emDF objects


In [7]:
import emLibrary.InfoFile as emIF
import emLibrary.DataFile as emDF

Starting the Constructors


In [8]:
IF = emIF.InfoFile('NewTestFiles/B00C76BE.BIN')
DF = emDF.DataFile('NewTestFiles/B00C76BF.BIN')

Get Information out of the InfoFile Object


In [9]:
IF.TotalPower


Out[9]:
0.037

In [10]:
a = DF.dataHexList

In [11]:
t = DF.getdec(0,0,a[0])

In [12]:
DF.getStartDate(a[0])


Out[12]:
datetime.datetime(2013, 11, 15, 5, 10)

In [14]:
DF.getStartDateList()[0]


Out[14]:
datetime.datetime(2013, 11, 15, 5, 10)

Testing if insert to DB is ok


In [15]:
import mysqldb.mysqldb as mysqldb

In [18]:
print DF.toSqlDB(mysqldb.load_DB_params('em.config'))


None

In [19]:
DF


Out[19]:
<emLibrary.DataFile.DataFile at 0x3760bd0>

In [20]:
mysqldb.load_DB_params('em.config')


Out[20]:
('test', 'root', 'pet=81zi', 'localhost')

In [21]:
ls


em.config*  Examples/     LICENSE   NewFileTest.ipynb  README.md
emLibrary/  InsertAll.py  mysqldb/  NewTestFiles/      TestFiles/

In [22]:
cat InsertAll.py


'''
Created on 03.11.2013

@author: bernd
'''

if __name__ == '__main__':
    import emLibrary.DataFile as emDF
    from os import listdir
    from os.path import isfile, join
    import mysqldb.mysqldb as mysqldb
    configFile = 'em.config'    
    mypath = 'TestFiles'
    files = [ mypath + "/" + f for f in listdir(mypath) if (isfile(join(mypath,f)) and f.endswith('.bin')) ]
    for i in files:
        try:
            emDF.DataFile(i).toSqlDB(mysqldb.load_DB_params(configFile))
            print "Finished with tile: %s. " % i
        except:
            print "Fault with %s, maybe a Info File!" % i
        
        
    

In [ ]: