def referenceResults_example_test(self): ''' make sure main.referenceResults is extacting the correct references from data/example.dat ''' profile = main.extractProfiles(['data/example.dat'])[0] current = '' p, current, f = main.profileData(profile, current, None) ref = main.referenceResults([p]) assert ref[0][0] == False, 'incorrect extraction of overall reference result for data/example.dat' assert numpy.array_equal(ref[1][0], [False, False, False, False] ), 'incorrect extraction of verbose reference results for data/example.dat'
def referenceResults_example_test(self): ''' make sure main.referenceResults is extacting the correct references from data/example.dat ''' profile = main.extractProfiles(['data/example.dat'])[0] current = '' p, current, f = main.profileData(profile, current, None) ref = main.referenceResults([p]) assert ref[0][ 0] == False, 'incorrect extraction of overall reference result for data/example.dat' assert numpy.array_equal( ref[1][0], [False, False, False, False] ), 'incorrect extraction of verbose reference results for data/example.dat'
def processFile(fName): # run each test on each profile, and record its summary & verbose performance testResults = [] testVerbose = [] trueResults = [] trueVerbose = [] profileIDs = [] firstProfile = True currentFile = '' f = None # keep a list of only the profiles in this thread data.ds.threadProfiles = main.extractProfiles([fName]) data.ds.threadFile = fName for iprofile, pinfo in enumerate(data.ds.threadProfiles): # Load the profile data. p, currentFile, f = main.profileData(pinfo, currentFile, f) # Check that there are temperature data in the profile, otherwise skip. if p.var_index() is None: continue main.catchFlags(p) if np.sum(p.t().mask == False) == 0: continue # Run each test. for itest, test in enumerate(testNames): result = run(test, [p]) if firstProfile: testResults.append(result[0]) testVerbose.append(result[1]) else: testResults[itest].append(result[0][0]) testVerbose[itest].append(result[1][0]) firstProfile = False # Read the reference result. truth = main.referenceResults([p]) trueResults.append(truth[0][0]) trueVerbose.append(truth[1][0]) profileIDs.append(p.uid()) # testResults[i][j] now contains a flag indicating the exception raised by test i on profile j return trueResults, testResults, profileIDs
def processFile(fName): # run each test on each profile, and record its summary & verbose performance testResults = [] testVerbose = [] trueResults = [] trueVerbose = [] profileIDs = [] firstProfile = True currentFile = '' f = None # keep a list of only the profiles in this thread data.ds.threadProfiles = main.extractProfiles([fName]) for iprofile, pinfo in enumerate(data.ds.threadProfiles): # Load the profile data. p, currentFile, f = main.profileData(pinfo, currentFile, f) # Check that there are temperature data in the profile, otherwise skip. if p.var_index() is None: continue main.catchFlags(p) if np.sum(p.t().mask == False) == 0: continue # Run each test. for itest, test in enumerate(testNames): result = run(test, [p]) if firstProfile: testResults.append(result[0]) testVerbose.append(result[1]) else: testResults[itest].append(result[0][0]) testVerbose[itest].append(result[1][0]) firstProfile = False # Read the reference result. truth = main.referenceResults([p]) trueResults.append(truth[0][0]) trueVerbose.append(truth[1][0]) profileIDs.append(p.uid()) # testResults[i][j] now contains a flag indicating the exception raised by test i on profile j return trueResults, testResults, profileIDs