print '+ TextStim INIT Dur (secs):\t%.3f'%(textstim_init_dur/1000.0) if stim1 != stim2: if stim2_type == 'TextBox': print '+ TextBox INIT Dur (secs):\t%.3f'%(textbox_init_dur/1000.0) else: print '+ TextStim INIT Dur (secs):\t%.3f'%(textstim_init_dur/1000.0) print '+ Text Change Flip Perc:\t%.2f'%((1.0/chng_txt_each_flips)*100.0),r'%' print print '+ Total Flip Count:\t\t',fcount print '+ Test Duration (secs):\t\t%.3f'%(flip_time-demo_start) print '+ FPS:\t\t\t\t%.3f'%(float(fcount)/(flip_time-demo_start)) print print '+ Average Draw Call Durations (msec):' print print 'Text Object\tNo Txt Change\tTxt Change' print print '%s\t\t%.3f\t\t%.3f'%(stim1_type, stim1_no_change_draw_times.mean(),stim1_txt_change_draw_times.mean()) print '%s\t%.3f\t\t%.3f'%(stim2_type, stim2_no_change_draw_times.mean(),stim2_txt_change_draw_times.mean()) print print '+ %s / %s Draw Time Ratio:'%(stim1_type,stim2_type) print print '\tNo Txt Change\tTxt Change' print print 'Ratio\t%.3f\t\t%.3f'%(stim1_no_change_draw_times.mean()/stim2_no_change_draw_times.mean(), stim1_txt_change_draw_times.mean()/stim2_txt_change_draw_times.mean()) print print '---------------------------------------' core.quit()
Any method of the numpy.array class can be called by a NumPyRingBuffer instance, however numpy.array module funtions will not accept a NumPyRingBuffer as input. @author: Sol """ from psychopy.iohub.util import NumPyRingBuffer # Create a ring buffer with a maximum size of 10 elements. AS more than 10 elements # are added using append(x), each new element removed the oldeest element in # the buffer. The default data type is numpy.float32. To change the type to a # different numpy scalar value (for example numpy.uint, numpy ubyte, etc), # use the dtype parameter of NumPyRingBuffer. ring_buffer = NumPyRingBuffer(10) # Add 25 values to the ring buffer, between 1 and 25 inclusive. # Print out info about the ring buffer and ring buffer contents state # after each element is added. # for i in xrange(1, 26): ring_buffer.append(i) print '-------' print 'Ring Buffer Stats:' print '\tWindow size: ', len(ring_buffer) print '\tMin Value: ', ring_buffer.min() print '\tMax Value: ', ring_buffer.max() print '\tMean Value: ', ring_buffer.mean() print '\tStandard Deviation: ', ring_buffer.std() print '\tFirst 3 Elements: ', ring_buffer[:3] print '\tLast 3 Elements: ', ring_buffer[-3:]
print '+ TextStim INIT Dur (secs):\t%.3f'%(textstim_init_dur/1000.0) if stim1 != stim2: if stim2_type == 'TextBox': print '+ TextBox INIT Dur (secs):\t%.3f'%(textbox_init_dur/1000.0) else: print '+ TextStim INIT Dur (secs):\t%.3f'%(textstim_init_dur/1000.0) print '+ Text Change Flip Perc:\t%.2f'%((1.0/chng_txt_each_flips)*100.0),r'%' print print '+ Total Flip Count:\t\t',fcount print '+ Test Duration (secs):\t\t%.3f'%(flip_time-demo_start) print '+ FPS:\t\t\t\t%.3f'%(float(fcount)/(flip_time-demo_start)) print print '+ Average Draw Call Durations (msec):' print print 'Text Object\tNo Txt Change\tTxt Change' print print '%s\t\t%.3f\t\t%.3f'%(stim1_type, stim1_no_change_draw_times.mean(),stim1_txt_change_draw_times.mean()) print '%s\t%.3f\t\t%.3f'%(stim2_type, stim2_no_change_draw_times.mean(),stim2_txt_change_draw_times.mean()) print print '+ %s / %s Draw Time Ratio:'%(stim1_type,stim2_type) print print '\tNo Txt Change\tTxt Change' print print 'Ratio\t%.3f\t\t%.3f'%(stim1_no_change_draw_times.mean()/stim2_no_change_draw_times.mean(), stim1_txt_change_draw_times.mean()/stim2_txt_change_draw_times.mean()) print print '---------------------------------------' core.quit()
if stim2_type == 'TextBox': print('+ TextBox INIT Dur (secs):\t%.3f'%(textbox_init_dur/1000.0)) else: print('+ TextStim INIT Dur (secs):\t%.3f'%(textstim_init_dur/1000.0)) print('+ Text Change Flip Perc:\t%.2f'%((1.0/chng_txt_each_flips)*100.0),r'%') print() print('+ Total Flip Count:\t\t',fcount) print('+ Test Duration (secs):\t\t%.3f'%(flip_time-demo_start)) print('+ FPS:\t\t\t\t%.3f'%(fcount/flip_time-demo_start)) print() print('+ Average Draw Call Durations (msec):') print() print('Text Object\tNo Txt Change\tTxt Change') print() print('%s\t\t%.3f\t\t%.3f'%(stim1_type, stim1_no_change_draw_times.mean(),stim1_txt_change_draw_times.mean())) print('%s\t%.3f\t\t%.3f'%(stim2_type, stim2_no_change_draw_times.mean(),stim2_txt_change_draw_times.mean())) print() print('+ %s / %s Draw Time Ratio:'%(stim1_type,stim2_type)) print() print('\tNo Txt Change\tTxt Change') print() print('Ratio\t%.3f\t\t%.3f'%( stim1_no_change_draw_times.mean()/stim2_no_change_draw_times.mean(), stim1_txt_change_draw_times.mean()/stim2_txt_change_draw_times.mean())) print() print('---------------------------------------') core.quit()
Values can be appended to the ring buffer and accessed using slice notation. Any method of the numpy.array class can be called by a NumPyRingBuffer instance, however numpy.array module funtions will not accept a NumPyRingBuffer as input. @author: Sol """ from psychopy.iohub.util import NumPyRingBuffer # Create a ring buffer with a maximum size of 10 elements. AS more than 10 elements # are added using append(x), each new element removed the oldeest element in # the buffer. The default data type is numpy.float32. To change the type to a # different numpy scalar value (for example numpy.uint, numpy ubyte, etc), # use the dtype parameter of NumPyRingBuffer. ring_buffer=NumPyRingBuffer(10) # Add 25 values to the ring buffer, between 1 and 25 inclusive. # Print out info about the ring buffer and ring buffer contents state # after each element is added. # for i in xrange(1,26): ring_buffer.append(i) print '-------' print 'Ring Buffer Stats:' print '\tWindow size: ',len(ring_buffer) print '\tMin Value: ',ring_buffer.min() print '\tMax Value: ',ring_buffer.max() print '\tMean Value: ',ring_buffer.mean() print '\tStandard Deviation: ',ring_buffer.std() print '\tFirst 3 Elements: ',ring_buffer[:3] print '\tLast 3 Elements: ',ring_buffer[-3:]
print('+ TextStim INIT Dur (secs):\t%.3f' % (textstim_init_dur / 1000.0)) print( '+ Text Change Flip Perc:\t%.2f' % ((1.0 / chng_txt_each_flips) * 100.0), r'%') print() print('+ Total Flip Count:\t\t', fcount) print('+ Test Duration (secs):\t\t%.3f' % (flip_time - demo_start)) print('+ FPS:\t\t\t\t%.3f' % (fcount / flip_time - demo_start)) print() print('+ Average Draw Call Durations (msec):') print() print('Text Object\tNo Txt Change\tTxt Change') print() print('%s\t\t%.3f\t\t%.3f' % (stim1_type, stim1_no_change_draw_times.mean(), stim1_txt_change_draw_times.mean())) print('%s\t%.3f\t\t%.3f' % (stim2_type, stim2_no_change_draw_times.mean(), stim2_txt_change_draw_times.mean())) print() print('+ %s / %s Draw Time Ratio:' % (stim1_type, stim2_type)) print() print('\tNo Txt Change\tTxt Change') print() print( 'Ratio\t%.3f\t\t%.3f' % (stim1_no_change_draw_times.mean() / stim2_no_change_draw_times.mean(), stim1_txt_change_draw_times.mean() / stim2_txt_change_draw_times.mean())) print() print('---------------------------------------')
if stim1 != stim2: if stim2_type == 'TextBox': print('+ TextBox INIT Dur (secs):\t%.3f'%(old_div(textbox_init_dur,1000.0))) else: print('+ TextStim INIT Dur (secs):\t%.3f'%(old_div(textstim_init_dur,1000.0))) print('+ Text Change Flip Perc:\t%.2f'%((old_div(1.0,chng_txt_each_flips))*100.0),r'%') print() print('+ Total Flip Count:\t\t',fcount) print('+ Test Duration (secs):\t\t%.3f'%(flip_time-demo_start)) print('+ FPS:\t\t\t\t%.3f'%(old_div(float(fcount),(flip_time-demo_start)))) print() print('+ Average Draw Call Durations (msec):') print() print('Text Object\tNo Txt Change\tTxt Change') print() print('%s\t\t%.3f\t\t%.3f'%(stim1_type, stim1_no_change_draw_times.mean(),stim1_txt_change_draw_times.mean())) print('%s\t%.3f\t\t%.3f'%(stim2_type, stim2_no_change_draw_times.mean(),stim2_txt_change_draw_times.mean())) print() print('+ %s / %s Draw Time Ratio:'%(stim1_type,stim2_type)) print() print('\tNo Txt Change\tTxt Change') print() print('Ratio\t%.3f\t\t%.3f'%(old_div(stim1_no_change_draw_times.mean(),stim2_no_change_draw_times.mean()), old_div(stim1_txt_change_draw_times.mean(),stim2_txt_change_draw_times.mean()))) print() print('---------------------------------------') core.quit()