コード例 #1
0
ファイル: reformat.py プロジェクト: 9173860/psychopy
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 01 09:32:29 2013

@author: Sol
"""

from psychopy.iohub.datastore.pandas import ioHubPandasDataView

file_name='io_stroop.hdf5'
event_type='all'
output_format='xls'

exp_data=ioHubPandasDataView(file_name)

outputformat2pandaswrite={'csv':'to_csv','xls':'to_excel','html':'to_html'}

out_name=file_name+'.'+output_format
sep_index=file_name.rfind(u'.')
if sep_index>=0:
    out_name=file_name[:sep_index]+'.'+output_format   

print 'Saving %s to %s....'%(file_name,out_name)    
getattr(exp_data.all_events,outputformat2pandaswrite[output_format])(out_name)
print 'Conversion complete.'


exp_data.close()
コード例 #2
0
# -*- coding: utf-8 -*-
"""
Demonstrates how to use two Condition Variables to specify a temporal filter
based on a start and end time. With the ConditionVariableBasedIP two columns of the
condition variables are used for each start time and each end time; forming the
instances of the IP. 

@author: Sol
"""
from __future__ import print_function

from psychopy.iohub.datastore.pandas import ioHubPandasDataView
from psychopy.iohub.datastore.pandas.interestperiod import ConditionVariableBasedIP

exp_data=ioHubPandasDataView('io_stroop.hdf5')

# Display the first 20 unfiltered MOUSE_MOVE events
print('** KEYBOARD_PRESS Events (first 20):')
print() 
print(exp_data.KEYBOARD_PRESS.head(20))
print()

# Create a Condition Variable based Interest Period. 
# Interest Periods define a start and end time; any events that have a 
# time >= an IP start time and <= an IP end time would be kept after 
# filtering with the IP. When a ConditionVariableBasedIP is used, you
# provide the exp_data.condition_variables data frame and the name of the 
# condition values column that wil be used to read the ip start and end times from.
#
ip=ConditionVariableBasedIP(name='cv_ip',source_df=exp_data.condition_variables,
                       start_col_name='TRIAL_START',
コード例 #3
0
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 01 09:32:29 2013

@author: Sol
"""
from __future__ import print_function

from psychopy.iohub.datastore.pandas import ioHubPandasDataView

file_name = 'io_stroop.hdf5'
event_type = 'all'
output_format = 'xls'

exp_data = ioHubPandasDataView(file_name)

outputformat2pandaswrite = {
    'csv': 'to_csv',
    'xls': 'to_excel',
    'html': 'to_html'
}

out_name = file_name + '.' + output_format
sep_index = file_name.rfind(u'.')
if sep_index >= 0:
    out_name = file_name[:sep_index] + '.' + output_format

print('Saving %s to %s....' % (file_name, out_name))
getattr(exp_data.all_events, outputformat2pandaswrite[output_format])(out_name)
print('Conversion complete.')