Changeset 387
- Timestamp:
- 04/09/12 16:53:55 (9 years ago)
- Location:
- trunk/Puzzlebox/Synapse
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Puzzlebox/Synapse/Emotiv/Server.py
r386 r387 184 184 185 185 186 self.customDataHeaders = 'Time From Start,Headset On,Contact Number Of Quality Channels,Wireless,Excitement,Long Term Excitement,Meditation,Frustration,Engagement/Boredom,Current Action,Current Action Power'187 188 189 186 self.configureEEG() 190 187 … … 338 335 truncate_csv_timezone = False 339 336 340 #try: 341 #scrub_data = target.configuration.EXPORT_CSV_SCRUB_DATA 342 #except: 343 #scrub_data = False 344 345 346 #headers = 'Date,Time' 347 #headers = 'Date,Time,Attention,Meditation,Signal Level,Delta,Theta,Low Alpha,High Alpha,Low Beta,High Beta,Low Gamma,Mid Gamma' 348 headers = self.customDataHeaders 337 try: 338 scrub_data = target.configuration.EXPORT_CSV_SCRUB_DATA 339 except: 340 scrub_data = False 341 342 343 headers = 'Date,Time' 344 headers = headers + ',' 345 #headers = headers + 'Time From Start,Headset On,Contact Number Of Quality Channels,Wireless,Excitement,Long Term Excitement,Meditation,Frustration,Engagement/Boredom,Cognitiv Action,Cognitiv Action Power' 346 headers = headers + 'Time From Start,Headset On,Contact Number Of Quality Channels,Wireless,Expressiv ActionExcitement,Long Term Excitement,Meditation,Frustration,Engagement/Boredom,Cognitiv Action,Cognitiv Action Power' 347 348 if self.emulate_thinkgear: 349 headers = headers + ',' 350 #headers = headers + 'Attention,Meditation,Signal Level,Delta,Theta,Low Alpha,High Alpha,Low Beta,High Beta,Low Gamma,Mid Gamma' 351 headers = headers + 'Attention,Meditation,Signal Level' 352 349 353 350 354 customDataHeaders = [] … … 360 364 headers = headers + '\n' 361 365 366 362 367 csv = {} 363 368 364 369 for packet in source.packets['signals']: 365 366 370 367 371 if 'rawEeg' in packet.keys(): … … 375 379 376 380 377 #print packet378 381 timestamp = packet['timestamp'] 379 (date, localtime) = s elf.parseTimeStamp(timestamp, \382 (date, localtime) = source.parseTimeStamp(timestamp, \ 380 383 truncate_time_zone=truncate_csv_timezone) 381 384 … … 383 386 csv[timestamp]['Date'] = date 384 387 csv[timestamp]['Time'] = localtime 385 csv[timestamp]['Attention'] = '' 388 389 csv[timestamp]['Time From Start'] = '' 390 csv[timestamp]['Headset On'] = '' 391 csv[timestamp]['Contact Number Of Quality Channels'] = '' 392 csv[timestamp]['Wireless'] = '' 393 csv[timestamp]['Expressiv Action'] = '' 394 csv[timestamp]['Excitement'] = '' 395 csv[timestamp]['Long Term Excitement'] = '' 386 396 csv[timestamp]['Meditation'] = '' 387 csv[timestamp]['Signal Level'] = '' 388 csv[timestamp]['Delta'] = '' 389 csv[timestamp]['Theta'] = '' 390 csv[timestamp]['Low Alpha'] = '' 391 csv[timestamp]['High Alpha'] = '' 392 csv[timestamp]['Low Beta'] = '' 393 csv[timestamp]['High Beta'] = '' 394 csv[timestamp]['Low Gamma'] = '' 395 csv[timestamp]['Mid Gamma'] = '' 397 csv[timestamp]['Frustration'] = '' 398 csv[timestamp]['Engagement/Boredom'] = '' 399 csv[timestamp]['Cognitiv Action'] = '' 400 csv[timestamp]['Cognitiv Action Power'] = '' 401 402 if self.emulate_thinkgear: 403 csv[timestamp]['Attention'] = '' 404 csv[timestamp]['Meditation'] = '' 405 csv[timestamp]['Signal Level'] = '' 406 #csv[timestamp]['Delta'] = '' 407 #csv[timestamp]['Theta'] = '' 408 #csv[timestamp]['Low Alpha'] = '' 409 #csv[timestamp]['High Alpha'] = '' 410 #csv[timestamp]['Low Beta'] = '' 411 #csv[timestamp]['High Beta'] = '' 412 #csv[timestamp]['Low Gamma'] = '' 413 #csv[timestamp]['Mid Gamma'] = '' 396 414 397 415 for header in customDataHeaders: … … 399 417 400 418 401 if 'eSense' in packet.keys(): 402 if 'attention' in packet['eSense'].keys(): 403 csv[timestamp]['Attention'] = packet['eSense']['attention'] 404 if 'meditation' in packet['eSense'].keys(): 405 csv[timestamp]['Meditation'] = packet['eSense']['meditation'] 406 407 if 'eegPower' in packet.keys(): 408 if 'delta' in packet['eegPower'].keys(): 409 csv[timestamp]['Delta'] = packet['eegPower']['delta'] 410 if 'theta' in packet['eegPower'].keys(): 411 csv[timestamp]['Theta'] = packet['eegPower']['theta'] 412 if 'lowAlpha' in packet['eegPower'].keys(): 413 csv[timestamp]['Low Alpha'] = packet['eegPower']['lowAlpha'] 414 if 'highAlpha' in packet['eegPower'].keys(): 415 csv[timestamp]['High Alpha'] = packet['eegPower']['highAlpha'] 416 if 'lowBeta' in packet['eegPower'].keys(): 417 csv[timestamp]['Low Beta'] = packet['eegPower']['lowBeta'] 418 if 'highBeta' in packet['eegPower'].keys(): 419 csv[timestamp]['High Beta'] = packet['eegPower']['highBeta'] 420 if 'lowGamma' in packet['eegPower'].keys(): 421 csv[timestamp]['Low Gamma'] = packet['eegPower']['lowGamma'] 422 if 'highGamma' in packet['eegPower'].keys(): 423 csv[timestamp]['Mid Gamma'] = packet['eegPower']['highGamma'] 424 425 if 'poorSignalLevel' in packet.keys(): 426 csv[timestamp]['Signal Level'] = packet['poorSignalLevel'] 419 if 'emotivStatus' in packet.keys(): 420 if 'timeFromStart' in packet['emotivStatus'].keys(): 421 csv[timestamp]['Time From Start'] = packet['emotivStatus']['timeFromStart'] 422 if 'headsetOn' in packet['emotivStatus'].keys(): 423 csv[timestamp]['Headset On'] = packet['emotivStatus']['headsetOn'] 424 if 'Contact Number Of Quality Channels' in packet['emotivStatus'].keys(): 425 csv[timestamp]['Contact Number Of Quality Channels'] = packet['emotivStatus']['contactNumberOfQualityChannels'] 426 if 'Wireless' in packet['emotivStatus'].keys(): 427 csv[timestamp]['Wireless'] = packet['emotivStatus']['wireless'] 428 429 if 'expressiv' in packet.keys(): 430 if 'currentAction' in packet['expressiv'].keys(): 431 csv[timestamp]['Expressiv Action'] = packet['expressiv']['currentAction'] 432 433 if 'affectiv' in packet.keys(): 434 if 'excitement' in packet['affectiv'].keys(): 435 csv[timestamp]['Excitement'] = int(packet['affectiv']['excitement'] * 100) 436 if 'longTermExcitement' in packet['affectiv'].keys(): 437 csv[timestamp]['Long Term Excitement'] = int(packet['affectiv']['longTermExcitement'] * 100) 438 if 'meditation' in packet['affectiv'].keys(): 439 csv[timestamp]['Meditation'] = int(packet['affectiv']['meditation'] * 100) 440 if 'frustration' in packet['affectiv'].keys(): 441 csv[timestamp]['Frustration'] = int(packet['affectiv']['frustration'] * 100) 442 if 'engagementBoredom' in packet['affectiv'].keys(): 443 csv[timestamp]['Engagement/Boredom'] = int(packet['affectiv']['engagementBoredom'] * 100) 444 445 if 'cognitiv' in packet.keys(): 446 if 'currentAction' in packet['cognitiv'].keys(): 447 csv[timestamp]['Cognitiv Action'] = packet['cognitiv']['currentAction'] 448 if 'currentActionPower' in packet['cognitiv'].keys(): 449 csv[timestamp]['Cognitiv Action Power'] = int(packet['cognitiv']['currentActionPower'] * 100) 450 451 452 if self.emulate_thinkgear: 453 if 'eSense' in packet.keys(): 454 if 'attention' in packet['eSense'].keys(): 455 csv[timestamp]['Attention'] = packet['eSense']['attention'] 456 if 'meditation' in packet['eSense'].keys(): 457 csv[timestamp]['Meditation'] = packet['eSense']['meditation'] 458 459 if 'poorSignalLevel' in packet.keys(): 460 csv[timestamp]['Signal Level'] = packet['poorSignalLevel'] 461 462 #if 'eegPower' in packet.keys(): 463 #if 'delta' in packet['eegPower'].keys(): 464 #csv[timestamp]['Delta'] = packet['eegPower']['delta'] 465 #if 'theta' in packet['eegPower'].keys(): 466 #csv[timestamp]['Theta'] = packet['eegPower']['theta'] 467 #if 'lowAlpha' in packet['eegPower'].keys(): 468 #csv[timestamp]['Low Alpha'] = packet['eegPower']['lowAlpha'] 469 #if 'highAlpha' in packet['eegPower'].keys(): 470 #csv[timestamp]['High Alpha'] = packet['eegPower']['highAlpha'] 471 #if 'lowBeta' in packet['eegPower'].keys(): 472 #csv[timestamp]['Low Beta'] = packet['eegPower']['lowBeta'] 473 #if 'highBeta' in packet['eegPower'].keys(): 474 #csv[timestamp]['High Beta'] = packet['eegPower']['highBeta'] 475 #if 'lowGamma' in packet['eegPower'].keys(): 476 #csv[timestamp]['Low Gamma'] = packet['eegPower']['lowGamma'] 477 #if 'highGamma' in packet['eegPower'].keys(): 478 #csv[timestamp]['Mid Gamma'] = packet['eegPower']['highGamma'] 427 479 428 480 for header in customDataHeaders: … … 433 485 434 486 #if scrub_data: 435 #csv = self.scrubData(csv, truncate_csv_timezone )487 #csv = self.scrubData(csv, truncate_csv_timezone, source=source) 436 488 437 489 … … 443 495 for key in csv_keys: 444 496 445 row = '%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s ' % \497 row = '%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s' % \ 446 498 (csv[key]['Date'], \ 447 499 csv[key]['Time'], \ 448 csv[key]['Attention'], \ 500 csv[key]['Time From Start'], \ 501 csv[key]['Headset On'], \ 502 csv[key]['Contact Number Of Quality Channels'], \ 503 csv[key]['Wireless'], \ 504 csv[key]['Expressiv Action'], \ 505 csv[key]['Excitement'], \ 506 csv[key]['Long Term Excitement'], \ 449 507 csv[key]['Meditation'], \ 450 csv[key]['Signal Level'], \ 451 csv[key]['Delta'], \ 452 csv[key]['Theta'], \ 453 csv[key]['Low Alpha'], \ 454 csv[key]['High Alpha'], \ 455 csv[key]['Low Beta'], \ 456 csv[key]['High Beta'], \ 457 csv[key]['Low Gamma'], \ 458 csv[key]['Mid Gamma']) 508 csv[key]['Frustration'], \ 509 csv[key]['Engagement/Boredom'], \ 510 csv[key]['Cognitiv Action'], \ 511 csv[key]['Cognitiv Action Power']) 512 513 if self.emulate_thinkgear: 514 #row = '%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s' % \ 515 row = '%s,%s,%s,%s' % \ 516 (row, \ 517 csv[key]['Attention'], \ 518 csv[key]['Meditation'], \ 519 csv[key]['Signal Level']) 520 #csv[key]['Delta'], \ 521 #csv[key]['Theta'], \ 522 #csv[key]['Low Alpha'], \ 523 #csv[key]['High Alpha'], \ 524 #csv[key]['Low Beta'], \ 525 #csv[key]['High Beta'], \ 526 #csv[key]['Low Gamma'], \ 527 #csv[key]['Mid Gamma']) 459 528 460 529 for header in customDataHeaders: 461 530 row = row + ',%s' % csv[key][header] 531 #print header 532 #print csv[key] 462 533 463 534 row = row + '\n' … … 466 537 467 538 468 return(output) 539 return(output) 469 540 470 541 -
trunk/Puzzlebox/Synapse/Session.py
r386 r387 46 46 DEBUG = configuration.DEBUG 47 47 48 #PACKET_MINIMUM_TIME_DIFFERENCE_THRESHOLD = 0.7549 50 51 48 ##################################################################### 52 49 # Classes -
trunk/Puzzlebox/Synapse/ThinkGear/Server.py
r386 r387 7 7 8 8 __changelog__ = """\ 9 Last Update: 2012.0 3.309 Last Update: 2012.04.09 10 10 """ 11 11 … … 179 179 180 180 181 self.customDataHeaders = 'Attention,Meditation,Signal Level,Delta,Theta,Low Alpha,High Alpha,Low Beta,High Beta,Low Gamma,Mid Gamma'181 #self.customDataHeaders = 'Attention,Meditation,Signal Level,Delta,Theta,Low Alpha,High Alpha,Low Beta,High Beta,Low Gamma,Mid Gamma' 182 182 183 183 … … 235 235 else: 236 236 self.sendPacketQueue() 237 238 239 ##################################################################240 241 #def emitSendPacketSignal(self):242 243 #self.emit(QtCore.SIGNAL("sendPacket()"))244 245 246 ##################################################################247 248 #def sendPacketQueue(self):249 250 #if (self.parent != None):251 252 #for packet in self.packet_queue:253 #self.parent.packet_queue.append(packet)254 255 ##self.parent.sendPacketQueue()256 237 257 238 … … 521 502 522 503 #headers = 'Date,Time' 523 #headers = 'Date,Time,Attention,Meditation,Signal Level,Delta,Theta,Low Alpha,High Alpha,Low Beta,High Beta,Low Gamma,Mid Gamma'524 headers = self.customDataHeaders504 headers = 'Date,Time,Attention,Meditation,Signal Level,Delta,Theta,Low Alpha,High Alpha,Low Beta,High Beta,Low Gamma,Mid Gamma' 505 #headers = self.customDataHeaders 525 506 526 507 customDataHeaders = [] … … 536 517 headers = headers + '\n' 537 518 519 538 520 csv = {} 539 521 … … 551 533 552 534 553 #print packet554 535 timestamp = packet['timestamp'] 555 536 #(date, localtime) = self.parseTimeStamp(timestamp, \ … … 582 563 if 'meditation' in packet['eSense'].keys(): 583 564 csv[timestamp]['Meditation'] = packet['eSense']['meditation'] 565 566 if 'poorSignalLevel' in packet.keys(): 567 csv[timestamp]['Signal Level'] = packet['poorSignalLevel'] 584 568 585 569 if 'eegPower' in packet.keys(): … … 600 584 if 'highGamma' in packet['eegPower'].keys(): 601 585 csv[timestamp]['Mid Gamma'] = packet['eegPower']['highGamma'] 602 603 if 'poorSignalLevel' in packet.keys():604 csv[timestamp]['Signal Level'] = packet['poorSignalLevel']605 586 606 587 for header in customDataHeaders:
Note: See TracChangeset
for help on using the changeset viewer.