Skip to content
Snippets Groups Projects
Commit 01d35511 authored by Brian Christopher Wasels's avatar Brian Christopher Wasels
Browse files

jetzt aber wirklich

parent f52852c7
No related branches found
No related tags found
No related merge requests found
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
import pyvista as pv import pyvista as pv
import numpy as np import numpy as np
import os import os
import numpy as np import numpy as np
import pyvista as pv import pyvista as pv
import torch import torch
import copy import copy
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
data =torch.load('E:/Data/damask3/UNet/Input/TD_norm_32_angles.pt') data =torch.load('E:/Data/damask3/UNet/Input/TD_norm_32_angles.pt')
p_mart =np.empty(len(data)) p_mart =np.empty(len(data))
for index in range(len(data)): for index in range(len(data)):
input,_ = data[index] input,_ = data[index]
input = copy.copy(input) input = copy.copy(input)
input = input.detach().numpy() input = input.detach().numpy()
p_mart[index]= np.sum(input[4,:,:,:])/input.size p_mart[index]= np.sum(input[4,:,:,:])/(input.size/6)
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
```
%% Cell type:code id: tags:
``` python
print(f'Minimum Mart percentage is:{p_mart.min()}') print(f'Minimum Mart percentage is:{p_mart.min()}')
print(f'Maximum Mart percentage is:{p_mart.max()}') print(f'Maximum Mart percentage is:{p_mart.max()}')
print(f'Mean Mart percentage is:{p_mart.mean()}') print(f'Mean Mart percentage is:{p_mart.mean()}')
``` ```
%% Output %% Output
Minimum Mart percentage is:0.0248870849609375 Minimum Mart percentage is:0.149322509765625
Maximum Mart percentage is:0.060089111328125 Maximum Mart percentage is:0.36053466796875
Mean Mart percentage is:0.04008708634526112 Mean Mart percentage is:0.24052251807156674
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
np.save('E:/Data/damask3/UNet/percentage_mart',p_mart) np.save('E:/Data/damask3/UNet/percentage_mart',p_mart)
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
path_to_folder ='E:/Data/Simulation_Output/OutputData_64' path_to_folder ='E:/Data/Simulation_Output/OutputData_64'
number_grains=np.empty(len(os.listdir(path_to_folder))) number_grains=np.empty(len(os.listdir(path_to_folder)))
for folder_id, folder in enumerate(os.listdir(path_to_folder)): for folder_id, folder in enumerate(os.listdir(path_to_folder)):
grid = pv.read(f'{path_to_folder}/{folder}/grid.vti') grid = pv.read(f'{path_to_folder}/{folder}/grid.vti')
number_grains[folder_id] = grid['material'].max() +1 number_grains[folder_id] = grid['material'].max() +1
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
np.save('E:/Data/damask3/UNet/Input/grain_numbers_64.npy',number_grains) np.save('E:/Data/damask3/UNet/Input/grain_numbers_64.npy',number_grains)
``` ```
......
...@@ -412,7 +412,7 @@ ...@@ -412,7 +412,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.9.10" "version": "3.9.5"
}, },
"orig_nbformat": 4 "orig_nbformat": 4
}, },
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment