Example #1
0
setDebugLevel(1)
if not basePath.endswith("/"): basePath = basePath + "/"

if savenpz or saveuni or saveppm:
    folderNo = simNo
    simPath, simNo = ph.getNextSimPath(simNo, basePath)

    # add some more info for json file
    ph.paramDict["simNo"] = simNo
    ph.paramDict["type"] = "smoke"
    ph.paramDict["name"] = "gen6combined"
    ph.paramDict["version"] = printBuildInfo()
    ph.paramDict["creation_date"] = datetime.now().strftime(
        "%Y-%m-%d %H:%M:%S")
    ph.writeParams(simPath + "description.json")  # export sim parameters

    sys.stdout = ph.Logger(simPath)
    print("Called on machine '" + os.uname()[1] + "' with: " +
          str(" ".join(sys.argv)))
    print("Saving to " + simPath + ", " + str(simNo))
    # optional , backupFile(__file__, simPath)

if (npSeed < 0):
    npSeed = np.random.randint(0, 2**32 - 1)
print("Random seed %d" % npSeed)
np.random.seed(npSeed)

# Init solvers -------------------------------------------------------------------#
sm_gs = vec3(res, res, res)
xl_gs = sm_gs * float(scaleFactor)
Example #2
0
            out_path_prefix, 0, basePath + 'test_%04d/' % load_model_test)
    else:
        test_path, load_model_test_new = ph.getNextTestPath(
            testPathStartNo, basePath)

else:
    test_path, load_model_test_new = ph.getNextTestPath(
        testPathStartNo, basePath)

# logging & info
sys.stdout = ph.Logger(test_path)
print('Note: {}'.format(note))
print("\nCalled on machine '" + os.uname()[1] + "' with: " +
      str(" ".join(sys.argv)))
print("\nUsing parameters:\n" + ph.paramsToString())
ph.writeParams(test_path +
               "params.json")  # export parameters in human readable format

if outputOnly:
    print('*****OUTPUT ONLY*****')

# ---------------------------------------------
# TENSORFLOW SETUP

import scipy.misc


def save_img(out_path, img):
    img = np.clip(img * 255.0, 0, 255).astype(np.uint8)
    scipy.misc.imsave(out_path, img)