def loadTableMappings(self): # create meta-data tables self.TABLES['EXPERIMENT_METADETA']=self.emrtFile.root.data_collection.experiment_meta_data self.TABLES['SESSION_METADETA']=self.emrtFile.root.data_collection.session_meta_data # log table self.TABLES['LOG_TABLE']=self.emrtFile.root.logs.ExperimentLog class_constant_strings=loadedDeviceClasses.keys() # create event tables if 'KEYBOARD' in class_constant_strings: self.TABLES['KEYBOARD_KEY']=self.emrtFile.root.data_collection.events.keyboard.KeyboardKeyEvent self.TABLES['KEYBOARD_CHAR']=self.emrtFile.root.data_collection.events.keyboard.KeyboardCharEvent if 'MOUSE' in class_constant_strings: self.TABLES['MOUSE_INPUT']=self.emrtFile.root.data_collection.events.mouse.MouseInputEvent if 'GAMEPAD' in class_constant_strings: self.TABLES['GAMEPAD_STATE_CHANGE']=self.emrtFile.root.data_collection.events.gamepad.GamePadStateChangeEvent if 'EXPERIMENT' in class_constant_strings: self.TABLES['MESSAGE']=self.emrtFile.root.data_collection.events.experiment.Message if 'ANALOGINPUT' in class_constant_strings: self.TABLES['MULTI_CHANNEL_ANALOG_INPUT']=self.emrtFile.root.data_collection.events.analog_input.MultiChannelAnalogInputEvent if 'EYETRACKER' in class_constant_strings: self.TABLES['MONOCULAR_EYE_SAMPLE']=self.emrtFile.root.data_collection.events.eyetracker.MonocularEyeSampleEvent self.TABLES['BINOCULAR_EYE_SAMPLE']=self.emrtFile.root.data_collection.events.eyetracker.BinocularEyeSampleEvent self.TABLES['FIXATION_START']=self.emrtFile.root.data_collection.events.eyetracker.FixationStartEvent self.TABLES['FIXATION_END']=self.emrtFile.root.data_collection.events.eyetracker.FixationEndEvent self.TABLES['SACCADE_START']=self.emrtFile.root.data_collection.events.eyetracker.SaccadeStartEvent self.TABLES['SACCADE_END']=self.emrtFile.root.data_collection.events.eyetracker.SaccadeEndEvent self.TABLES['BLINK_START']=self.emrtFile.root.data_collection.events.eyetracker.BlinkStartEvent self.TABLES['BLINK_END']=self.emrtFile.root.data_collection.events.eyetracker.BlinkEndEvent
def buildOutTemplate(self): self.emrtFile.title=DATA_FILE_TITLE self.emrtFile.FILE_VERSION=FILE_VERSION self.emrtFile.SCHEMA_DESIGNER=SCHEMA_AUTHORS self.emrtFile.SCHEMA_MODIFIED=SCHEMA_MODIFIED_DATE #CREATE GROUPS self.emrtFile.createGroup(self.emrtFile.root, 'analysis', title='Data Analysis Files, notebooks, scripts and saved results tables.') self.emrtFile.createGroup(self.emrtFile.root, 'data_collection', title='Data Collected from Experiment Sessions') self.flush() self.emrtFile.createGroup(self.emrtFile.root.data_collection, 'events', title='Events that occurred and were saved during the experiments.') self.emrtFile.createGroup(self.emrtFile.root.data_collection, 'condition_variables', title='Experiment DV and IVs used during and experiment session, or calculated and stored. In general, each row represents one trial of an experiment session.') self.flush() # CREATE TABLES dfilter = Filters(complevel=0, complib='zlib', shuffle=False, fletcher32=False) # filters = Filters(complevel=1, complib='blosc', shuffle=True, fletcher32=False) # create meta-data tables self.TABLES['CLASS_TABLE_MAPPINGS']=self.emrtFile.createTable(self.emrtFile.root,'class_table_mapping', ClassTableMappings, title='Mapping of ioObjects Classes to ioHub tables') self.TABLES['EXPERIMENT_METADETA']=self.emrtFile.createTable(self.emrtFile.root.data_collection,'experiment_meta_data', ExperimentMetaData, title='Different Experiments Paradigms that have been run') self.TABLES['SESSION_METADETA']=self.emrtFile.createTable(self.emrtFile.root.data_collection,'session_meta_data', SessionMetaData, title='Session run for the various experiments.') self.flush() # log table self.emrtFile.createGroup(self.emrtFile.root, 'logs', title='Logging Data') self.flush() self.TABLES['LOG_TABLE']=self.emrtFile.createTable(self.emrtFile.root.logs,'ExperimentLog', ExperimentLog, title='Experiment Logging Data') class_constant_strings=loadedDeviceClasses.keys() if 'KEYBOARD' in class_constant_strings: # create event tables self.emrtFile.createGroup(self.emrtFile.root.data_collection.events, 'keyboard', title='Keyboard Created Events') self.flush() self.TABLES['KEYBOARD_KEY']=self.emrtFile.createTable(self.emrtFile.root.data_collection.events.keyboard,'KeyboardKeyEvent', D.KeyboardKeyEvent.NUMPY_DTYPE, title='Keyboard Key Event Logging.', filters=dfilter.copy()) self.TABLES['KEYBOARD_CHAR']=self.emrtFile.createTable(self.emrtFile.root.data_collection.events.keyboard,'KeyboardCharEvent', D.KeyboardCharEvent.NUMPY_DTYPE, title='Keyboard Char Event Logging.', filters=dfilter.copy()) self.flush() self.addClassMapping(D.KeyboardPressEvent,self.TABLES['KEYBOARD_KEY']) self.addClassMapping(D.KeyboardReleaseEvent,self.TABLES['KEYBOARD_KEY']) self.addClassMapping(D.KeyboardCharEvent,self.TABLES['KEYBOARD_CHAR']) if 'MOUSE' in class_constant_strings: self.emrtFile.createGroup(self.emrtFile.root.data_collection.events, 'mouse', title='Mouse Device Created Events') self.flush() self.TABLES['MOUSE_INPUT']=self.emrtFile.createTable(self.emrtFile.root.data_collection.events.mouse,'MouseInputEvent', D.MouseInputEvent.NUMPY_DTYPE, title='Mouse Event Logging.', filters=dfilter.copy()) self.addClassMapping(D.MouseMoveEvent,self.TABLES['MOUSE_INPUT']) self.addClassMapping(D.MouseDragEvent,self.TABLES['MOUSE_INPUT']) self.addClassMapping(D.MouseScrollEvent,self.TABLES['MOUSE_INPUT']) self.addClassMapping(D.MouseButtonReleaseEvent,self.TABLES['MOUSE_INPUT']) self.addClassMapping(D.MouseButtonPressEvent,self.TABLES['MOUSE_INPUT']) self.addClassMapping(D.MouseMultiClickEvent,self.TABLES['MOUSE_INPUT']) if 'GAMEPAD' in class_constant_strings: self.emrtFile.createGroup(self.emrtFile.root.data_collection.events, 'gamepad', title='GamePad Created Events') self.flush() self.TABLES['GAMEPAD_STATE_CHANGE']=self.emrtFile.createTable(self.emrtFile.root.data_collection.events.gamepad,'GamePadStateChangeEvent', D.GamepadStateChangeEvent.NUMPY_DTYPE, title='GamePad Multi-State Change Event Logging.') self.addClassMapping(D.GamepadStateChangeEvent,self.TABLES['GAMEPAD_STATE_CHANGE']) self.addClassMapping(D.GamepadDisconnectEvent,self.TABLES['GAMEPAD_STATE_CHANGE']) if 'ANALOGINPUT' in class_constant_strings: self.emrtFile.createGroup(self.emrtFile.root.data_collection.events, 'analog_input', title='AnalogInput Device Created Events') self.flush() self.TABLES['MULTI_CHANNEL_ANALOG_INPUT']=self.emrtFile.createTable(self.emrtFile.root.data_collection.events.analog_input,'MultiChannelAnalogInputEvent', D.MultiChannelAnalogInputEvent.NUMPY_DTYPE, title='Multiple Channel Analog Input Event Logging.',expectedrows=3637200000, filters=dfilter.copy()) # 20 hours of 1000 Hz samples self.flush() #self.addClassMapping(D.DASingleChannelInputEvent,self.TABLES['DA_SINGLE_CHANNEL_INPUT']) self.addClassMapping(D.MultiChannelAnalogInputEvent,self.TABLES['MULTI_CHANNEL_ANALOG_INPUT']) if 'EXPERIMENT' in class_constant_strings: self.emrtFile.createGroup(self.emrtFile.root.data_collection.events, 'experiment', title='Experiment Generated Events') self.flush() self.TABLES['MESSAGE']=self.emrtFile.createTable(self.emrtFile.root.data_collection.events.experiment,'Message', D.MessageEvent.NUMPY_DTYPE, title='Experiment Message Event Logging.', filters=dfilter.copy()) self.addClassMapping(D.MessageEvent,self.TABLES['MESSAGE']) if 'EYETRACKER' in class_constant_strings: self.emrtFile.createGroup(self.emrtFile.root.data_collection.events, 'eyetracker', title='Eye Tracker Generated Events') self.flush() self.TABLES['MONOCULAR_EYE_SAMPLE']=self.emrtFile.createTable(self.emrtFile.root.data_collection.events.eyetracker,'MonocularEyeSampleEvent', D.MonocularEyeSampleEvent.NUMPY_DTYPE, title='Monocular Eye Samples',expectedrows=3637200000, filters=dfilter.copy()) self.TABLES['BINOCULAR_EYE_SAMPLE']=self.emrtFile.createTable(self.emrtFile.root.data_collection.events.eyetracker,'BinocularEyeSampleEvent', D.BinocularEyeSampleEvent.NUMPY_DTYPE, title='Binocular Eye Samples',expectedrows=3637200000, filters=dfilter.copy()) self.TABLES['FIXATION_START']=self.emrtFile.createTable(self.emrtFile.root.data_collection.events.eyetracker,'FixationStartEvent', D.FixationStartEvent.NUMPY_DTYPE, title='Fixation Start Events', filters=dfilter.copy()) self.TABLES['FIXATION_END']=self.emrtFile.createTable(self.emrtFile.root.data_collection.events.eyetracker,'FixationEndEvent', D.FixationEndEvent.NUMPY_DTYPE, title='Fixation End Events', filters=dfilter.copy()) self.TABLES['SACCADE_START']=self.emrtFile.createTable(self.emrtFile.root.data_collection.events.eyetracker,'SaccadeStartEvent', D.SaccadeStartEvent.NUMPY_DTYPE, title='Saccade Start Events', filters=dfilter.copy()) self.TABLES['SACCADE_END']=self.emrtFile.createTable(self.emrtFile.root.data_collection.events.eyetracker,'SaccadeEndEvent', D.SaccadeEndEvent.NUMPY_DTYPE, title='Saccade End Events', filters=dfilter.copy()) self.TABLES['BLINK_START']=self.emrtFile.createTable(self.emrtFile.root.data_collection.events.eyetracker,'BlinkStartEvent', D.BlinkStartEvent.NUMPY_DTYPE, title='Blink Start Events', filters=dfilter.copy()) self.TABLES['BLINK_END']=self.emrtFile.createTable(self.emrtFile.root.data_collection.events.eyetracker,'BlinkEndEvent', D.BlinkEndEvent.NUMPY_DTYPE, title='Blink End Events', filters=dfilter.copy()) self.addClassMapping(D.MonocularEyeSampleEvent,self.TABLES['MONOCULAR_EYE_SAMPLE']) self.addClassMapping(D.BinocularEyeSampleEvent,self.TABLES['BINOCULAR_EYE_SAMPLE']) self.addClassMapping(D.FixationStartEvent,self.TABLES['FIXATION_START']) self.addClassMapping(D.FixationEndEvent,self.TABLES['FIXATION_END']) self.addClassMapping(D.SaccadeStartEvent,self.TABLES['SACCADE_START']) self.addClassMapping(D.SaccadeEndEvent,self.TABLES['SACCADE_END']) self.addClassMapping(D.BlinkStartEvent,self.TABLES['BLINK_START']) self.addClassMapping(D.BlinkEndEvent,self.TABLES['BLINK_END']) self.flush()