def checkUnitbase(ls): ls, XY1 = utilities.getXYData(ls) ls, XY2 = utilities.getXYData(ls) ls, XYl = checkUnitbase2(ls, XY1, XY2) ls, XYr = checkUnitbase2(ls, XY1, XY2) ls, XYm1 = checkUnitbase2(ls, XYl, XYr) ls, XYm2 = checkUnitbase2(ls, XY1, XY2) return (ls)
def checkThin(ls): ls = utilitiesModule.skipBlankLines(ls) if (ls == []): return (ls) ls, label = utilitiesModule.getStringValue('label', ls) ls, epsilon = utilitiesModule.getDoubleValue('epsilon', ls) ls, original = utilitiesModule.getXYData(ls) ls, answer = utilitiesModule.getXYData(ls) ls, dummy = utilitiesModule.getXYData(ls) thinned = original.thinDomain(epsilon) if (len(answer) != len(thinned)): raise Exception( '%s: len( answer ) = %d != len( thinned ) = %d for label = "%s"' % \ ( __file__, len( answer ), len( thinned ), label ) ) for i, xy in enumerate(answer): xc, yc = xy xp, yp = thinned[i] compareValues(label, i, xc, xp) compareValues(label, i, yc, yp) return (ls)
def checkUnitbase2(ls, XY1, XY2): global count ls, w = utilities.getDoubleValue('w', ls) ls, wMin = utilities.getDoubleValue('wMin', ls) ls, wMax = utilities.getDoubleValue('wMax', ls) ls, XY = utilities.getXYData(ls) XYC = pointwiseXY_C.unitbaseInterpolate(w, wMin, XY1, wMax, XY2, 1) utilities.compareXYs(count, 'unitbase', XY, XYC) count += 1 return (ls, XYC)
def getXYData(fileName, getParameters=False): global accuracy f = open(os.path.join(CPATH, fileName)) ls = f.readlines() f.close() if (getParameters): if ('accuracy' not in ls[0]): raise Exception('Sparse file missing "accuracy" data.') accuracy = float(ls.pop(0).split('=')[1]) xys = utilities.getXYData(ls)[1] return (xys)
def getData(ls): ls = utilities.skipBlankLines(ls) if (len(ls) == 0): return (None, None, None, None, None, None) label, accuracy = None, None label, ls = ls[0].strip(), ls[1:] if (label != '# Xs'): raise Exception('%s: missing line "# Xs": found "%s"' % (__file__, label)) ls, Xs = utilities.getXData(ls, '=') ls, accuracy = utilities.getDoubleValue('accuracy', ls) ls, biSectionMax = utilities.getDoubleValue('biSectionMax', ls) ls, data = utilities.getXYData(ls) return (ls, label, accuracy, biSectionMax, Xs, pointwiseXY_C.pointwiseXY_C(data, accuracy=accuracy))