Example #1
0
def chooseDataFile():
    """
    Shows a FileDialog and lets you select a .hdf5 file to open for processing.
    """
    script_dir = ioHub.module_directory(chooseDataFile)

    fdlg = ioHub.util.experiment.FileDialog(
        message="Select a ioHub DataStore Events File",
        defaultDir=script_dir,
        fileTypes=FileDialog.IODATA_FILES,
        display_index=0,
    )

    status, filePathList = fdlg.show()

    if status != FileDialog.OK_RESULT:
        print " Data File Selection Cancelled. Exiting..."
        sys.exit(0)

    return filePathList[0]
Example #2
0
File: run.py Project: peircej/ioHub
            self.hub.wait(0.010)
        ### End of experiment logic

# The below code should never need to be changed, unless you want to get command
# line arguements or something. Otherwise, just copy it as is to a new experiment
# python file.
if __name__ == "__main__":
    def main(configurationDirectory):
        """
        Creates an instance of the ExperimentRuntime class, checks for an experiment config file name parameter passed in via
        command line, and launches the experiment logic.
        """
        import sys
        if len(sys.argv)>1:
            configFile=sys.argv[1]
            runtime=ExperimentRuntime(configurationDirectory, configFile)
        else:
            runtime=ExperimentRuntime(configurationDirectory, "experiment_config.yaml")
    
        runtime.start()

    # The ioHub.module_directory function determines what the current directory is of
    # the function that is passed to it. It is more reliable when running scripts
    # via IDEs etc in terms of reporting the true file location. That is the claim
    # of the original function author at least. ;) It works, which is what matters.
    configurationDirectory=ioHub.module_directory(main)

    # run the main function, which starts the experiment runtime
    main(configurationDirectory)

Example #3
0
File: run.py Project: sckim/ioHub
        #plot the frameintervals
        pylab.plot(intervalsMS, '-')
        pylab.ylabel('t (ms)')
        pylab.xlabel('frame N')
        pylab.title(droppedString)

        pylab.subplot(1,3,3)
        pylab.hist(intervalsMS, 50, normed=0, histtype='stepfilled')
        pylab.xlabel('t (ms)')
        pylab.ylabel('n frames')
        pylab.title(distString)

        show()


##################################################################
def main(configurationDirectory):
    import sys
    if len(sys.argv)>1:
        configFile=unicode(sys.argv[1])
        runtime=ExperimentRuntime(configurationDirectory, configFile)
    else:
        runtime=ExperimentRuntime(configurationDirectory, "experiment_config.yaml")

    runtime.start()

if __name__ == "__main__":
    configurationDirectory=ioHub.module_directory(main)
    main(configurationDirectory)

Example #4
0
                                 IOHUB_IP_ADDRESS_V4=isValidIpAddress,
                                 IOHUB_DATE=isValidDateString)
###############################################

# load a support_settings_values.yaml

def loadYamlFile(yaml_file_path,print_file=False):
    yaml_file_contents=load(file(yaml_file_path,'r'), Loader=Loader)    
#    if print_file:
#        print 'yaml_file_contents:'
#        print 'file: ',yaml_file_path
#        print 'contents:'    
#        pprint(yaml_file_contents)    
    return yaml_file_contents
    
_current_dir=ioHub.module_directory(isValidString)

def buildConfigParamValidatorMapping(device_setting_validation_dict,param_validation_func_mapping,parent_name):
    for param_name,param_config in device_setting_validation_dict.iteritems():
        current_param_path=None
        if parent_name is None:
            current_param_path=param_name
        else:
            current_param_path="%s.%s"%(parent_name,param_name)
            
        keyword_validator_function=None        
        if isinstance(param_name,basestring):
            keyword_validator_function=CONFIG_VALIDATION_KEY_WORD_MAPPINGS.get(param_name,None)

        if keyword_validator_function:
            param_validation_func_mapping[parent_name]=keyword_validator_function,param_config