Beispiel #1
0
            print traceback.extract_tb(sys.exc_info()[-1])
            print "*** Fail to generate %s" % (mv)
            raise Exception("*** Fail to get mean and std. %s" % (line))

    else:
        print "===== Skip calculating mean and variance ====="

    if step3 == 1:
        print "===== Normalize data.nc ====="
        assert os.path.isfile(mv), "*** Fail to locate %s" % (mv)

        with open(datascp, 'r') as filePtr:
            for idx, line in enumerate(filePtr):
                flagDataValid = True
                line = line.rstrip('\n')
                assert os.path.isfile(line), "Can't find %s" % (line)
                try:
                    nc.norm(line,
                            mv,
                            flagKeepOri=0,
                            addMV=addMV,
                            mask=normMask)
                except:
                    print "Unexpected error:", sys.exc_info()[0]
                    print traceback.extract_tb(sys.exc_info()[-1])
                    raise Exception("*** Fail to norm %s" % (line))
                    flagDataValid = False
                    print "*** Not sure where %s is still valid" % (line)
    else:
        print "===== skip Normalizing data.nc ====="
Beispiel #2
0
        try:
            nc.meanStd(datascp, mv, normMethod)
        except:
            print "Unexpected error:", sys.exc_info()[0]
            print traceback.extract_tb(sys.exc_info()[-1])
            print "*** Fail to generate %s" % (mv)
            raise Exception("*** Fail to get mean and std. %s" % (line))

    else:
        print "===== Skip calculating mean and variance ====="

    if step3==1:
        print "===== Normalize data.nc ====="
        assert os.path.isfile(mv), "*** Fail to locate %s" % (mv)

        with open(datascp, 'r') as filePtr:
            for idx, line in enumerate(filePtr):
                flagDataValid = True
                line = line.rstrip('\n')
                assert os.path.isfile(line), "Can't find %s" % (line)
                try:
                    nc.norm(line, mv, flagKeepOri=0, addMV=addMV, mask=normMask)
                except:
                    print "Unexpected error:", sys.exc_info()[0]
                    print traceback.extract_tb(sys.exc_info()[-1])
                    raise Exception("*** Fail to norm %s" % (line))
                    flagDataValid = False
                    print "*** Not sure where %s is still valid" % (line) 
    else:
        print "===== skip Normalizing data.nc ====="