User Tools

Site Tools


logreader-py

This is an old revision of the document!



Warning: Declaration of syntax_plugin_wrap_div::handle($match, $state, $pos, Doku_Handler &$handler) should be compatible with DokuWiki_Syntax_Plugin::handle($match, $state, $pos, Doku_Handler $handler) in /var/www/kucjica/emperors-wiki/lib/plugins/wrap/syntax/div.php on line 43

Warning: Declaration of syntax_plugin_wrap_div::render($mode, Doku_Renderer &$renderer, $indata) should be compatible with DokuWiki_Syntax_Plugin::render($format, Doku_Renderer $renderer, $data) in /var/www/kucjica/emperors-wiki/lib/plugins/wrap/syntax/div.php on line 81

Warning: Declaration of syntax_plugin_wrap_closesection::handle($match, $state, $pos, Doku_Handler &$handler) should be compatible with DokuWiki_Syntax_Plugin::handle($match, $state, $pos, Doku_Handler $handler) in /var/www/kucjica/emperors-wiki/lib/plugins/wrap/syntax/closesection.php on line 23

Warning: Declaration of syntax_plugin_wrap_closesection::render($mode, Doku_Renderer &$renderer, $indata) should be compatible with DokuWiki_Syntax_Plugin::render($format, Doku_Renderer $renderer, $data) in /var/www/kucjica/emperors-wiki/lib/plugins/wrap/syntax/closesection.php on line 29

Warning: Declaration of syntax_plugin_wrap_span::handle($match, $state, $pos, Doku_Handler &$handler) should be compatible with DokuWiki_Syntax_Plugin::handle($match, $state, $pos, Doku_Handler $handler) in /var/www/kucjica/emperors-wiki/lib/plugins/wrap/syntax/span.php on line 43

Warning: Declaration of syntax_plugin_wrap_span::render($mode, Doku_Renderer &$renderer, $indata) should be compatible with DokuWiki_Syntax_Plugin::render($format, Doku_Renderer $renderer, $data) in /var/www/kucjica/emperors-wiki/lib/plugins/wrap/syntax/span.php on line 63

Warning: Declaration of syntax_plugin_gallery::handle($match, $state, $pos, &$handler) should be compatible with DokuWiki_Syntax_Plugin::handle($match, $state, $pos, Doku_Handler $handler) in /var/www/kucjica/emperors-wiki/lib/plugins/gallery/syntax.php on line 51

Warning: Declaration of syntax_plugin_gallery::render($mode, &$R, $data) should be compatible with DokuWiki_Syntax_Plugin::render($format, Doku_Renderer $renderer, $data) in /var/www/kucjica/emperors-wiki/lib/plugins/gallery/syntax.php on line 147

Warning: Declaration of syntax_plugin_vshare::handle($match, $state, $pos, &$handler) should be compatible with DokuWiki_Syntax_Plugin::handle($match, $state, $pos, Doku_Handler $handler) in /var/www/kucjica/emperors-wiki/lib/plugins/vshare/syntax.php on line 47

Warning: Declaration of syntax_plugin_vshare::render($mode, &$R, $data) should be compatible with DokuWiki_Syntax_Plugin::render($format, Doku_Renderer $renderer, $data) in /var/www/kucjica/emperors-wiki/lib/plugins/vshare/syntax.php on line 107

Warning: preg_match(): Compilation failed: invalid range in character class at offset 3444 in /var/www/kucjica/emperors-wiki/inc/parser/lexer.php on line 118
A PCRE internal error occured. This might be caused by a faulty plugin

====== logreader.py (estimote beacons) ====== <code python> import dateutil.parser, subprocess, codecs, random, time logs = subprocess.Popen("ls -RSl *csv | head -10", \ shell=True, stdout=subprocess.PIPE, \ stderr=subprocess.PIPE).communicate()[0].strip() print logs toRead = raw_input("choose a file: (you can use one from the list above)\n") fileOut = codecs.open("vizi/visualize.csv", "w", encoding="utf-8") fileOut.write("user,user_time,positionx,positiony,bajts\n") log = codecs.open((toRead), "r", encoding="utf-8") #log = codecs.open(("logging-2014-09-03.csv"), "r", encoding="utf-8") color_list = ["#19B2AE","#FF29D2","#3DFFF9","#CCAF25","#CC2925","#B2AB88"] users = {} blueberry = ["336", "284"] icy = ["534", "201"] mint = ["710", "273"] ### the loop ui=0 for i, line in enumerate(log): if i==0: begin_time = int(time.mktime(dateutil.parser.parse(line.split(",")[2].strip('"')).timetuple())) print i, line, begin_time else: # get the user (if unique assign a new colour; if existent, add data to it) user = line.split(",")[1].strip('"') if user not in users: if user == 'noID': users[user]=("#B2AB88") fileOut.write(users[user]+",") else: print 'current ui', ui users[user]=(color_list[ui]) fileOut.write(users[user]+",") ui=ui+1 else: fileOut.write(users[user]+",") pass # get user time user_time = int(time.mktime(dateutil.parser.parse(line.split(",")[2].strip('"')).timetuple())) print user_time interval= str(user_time-begin_time) print interval, user fileOut.write(interval+",") # get user's position and translate it into screen position position = line.split(',')[8].strip('"\n') if position == "62100": fileOut.write(blueberry[0]+","+blueberry[1]+",") elif position == "55745": fileOut.write(icy[0]+","+icy[1]+",") elif position == "56336": fileOut.write(mint[0]+","+mint[1]+",") else: fileOut.write("1024,326,") #data bajts = abs(int(line.split(",")[3].strip('"'))) fileOut.write(str(bajts)+"\n") print users fileOut.close() </code> ====== logreader.py (wi-fi fingerprints) ======

logreader-py.1461843651.txt.gz · Last modified: 2016/04/28 11:40 by zoza