Exemple #1
0
    def test_fakeVel3D(self):

        io = IO(os.path.dirname(__file__) + "/data_for_testing_3D", ext="npz")
        fakeVels, fakePressures, fakeOccupancy = io.readAll()

        self.assertTrue(fakeVels[0].tolist(), self.fakeVel3D.tolist())
        self.assertTrue(fakePressures[0].tolist(),
                        self.fakePressure3D.tolist())
        self.assertTrue(fakeOccupancy[0].tolist(),
                        self.fakeOccupancy3D.tolist())
Exemple #2
0
res_z = 48
ngrids = 150

sims = [str(x) for x in args.training_director_folder.iterdir() if x.is_dir()]
nsims = len(sims)

nn_input = np.zeros((nsims, 40 * res_x * res_y * res_z, 19))
nn_output = np.zeros((nsims, 40 * res_x * res_y * res_z))

for i, sim_name in enumerate(sims):
    pprint("-----------------------------------------------------------")
    pprint("Loading data from simulation: {}".format(sim_name))

    f_in = IO(sim_name, ext="npz")

    pressure_fields, vel_fields, occupancy_grids = f_in.readAll()

    vel_fields = vel_fields.reshape((ngrids, res_x, res_y, res_z))
    pressure_fields = pressure_fields.reshape(
        (ngrids, res_x, res_y, res_z))
    occupancy_grids = occupancy_grids.reshape(
        (ngrids, res_x, res_y, res_z))

    nn_input[i], nn_output[i] = loadData(
        vel_fields=vel_fields,
        pressure_fields=pressure_fields,
        occupancy_grids=occupancy_grids
    )

    pprint("-----------------------------------------------------------")