Beispiel #1
0
    def reatInput_dne_test(self):
        '''
        main.readInput should raise exceptions if listed files don't exist
        '''

        try:
            main.readInput('dne.json')
        except AssertionError:
            assert True
            return

        assert False, "readInput failed to raise an exception when a listed data file was not found."
Beispiel #2
0
    def readInput_list_test(self):
        '''
        main.readInput should assert it gets a list back
        '''

        try:
            main.readInput('notalist.json')
        except AssertionError:
            assert True
            return

        assert False, "readInput failed to raise an exception when given json that wasn't a list"
Beispiel #3
0
    def reatInput_dne_test(self):
        '''
        main.readInput should raise exceptions if listed files don't exist
        '''

        try:
            main.readInput('dne.json')
        except AssertionError:
            assert True
            return

        assert False, "readInput failed to raise an exception when a listed data file was not found."
Beispiel #4
0
    def readInput_list_test(self):
        '''
        main.readInput should assert it gets a list back
        '''

        try:
            main.readInput('notalist.json')
        except AssertionError:
            assert True
            return

        assert False, "readInput failed to raise an exception when given json that wasn't a list"
Beispiel #5
0
    def setUp(self):
        filenames = main.readInput('datafiles.json')
        profiles = main.extractProfiles(filenames)

        # identify and import tests
        testNames = main.importQC('qctests')
        testNames.sort()
        for testName in testNames:
            exec('from qctests import ' + testName)

        # Set up any keyword arguments needed by tests.
        kwargs = {'profiles': profiles}

        testResults = []
        testVerbose = []
        trueResults = []
        trueVerbose = []
        firstProfile = True
        delete = []
        currentFile = ''
        self.profiles = []
        for iprofile, pinfo in enumerate(profiles):
            # Load the profile data.
            if pinfo.file_name != currentFile:
                if currentFile != '': f.close()
                currentFile = pinfo.file_name
                f = open(currentFile)
            if f.tell() != pinfo.file_position: f.seek(pinfo.file_position)
            self.profiles.append(wod.WodProfile(f))
Beispiel #6
0
   def setUp(self):
        filenames = main.readInput('datafiles.json')
        profiles = main.extractProfiles(filenames)

        # identify and import tests
        testNames = main.importQC('qctests')
        testNames.sort()
        for testName in testNames:
          exec('from qctests import ' + testName)

        # Set up any keyword arguments needed by tests.
        kwargs = {'profiles' : profiles}

        testResults  = []
        testVerbose  = []
        trueResults  = []
        trueVerbose  = []
        firstProfile = True
        delete       = []
        currentFile  = ''
        self.profiles = []
        for iprofile, pinfo in enumerate(profiles):
          # Load the profile data.
          if pinfo.file_name != currentFile:
            if currentFile != '': f.close()
            currentFile = pinfo.file_name
            f = open(currentFile)
          if f.tell() != pinfo.file_position: f.seek(pinfo.file_position)
          self.profiles.append(wod.WodProfile(f))
Beispiel #7
0
# main
########################################

if len(sys.argv) > 2:
    # Identify and import tests
    testNames = main.importQC('qctests')
    testNames.sort()
    print('{} quality control checks have been found'.format(len(testNames)))
    testNames = main.checkQCTestRequirements(testNames)
    print('{} quality control checks are able to be run:'.format(
        len(testNames)))
    for testName in testNames:
        print('  {}'.format(testName))

    # Identify data files and create a profile list.
    filenames = main.readInput('datafiles.json')
    profiles = main.extractProfiles(filenames)
    data.ds.profiles = profiles
    print('\n{} file(s) will be read containing {} profiles'.format(
        len(filenames), len(profiles)))

    # Parallel processing.
    print('\nPlease wait while QC is performed\n')
    processFile.parallel = main.parallel_function(processFile, sys.argv[2])
    parallel_result = processFile.parallel(filenames)

    # Recombine results
    truth, results, profileIDs = main.combineArrays(parallel_result)

    # Print summary statistics and write output file.
    main.printSummary(truth, results, testNames)
Beispiel #8
0
########################################
# main
########################################

if len(sys.argv)>2:
  # Identify and import tests
  testNames = main.importQC('qctests')
  testNames.sort()
  print('{} quality control checks have been found'.format(len(testNames)))
  testNames = main.checkQCTestRequirements(testNames)
  print('{} quality control checks are able to be run:'.format(len(testNames)))
  for testName in testNames:
    print('  {}'.format(testName))

  # Identify data files and create a profile list.
  filenames = main.readInput('datafiles.json')
  profiles  = main.extractProfiles(filenames)
  data.ds.profiles = profiles
  print('\n{} file(s) will be read containing {} profiles'.format(len(filenames), len(profiles)))

  # Parallel processing.
  print('\nPlease wait while QC is performed\n')
  processFile.parallel = main.parallel_function(processFile, sys.argv[2])
  parallel_result = processFile.parallel(filenames)

  # Recombine results
  truth, results, profileIDs = main.combineArrays(parallel_result)

  # Print summary statistics and write output file.
  main.printSummary(truth, results, testNames)
  main.generateCSV(truth, results, testNames, profileIDs, sys.argv[1])