This section tests the Full Pipeline - which runs on a single participant's data.
The process is as follows:
This process could then be run in a loop if desired over any data of interest, however, as will be shown in the next section, the batch_pipeline function provides a variety of functionality to make this largely unnecessary.
Note: If you've never used Jupyter Notebooks before, please see the Jupyter/IPython Notebook Quick Start Guide.
In [ ]:
# Import the library functions we're using
from cogrecon.core.full_pipeline import full_pipeline
from cogrecon.core.data_structures import TrialData, ParticipantData, AnalysisConfiguration
from cogrecon.core.tools import generate_random_test_points
# Set up visualization via matplotlib
%matplotlib inline
In [ ]:
# Test with random points
actual_coordinates, data_coordinates = generate_random_test_points()
data = ParticipantData([TrialData(actual_coordinates, data_coordinates)])
config = AnalysisConfiguration(debug_labels=['test', -1])
result = full_pipeline(data, config, visualize=True, visualization_extent=[[0., 1.], [0., 1.]])
This section tests the Batch Pipeline, which runs on a folder full of data files, automatically finding the appropriate files. The process is as follows:
Note that the batch_pipeline function has a variety of options to make locating and processing large groups of files easier. Some of the more critical inputs are:
Note: The batch_pipeline function can produce a significant number of logged outputs (mostly warnings about transformation functions). These outputs are generated via the logging library, and they can be supressed by uncommenting the following lines from the import cell:
import logging
logging.disable(logging.WARNING)
Note 2: Sometimes, the easygui.diropenbox prompt appears behind other active windows. Use ALT+TAB to easily find the window.
In [ ]:
from cogrecon.core.batch_pipeline import batch_pipeline
from cogrecon.core.data_structures import TrialData, ParticipantData, AnalysisConfiguration
import os, datetime, easygui
# import logging
# logging.disable(logging.WARNING)
In [ ]:
selected_directory = easygui.diropenbox() # Get a directory from the user
# Make the output filename just the current datatime
output_filename = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S") + '_touch_tbt_false.csv'
if selected_directory is not None: # If the user doesn't cancel the selection window
if os.path.exists(selected_directory): # If the directory exists
batch_pipeline(str(selected_directory), output_filename, collapse_trials=False, trial_by_trial_accuracy=False, actual_coordinate_prefixes=True, dimension=2)
elif selected_directory is not '':
logging.error('Directory not found.')
In [ ]: