コード例 #1
0
ファイル: HDF5_converter.py プロジェクト: Mkarami3/UNet_FEM
            ("test", testPaths, config.TEST_HDF5)]

for (dType, paths, outputPath) in datasets:

    print("[INFO] building {}...".format(outputPath))
    dim_0 = config.data_shape[0]
    dim_1 = config.data_shape[1]
    dim_2 = config.data_shape[2]
    dim_3 = config.data_shape[3]
    writer = HDF5DatasetWriter(
        (len(paths), dim_0, dim_1, dim_2, dim_3),
        outputPath)  #Number of cells=1782 in 3 directions (x,y,z)

    widgets = [
        "Building Dataset: ",
        progressbar.Percentage(), " ",
        progressbar.Bar(), " ",
        progressbar.ETA()
    ]
    pbar = progressbar.ProgressBar(maxval=len(paths), widgets=widgets).start()

    for (i, path) in enumerate(paths):

        force, disp = Preprocessor.array_reshape(path,
                                                 config.data_shape,
                                                 channel_firtst=False)
        writer.add([force], [disp])
        pbar.update(i)

    pbar.finish()
    writer.close()
コード例 #2
0
        progressbar.Percentage(), " ",
        progressbar.Bar(), " ",
        progressbar.ETA()
    ]
    pbar = progressbar.ProgressBar(maxval=len(paths), widgets=widgets).start()

    for i in range(0, len(paths), step_size):

        forces_time_steps = np.zeros((step_size, data_shape[0], data_shape[1],
                                      data_shape[2], data_shape[3]))
        disps_time_steps = np.zeros((step_size, data_shape[0], data_shape[1],
                                     data_shape[2], data_shape[3]))
        meshfiles = paths[i:i + step_size]

        for (k, meshfile) in enumerate(meshfiles):
            force, disp, force_mean, disp_mean, force_std, disp_std = Preprocessor.array_reshape(
                meshfile, data_shape, channel_first)
            forces_time_steps[k, :, :, :, :] = force
            disps_time_steps[k, :, :, :, :] = disp

            F_mean_x.append(force_mean[0])
            F_mean_y.append(force_mean[1])
            F_mean_z.append(force_mean[2])
            F_std_x.append(force_std[0])
            F_std_y.append(force_std[1])
            F_std_z.append(force_std[2])

            disp_mean_x.append(disp_mean[0])
            disp_mean_y.append(disp_mean[1])
            disp_mean_z.append(disp_mean[2])
            disp_std_x.append(disp_std[0])
            disp_std_y.append(disp_std[1])