wolfhece 2.2.6__py3-none-any.whl → 2.2.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wolfhece/PyVertex.py +43 -0
- wolfhece/__init__.py +12 -1
- wolfhece/apps/version.py +1 -1
- wolfhece/drowning_victims/drowning_functions.py +47 -47
- wolfhece/wolf_array.py +16 -3
- {wolfhece-2.2.6.dist-info → wolfhece-2.2.7.dist-info}/METADATA +1 -1
- {wolfhece-2.2.6.dist-info → wolfhece-2.2.7.dist-info}/RECORD +10 -10
- {wolfhece-2.2.6.dist-info → wolfhece-2.2.7.dist-info}/WHEEL +0 -0
- {wolfhece-2.2.6.dist-info → wolfhece-2.2.7.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.2.6.dist-info → wolfhece-2.2.7.dist-info}/top_level.txt +0 -0
wolfhece/PyVertex.py
CHANGED
@@ -178,6 +178,28 @@ class wolfvertex:
|
|
178
178
|
self.values = {}
|
179
179
|
self.values[id] = value
|
180
180
|
|
181
|
+
def add_value(self, id, value):
|
182
|
+
"""
|
183
|
+
Add a set of values to the vertex
|
184
|
+
|
185
|
+
:param id: key of the value
|
186
|
+
:param value: value to add
|
187
|
+
"""
|
188
|
+
|
189
|
+
self.addvalue(id, value)
|
190
|
+
|
191
|
+
def add_values(self, values:dict):
|
192
|
+
"""
|
193
|
+
Add a set of values to the vertex
|
194
|
+
|
195
|
+
:param values: dictionary of values to add
|
196
|
+
"""
|
197
|
+
|
198
|
+
if self.values is None:
|
199
|
+
self.values = {}
|
200
|
+
for key, value in values.items():
|
201
|
+
self.values[key] = value
|
202
|
+
|
181
203
|
def getvalue(self, id):
|
182
204
|
"""
|
183
205
|
Return a value from the vertex
|
@@ -191,6 +213,27 @@ class wolfvertex:
|
|
191
213
|
else:
|
192
214
|
return None
|
193
215
|
|
216
|
+
def get_value(self, id):
|
217
|
+
"""
|
218
|
+
Return a set of values from the vertex
|
219
|
+
|
220
|
+
:param id: key of the value
|
221
|
+
"""
|
222
|
+
|
223
|
+
return self.getvalue(id)
|
224
|
+
|
225
|
+
def get_values(self, ids:list) -> dict:
|
226
|
+
"""
|
227
|
+
Return a set of values from the vertex
|
228
|
+
"""
|
229
|
+
|
230
|
+
ret = {}
|
231
|
+
for id in ids:
|
232
|
+
if id in self.values.keys():
|
233
|
+
ret[id] = self.values[id]
|
234
|
+
|
235
|
+
return ret
|
236
|
+
|
194
237
|
def limit2bounds(self, bounds=None):
|
195
238
|
"""
|
196
239
|
Limit the vertex to a set of bounds
|
wolfhece/__init__.py
CHANGED
@@ -1 +1,12 @@
|
|
1
|
-
from . import _add_path
|
1
|
+
from . import _add_path
|
2
|
+
|
3
|
+
try:
|
4
|
+
from osgeo import gdal, osr
|
5
|
+
gdal.UseExceptions()
|
6
|
+
except ImportError as e:
|
7
|
+
print(e)
|
8
|
+
raise Exception(_('Error importing GDAL library'))
|
9
|
+
|
10
|
+
from .apps.version import WolfVersion
|
11
|
+
|
12
|
+
__version__ = WolfVersion().get_version()
|
wolfhece/apps/version.py
CHANGED
@@ -4,7 +4,6 @@ import math
|
|
4
4
|
from scipy.stats import beta
|
5
5
|
from scipy.optimize import fsolve
|
6
6
|
import random
|
7
|
-
from wolfgpu.glsimulation import ResultsStore
|
8
7
|
from pathlib import Path
|
9
8
|
import json
|
10
9
|
import wx
|
@@ -12,6 +11,11 @@ import queue
|
|
12
11
|
import os
|
13
12
|
import logging
|
14
13
|
|
14
|
+
try:
|
15
|
+
from wolfgpu.glsimulation import ResultsStore
|
16
|
+
except ImportError:
|
17
|
+
print("wolfgpu not available")
|
18
|
+
|
15
19
|
EPS = 0.15
|
16
20
|
G = [0, 0, -9.81]
|
17
21
|
P_ATM = 101325 # Pa
|
@@ -19,7 +23,7 @@ RHO_F = 1000
|
|
19
23
|
|
20
24
|
def beta_find(x, *data):
|
21
25
|
"""
|
22
|
-
Iterative function that finds the parameters alpha and beta defining a beta distribution and scales it in a range.
|
26
|
+
Iterative function that finds the parameters alpha and beta defining a beta distribution and scales it in a range.
|
23
27
|
The function fits the parameters based on two given percentiles of the data.
|
24
28
|
|
25
29
|
:param x: Array containing initial guesses for alpha and beta.
|
@@ -47,7 +51,7 @@ def beta_find(x, *data):
|
|
47
51
|
|
48
52
|
def Body_motion(a_RK, batch_turb, CFL, Delta, epsilon, H_pre, H_post, Human, k, NbX, NbY, Pos_bp, resurface, sinking, time_b, t_Wolf_pre, t_Wolf_post, time_goal, U_bp, Ux_pre, Ux_post, Uy_pre, Uy_post, Z_param):
|
49
53
|
"""
|
50
|
-
Function calculating the motion of the body at each time step using a Runge-Kutta method.
|
54
|
+
Function calculating the motion of the body at each time step using a Runge-Kutta method.
|
51
55
|
From body position, velocity and flow environment, the function determines the flow velocity at the body position and calculates its new velocities, checking for collisions with walls.
|
52
56
|
|
53
57
|
:param a_RK: Runge-Kutta coefficient.
|
@@ -115,7 +119,7 @@ def Body_motion(a_RK, batch_turb, CFL, Delta, epsilon, H_pre, H_post, Human, k,
|
|
115
119
|
|
116
120
|
## Get the velocity at exact time and horizontal position of each run, most time consuming function of the drowning calculation
|
117
121
|
[du_insta,_,_,H_f,k_f,U_x_vec,U_y_vec,walls] = interp_mailles_mat(Delta,epsilon,H_pre,H_post,index_bp,k,NbX,NbY,Pos_RK[j,:,:],t_Wolf_perc,t_Wolf_perc_insta,Ux_pre,Ux_post,Uy_pre,Uy_post)
|
118
|
-
|
122
|
+
|
119
123
|
## Parameters and calculations to have the velocity at the body vertical position and its relative velocity
|
120
124
|
l_tilde = EPS/H_f
|
121
125
|
z = np.clip(Pos_RK[j, :, -1],EPS, H_f)
|
@@ -144,12 +148,12 @@ def Body_motion(a_RK, batch_turb, CFL, Delta, epsilon, H_pre, H_post, Human, k,
|
|
144
148
|
|
145
149
|
t_Wolf_perc += dt/dt_Wolf
|
146
150
|
|
147
|
-
|
151
|
+
|
148
152
|
U_b = (1-a_RK)*U_RK[0,:,:] + a_RK*U_RK[1,:,:]
|
149
153
|
Pos_b = (1-a_RK)*Pos_RK[0,:,:] + a_RK*Pos_RK[1,:,:]
|
150
154
|
|
151
155
|
time_b += dt
|
152
|
-
|
156
|
+
|
153
157
|
## Check and corrections for collisions with walls
|
154
158
|
index_b = ((np.floor(Pos_b[:,:2].T / Delta[0:2,None])).T).astype(int)
|
155
159
|
walls = (H_pre[index_b[:,1], index_b[:,0]] < EPS)
|
@@ -161,11 +165,11 @@ def Body_motion(a_RK, batch_turb, CFL, Delta, epsilon, H_pre, H_post, Human, k,
|
|
161
165
|
ind_walls = np.where(walls)[0]
|
162
166
|
U_b[ind_walls,0:2] = 0
|
163
167
|
|
164
|
-
|
168
|
+
|
165
169
|
## Storage of times when bodies sank and resurfaced
|
166
170
|
sinking[:,0] = sinking[:,0] + (sinking[:,0]==0)*(Pos_b[:,2] == EPS)*(U_b[:,2]==0) * Pos_b[:,0]
|
167
171
|
sinking[:,1] = sinking[:,1] + (sinking[:,1]==0)*(Pos_b[:,2] == EPS)*(U_b[:,2]==0) * time_b
|
168
|
-
|
172
|
+
|
169
173
|
H_f = H_f.ravel()
|
170
174
|
V_b = V_b.ravel()
|
171
175
|
resurface[:,0] = resurface[:,0] + (resurface[:,0]==0)*(Pos_b[:,2] >= H_f-0.5)*(m_b/V_b/RHO_F<1) * Pos_b[:,0]
|
@@ -196,14 +200,14 @@ def Body_temperature(BSA, mass, T_w, t):
|
|
196
200
|
Res = 3000
|
197
201
|
|
198
202
|
T_b = T_w + (T_body_ini - T_w)*np.exp(-t/Res)
|
199
|
-
|
203
|
+
|
200
204
|
ADD = ((T_body_ini - T_w) * Res * (1 - np.exp(-t / Res)) + T_w * t)/3600/24 #Integral of the body temperature as a function of time, ADD in [°C.day]
|
201
205
|
|
202
206
|
return ADD,T_b
|
203
207
|
|
204
208
|
def Body_volume_variation(alpha_1, BSA, FRC, H_f, m_b, time_b, T_w, TLC, V_b0, V_clothes1, V_clothes2, z):
|
205
209
|
"""
|
206
|
-
Function calculating the body volume variation due to the putrefaction gases.
|
210
|
+
Function calculating the body volume variation due to the putrefaction gases.
|
207
211
|
The method is described in Delhez et al. 2025, "Predicting the buoyancy and Postmortem Submersion Interval of victims of river drowning".
|
208
212
|
|
209
213
|
:param alpha_1: Alpha parameter.
|
@@ -225,18 +229,18 @@ def Body_volume_variation(alpha_1, BSA, FRC, H_f, m_b, time_b, T_w, TLC, V_b0, V
|
|
225
229
|
p_ext = P_ATM+p_hydro
|
226
230
|
V_s = V_b0 - FRC #fraction of FRC on the whole body volume
|
227
231
|
n_0 = P_ATM*FRC/(8.3144621*(37+273.15)) #initial amount of gas in the lungs, perfect gas law
|
228
|
-
|
232
|
+
|
229
233
|
ADD = time_b/60/60/24 * T_w
|
230
234
|
_,T_b = Body_temperature(BSA,m_b,T_w,time_b) #Consideration of the actual body temperature
|
231
235
|
ratio_ADD = ADD/alpha_1
|
232
|
-
|
236
|
+
|
233
237
|
n_1 = 2*P_ATM * TLC/(8.3144621*(T_w+273.15))
|
234
238
|
coef_eta = [10,-15,6]
|
235
239
|
eta = n_1*(coef_eta[2]*(ratio_ADD)**5+coef_eta[1]*(ratio_ADD)**4+coef_eta[0]*(ratio_ADD)**3)
|
236
240
|
eta = np.minimum(eta,n_1)
|
237
|
-
|
241
|
+
|
238
242
|
V_clothes = np.where(T_w < 15, V_clothes1, V_clothes2)
|
239
|
-
|
243
|
+
|
240
244
|
V_comp = (n_0+eta/n_1*(n_1-n_0))*8.3144621*(T_b+273.15)/(p_ext) #Compressible Volume
|
241
245
|
V_b = V_s + V_comp + V_clothes
|
242
246
|
|
@@ -287,7 +291,7 @@ def Flow_time_t(batch_turb, dt, epsilon, H_f, k, turb_type, U_bp, U_x_vec, U_y_v
|
|
287
291
|
"""
|
288
292
|
U_x_dif = (U_x_vec-U_bp[:,0])
|
289
293
|
U_y_dif = (U_y_vec-U_bp[:,1])
|
290
|
-
U_x_vec,U_y_vec = U_turbulence(batch_turb,dt,epsilon,H_f,k,turb_type,U_x_vec,U_x_dif,U_y_vec,U_y_dif,z,z_0)
|
294
|
+
U_x_vec,U_y_vec = U_turbulence(batch_turb,dt,epsilon,H_f,k,turb_type,U_x_vec,U_x_dif,U_y_vec,U_y_dif,z,z_0)
|
291
295
|
U_x_dif = (U_x_vec-U_bp[:,0])
|
292
296
|
U_y_dif = (U_y_vec-U_bp[:,1])
|
293
297
|
U_x_sign = np.sign(U_x_dif)
|
@@ -297,7 +301,7 @@ def Flow_time_t(batch_turb, dt, epsilon, H_f, k, turb_type, U_bp, U_x_vec, U_y_v
|
|
297
301
|
|
298
302
|
def interp_mailles_mat(Delta, epsilon, H_0, H_1, index_b, k, NbX, NbY, Pos_b, t_WOLF_perc, t_Wolf_perc_insta, Ux_0, Ux_1, Uy_0, Uy_1):
|
299
303
|
"""
|
300
|
-
Determines the flow velocity and height at the body position based on the value of the cells in which the body is and the next cells in x, y and xy.
|
304
|
+
Determines the flow velocity and height at the body position based on the value of the cells in which the body is and the next cells in x, y and xy.
|
301
305
|
It is a spatial bi-linear and temporal linear interpolation.
|
302
306
|
Method described in Delhez et al. 2025, Lagrangian modelling of the drift of a victim of river drowning.
|
303
307
|
|
@@ -377,7 +381,7 @@ def interp_mailles_mat(Delta, epsilon, H_0, H_1, index_b, k, NbX, NbY, Pos_b, t_
|
|
377
381
|
# var[index_b[ind_walls,1],index_bo_x[ind_walls]] +
|
378
382
|
# var[index_bo_y[ind_walls],index_b[ind_walls,0]] +
|
379
383
|
# var[index_bo_y[ind_walls],index_bo_x[ind_walls]))
|
380
|
-
|
384
|
+
|
381
385
|
Ux_v[ind_walls] = sum_vars(Ux_0) / active_cells[ind_walls]
|
382
386
|
Uy_v[ind_walls] = sum_vars(Uy_0) / active_cells[ind_walls]
|
383
387
|
H_v[ind_walls] = sum_vars(H_0) / active_cells[ind_walls]
|
@@ -458,9 +462,9 @@ def Loading(Path_loading, Pos_b, time_b, U_b):
|
|
458
462
|
|
459
463
|
def Loop_management(progress_queue, process_id, a_RK, BC_cells, count, count_Wolf, CFL, Delta, Human_np, i_initial, n_b, n_saved, n_t, NbX, NbY, Path_Saving, Path_Wolf, Pos, Pos_b, resurface, sinking, time, time_b, time_goal, U, U_b, wanted_time, wanted_Wolf, Z_param_np):
|
460
464
|
"""
|
461
|
-
Main loop of the code. Calculates the motion of each body at each time in the loop and updates the flow when needed.
|
462
|
-
Everything is based on the array "still" which contains the index of all the bodies that need more calculations, as we work with variable time step for each body.
|
463
|
-
If a body is out of the domain, it is out of still; if a body reaches a time for which we need a save, it is out of still;
|
465
|
+
Main loop of the code. Calculates the motion of each body at each time in the loop and updates the flow when needed.
|
466
|
+
Everything is based on the array "still" which contains the index of all the bodies that need more calculations, as we work with variable time step for each body.
|
467
|
+
If a body is out of the domain, it is out of still; if a body reaches a time for which we need a save, it is out of still;
|
464
468
|
if a body reaches a time for which the flow needs to be updated, it is out of still.
|
465
469
|
|
466
470
|
:param progress_queue: Queue for progress updates.
|
@@ -516,7 +520,7 @@ def Loop_management(progress_queue, process_id, a_RK, BC_cells, count, count_Wol
|
|
516
520
|
sp = 0 + i%2
|
517
521
|
|
518
522
|
# Body position calculation at each time step
|
519
|
-
(Human_np[still,:],Pos[still,:,s],resurface[still,:],sinking[still,:],time[still],U[still,:,s]) = Body_motion(a_RK,batch_turb,CFL,Delta,epsilon,H_pre,H_post,Human_np[still,:],k,NbX,NbY,Pos[still,:,sp],resurface[still,:],sinking[still,:],time[still],t_Wolf-wanted_Wolf[count_Wolf_ini],wanted_Wolf[count_Wolf+1]-wanted_Wolf[count_Wolf_ini],t_for,U[still,:,sp],Ux_pre,Ux_post,Uy_pre,Uy_post,Z_param_np[still,:])
|
523
|
+
(Human_np[still,:],Pos[still,:,s],resurface[still,:],sinking[still,:],time[still],U[still,:,s]) = Body_motion(a_RK,batch_turb,CFL,Delta,epsilon,H_pre,H_post,Human_np[still,:],k,NbX,NbY,Pos[still,:,sp],resurface[still,:],sinking[still,:],time[still],t_Wolf-wanted_Wolf[count_Wolf_ini],wanted_Wolf[count_Wolf+1]-wanted_Wolf[count_Wolf_ini],t_for,U[still,:,sp],Ux_pre,Ux_post,Uy_pre,Uy_post,Z_param_np[still,:])
|
520
524
|
index = np.floor_divide(Pos[:, :2, s], Delta[:2]).astype(int)
|
521
525
|
still = np.where((time < t_for) & (time < t_Wolf) & (~np.any(np.all(index[:, None] == BC_cells, axis=2), axis=1)))[0]
|
522
526
|
|
@@ -567,7 +571,7 @@ def Loop_management(progress_queue, process_id, a_RK, BC_cells, count, count_Wol
|
|
567
571
|
|
568
572
|
# pbar.update(int(time[0] - pbar.n))
|
569
573
|
i += 1
|
570
|
-
|
574
|
+
|
571
575
|
return Pos_b,resurface,sinking,time_b,U_b
|
572
576
|
|
573
577
|
def Motion_equations(CAM, CDA, CLA, CSA, dt, du_insta, m_b, mu, U_bp, U_x_dif, U_x_sign, U_y_dif, U_y_sign, V_b, vertical):
|
@@ -599,7 +603,7 @@ def Motion_equations(CAM, CDA, CLA, CSA, dt, du_insta, m_b, mu, U_bp, U_x_dif, U
|
|
599
603
|
|
600
604
|
m_added = (CAM * RHO_F * V_b).T
|
601
605
|
# m_added = ((1+CAM) * RHO_F * V_b).T
|
602
|
-
|
606
|
+
|
603
607
|
# Initialisation of the forces arrays
|
604
608
|
F_fb = zeros_n_b_3.copy()
|
605
609
|
F_g = zeros_n_b_3.copy()
|
@@ -607,7 +611,7 @@ def Motion_equations(CAM, CDA, CLA, CSA, dt, du_insta, m_b, mu, U_bp, U_x_dif, U
|
|
607
611
|
F_A = zeros_n_b_3.copy()
|
608
612
|
|
609
613
|
#Rotation matrix to apply to the hydrodynamic coefficients, see article Delhez et al., 2025 for the detail computation of the resultant matrix
|
610
|
-
angle_rel = np.arctan2(U_y_dif, U_x_dif)
|
614
|
+
angle_rel = np.arctan2(U_y_dif, U_x_dif)
|
611
615
|
angle_rel[(U_y_dif == 0) & (U_x_dif == 0)] = 0
|
612
616
|
|
613
617
|
cos_angle_rel_2 = np.cos(2*angle_rel)
|
@@ -640,7 +644,7 @@ def Motion_equations(CAM, CDA, CLA, CSA, dt, du_insta, m_b, mu, U_bp, U_x_dif, U
|
|
640
644
|
|
641
645
|
# Friction forces, calculation of value and direction
|
642
646
|
F_fr_tot = mu * np.abs(Forces_but_friction[:,2]) * (Forces_but_friction[:,2]<0) #mu depends on the depth (activating the friction only at the bottom)
|
643
|
-
angle = np.arctan2(U_bp[:,1], U_bp[:,0])
|
647
|
+
angle = np.arctan2(U_bp[:,1], U_bp[:,0])
|
644
648
|
angle[(U_bp[:, 1] == 0) & (U_bp[:, 0] == 0)] = np.arctan2(Forces_but_friction[(U_bp[:, 1] == 0) & (U_bp[:, 0] == 0), 1], Forces_but_friction[(U_bp[:, 1] == 0) & (U_bp[:, 0] == 0), 0]) #Force the angle to be 0 also when both speed are -0.0 which gives -pi by convention
|
645
649
|
cos_angle = np.abs(np.cos(angle))# + 1*(angle*180/pi==90)
|
646
650
|
sin_angle = np.abs(np.sin(angle))# + 1*(angle*180/pi==0)
|
@@ -713,9 +717,9 @@ def Preparation_parallelisation(progress_queue, a_RK, BC_cells, count, count_Wol
|
|
713
717
|
end_idx = (i + 1) * chunk_size if i != n_parallel - 1 else n_b # Prend tout jusqu'à la fin au dernier
|
714
718
|
|
715
719
|
# Préparation des arguments pour chaque processus avec sous-vecteurs
|
716
|
-
task = (progress_queue,i,a_RK,BC_cells, count,count_Wolf, CFL, Delta, Human_np[start_idx:end_idx,:], i_initial, chunk_size, n_saved, n_t, NbX, NbY,
|
717
|
-
Path_saving,Path_Wolf, Pos[start_idx:end_idx,:,:], Pos_b[start_idx:end_idx,:,:], resurface[start_idx:end_idx],
|
718
|
-
sinking[start_idx:end_idx,:], time[start_idx:end_idx], time_b[start_idx:end_idx,:], time_goal,
|
720
|
+
task = (progress_queue,i,a_RK,BC_cells, count,count_Wolf, CFL, Delta, Human_np[start_idx:end_idx,:], i_initial, chunk_size, n_saved, n_t, NbX, NbY,
|
721
|
+
Path_saving,Path_Wolf, Pos[start_idx:end_idx,:,:], Pos_b[start_idx:end_idx,:,:], resurface[start_idx:end_idx],
|
722
|
+
sinking[start_idx:end_idx,:], time[start_idx:end_idx], time_b[start_idx:end_idx,:], time_goal,
|
719
723
|
U[start_idx:end_idx,:,:], U_b[start_idx:end_idx,:,:], wanted_time, wanted_Wolf, Z_param_np[start_idx:end_idx,:])
|
720
724
|
TASKS.append(task)
|
721
725
|
|
@@ -811,13 +815,13 @@ def Skinfold(n_b, known, Human):
|
|
811
815
|
ind_40_m = np.where((Human.Age.to_numpy()<=40)&(Human.Age.to_numpy()>30) & (Human.gender.to_numpy()==1))
|
812
816
|
ind_50_m = np.where((Human.Age.to_numpy()<=50)&(Human.Age.to_numpy()>40) & (Human.gender.to_numpy()==1))
|
813
817
|
ind_max_m = np.where((Human.Age.to_numpy()>50) & (Human.gender.to_numpy() ==1))
|
814
|
-
|
818
|
+
|
815
819
|
ind_20_w = np.where((Human.Age.to_numpy()<=20) & (Human.gender.to_numpy()==2))
|
816
820
|
ind_30_w = np.where((Human.Age.to_numpy()<=30)&(Human.Age.to_numpy()>20) & (Human.gender.to_numpy()==2))
|
817
821
|
ind_40_w = np.where((Human.Age.to_numpy()<=40)&(Human.Age.to_numpy()>30) & (Human.gender.to_numpy()==2))
|
818
822
|
ind_50_w = np.where((Human.Age.to_numpy()<=50)&(Human.Age.to_numpy()>40) & (Human.gender.to_numpy()==2))
|
819
823
|
ind_max_w = np.where((Human.Age.to_numpy()>50) & (Human.gender.to_numpy() ==2))
|
820
|
-
|
824
|
+
|
821
825
|
ind_20 = np.where(Human.Age.to_numpy()<=24)
|
822
826
|
ind_30 = np.where((Human.Age.to_numpy()<=34)&(Human.Age.to_numpy()>24))
|
823
827
|
ind_40 = np.where((Human.Age.to_numpy()<=44)&(Human.Age.to_numpy()>34))
|
@@ -825,45 +829,45 @@ def Skinfold(n_b, known, Human):
|
|
825
829
|
ind_60 = np.where((Human.Age.to_numpy()<=64)&(Human.Age.to_numpy()>54))
|
826
830
|
ind_70 = np.where((Human.Age.to_numpy()<=74)&(Human.Age.to_numpy()>64))
|
827
831
|
ind_max = np.where(Human.Age.to_numpy()>74)
|
828
|
-
|
832
|
+
|
829
833
|
BMI_25 = [20, 21.3, 22.5, 23.3, 22.9, 23.7, 23.1]
|
830
834
|
BMI_50 = [21.7, 23.4, 24.8, 25.7, 25.9, 26.3, 25.3]
|
831
835
|
BMI_75 = [24.3, 26.4, 28, 29, 29.1, 29.7, 28]
|
832
836
|
|
833
|
-
|
837
|
+
|
834
838
|
change = [ind_20,ind_30,ind_40,ind_50,ind_60,ind_70,ind_max]
|
835
839
|
|
836
840
|
ind_Age = np.minimum(math.floor(np.mean(Human.Age.to_numpy())/10)-1,6)
|
837
841
|
|
838
842
|
if known == 0:
|
839
|
-
|
843
|
+
|
840
844
|
for i in range(7):
|
841
845
|
ind = np.array((change[i]))
|
842
846
|
(aBMI,bBMI) = known_1(3,16,40,BMI_25[i],BMI_50[i],0.25,0.5)
|
843
847
|
Human.loc[ind[0,:],'BMI'] = rnd.beta(aBMI,bBMI,size=(len(ind[:][0])))*(40-16)+16
|
844
|
-
|
848
|
+
|
845
849
|
error_perc_fat = (rnd.beta(2,2,size=(n_b))*(2*std_perc_fat_m[ind_Age]+2*std_perc_fat_m[ind_Age])-2*std_perc_fat_m[ind_Age])*(Human.gender.to_numpy()==1) + (rnd.beta(2,2,size=(n_b))*(2*std_perc_fat_w[ind_Age]+2*std_perc_fat_w[ind_Age])-2*std_perc_fat_w[ind_Age])*(Human.gender.to_numpy()==2)
|
846
|
-
|
850
|
+
|
847
851
|
Human.loc[:,'mass'] = Human.BMI * Human.height**2
|
848
|
-
|
852
|
+
|
849
853
|
perc_fat = -32.515 + 12.409*(Human.gender.to_numpy()-1) + 3.306*Human.BMI.to_numpy() - 0.03*Human.BMI.to_numpy()**2 - 0.006*Human.Age.to_numpy() + 0.033*Human.Age.to_numpy()*(Human.gender.to_numpy()-1) - 0.001*Human.Age.to_numpy()*Human.BMI.to_numpy() #Meeuwsen et al
|
850
854
|
perc_fat = perc_fat*(perc_fat+error_perc_fat<45) + (perc_fat-(perc_fat+error_perc_fat-45-random.randint(-100,200))/100)*(perc_fat+error_perc_fat>=45)
|
851
855
|
perc_fat = np.maximum(perc_fat+error_perc_fat,8)
|
852
856
|
Human.rho = 4.95/(perc_fat/100+4.5) * 1000#Siri's equation
|
853
857
|
Human.Volume = Human.mass/Human.rho
|
854
|
-
|
858
|
+
|
855
859
|
else: #if known != 3:
|
856
860
|
|
857
861
|
ind_Age = np.minimum(math.floor(np.mean(Human.Age.to_numpy())/10)-1,6)
|
858
862
|
|
859
863
|
error_perc_fat = rnd.beta(2,2,size=(n_b))*(2*std_perc_fat_m[ind_Age]+2*std_perc_fat_m[ind_Age])-(2*std_perc_fat_m[ind_Age])*(Human.gender.to_numpy()==1) + (rnd.beta(2,2,size=(n_b))*(2*std_perc_fat_w[ind_Age]+2*std_perc_fat_w[ind_Age])-2*std_perc_fat_w[ind_Age])*(Human.gender.to_numpy()==2)
|
860
|
-
|
864
|
+
|
861
865
|
perc_fat = -32.515 + 12.409*(Human.gender.to_numpy()-1) + 3.306*Human.BMI.to_numpy() - 0.03*Human.BMI.to_numpy()**2 - 0.006*Human.Age.to_numpy() + 0.033*Human.Age.to_numpy()*(Human.gender.to_numpy()-1) - 0.001*Human.Age.to_numpy()*Human.BMI.to_numpy() #Meeuwsen et al
|
862
866
|
perc_fat = perc_fat*(perc_fat+error_perc_fat<45) + (perc_fat-(perc_fat+error_perc_fat-45-random.randint(-100,200))/100)*(perc_fat+error_perc_fat>=45)
|
863
867
|
perc_fat = np.maximum(perc_fat+error_perc_fat,8)
|
864
868
|
Human.rho = 4.95/(perc_fat/100+4.5) * 1000;#Siri's equation
|
865
869
|
Human.Volume = Human.mass.to_numpy()/Human.rho.to_numpy()
|
866
|
-
|
870
|
+
|
867
871
|
return Human,error_perc_fat
|
868
872
|
|
869
873
|
def state_of_run(progress_queue, frame, interval):
|
@@ -886,7 +890,7 @@ def state_of_run(progress_queue, frame, interval):
|
|
886
890
|
continue # Pas de mise à jour dispo, on continue
|
887
891
|
except (EOFError, BrokenPipeError):
|
888
892
|
break
|
889
|
-
|
893
|
+
|
890
894
|
# Close window when all processes are done
|
891
895
|
# if all(value is not None for value in progress_dict.values()):
|
892
896
|
# wx.CallAfter(frame.Close) # Close the frame after all tasks are complete
|
@@ -921,7 +925,7 @@ def U_turbulence(batch, dt, epsilon, H, k, turb_type, U_x, U_x_dif, U_y, U_y_dif
|
|
921
925
|
|
922
926
|
mask_zero = (H >= 0) & (z >= 0)
|
923
927
|
|
924
|
-
U_shear_x[mask_zero] = np.abs(U_x[mask_zero])*n*np.sqrt(9.81)/(H[mask_zero]**(1/6)) #based on the combination of Manning equation and definition of bed shear stress and shear velocity
|
928
|
+
U_shear_x[mask_zero] = np.abs(U_x[mask_zero])*n*np.sqrt(9.81)/(H[mask_zero]**(1/6)) #based on the combination of Manning equation and definition of bed shear stress and shear velocity
|
925
929
|
U_shear_y[mask_zero] = np.abs(U_y[mask_zero])*n*np.sqrt(9.81)/(H[mask_zero]**(1/6))
|
926
930
|
|
927
931
|
U_x_sign[mask_zero] = np.sign(U_x[mask_zero])
|
@@ -977,7 +981,7 @@ def U_turbulence(batch, dt, epsilon, H, k, turb_type, U_x, U_x_dif, U_y, U_y_dif
|
|
977
981
|
|
978
982
|
#U_y_shear = (U_y / factor) * ln_z_z0 #Log law of the wall
|
979
983
|
K_H = 0.6*H*np.abs(U_shear_y)#np.abs(U_y_shear) #Turbulent diffusion coefficient (or turbulent diffusivity coefficient)
|
980
|
-
U_y_turb = R*np.sqrt(2*K_H*dt)
|
984
|
+
U_y_turb = R*np.sqrt(2*K_H*dt)
|
981
985
|
U_y = U_shear_y/ kappa * ln_z_z0 + U_y_turb/dt
|
982
986
|
|
983
987
|
elif turb_type ==3: #See Bocksell & Loth (2001), Eqs. 16 to 21, based on k-eps
|
@@ -995,7 +999,7 @@ def U_turbulence(batch, dt, epsilon, H, k, turb_type, U_x, U_x_dif, U_y, U_y_dif
|
|
995
999
|
C_delta = 1.6 #Table 2 of the reference
|
996
1000
|
C_mu = 0.09 #After Eq. 17 of reference
|
997
1001
|
C_tau = 0.27 #Table 2 of the reference
|
998
|
-
|
1002
|
+
|
999
1003
|
Delta = np.array([C_c_x,C_c_y])*C_delta*C_mu**(3/4)*(k**(3/2)/epsilon) #Eq. 17
|
1000
1004
|
|
1001
1005
|
tau_delta = C_tau*eps_01_09*(k/epsilon) #Eq. 17
|
@@ -1013,7 +1017,3 @@ def U_turbulence(batch, dt, epsilon, H, k, turb_type, U_x, U_x_dif, U_y, U_y_dif
|
|
1013
1017
|
##At this time, compatible only with Wolf CPU because no k-eps given by GPU
|
1014
1018
|
|
1015
1019
|
return U_x,U_y
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
wolfhece/wolf_array.py
CHANGED
@@ -9468,11 +9468,20 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
9468
9468
|
'classic']='scipyfft',
|
9469
9469
|
inplace:bool=True) -> "WolfArray":
|
9470
9470
|
"""
|
9471
|
-
Convolve the array with a filter
|
9471
|
+
Convolve the array with a filter.
|
9472
|
+
|
9473
|
+
The array and the filter should have the same dtype. If not, a warning is issued and the array dtype is used.
|
9474
|
+
|
9475
|
+
Thus:
|
9476
|
+
|
9477
|
+
- An int8 array convolved with float32 filter will be converted to int8.
|
9478
|
+
- A float32 array convolved with int8 filter will be converted to float32.
|
9479
|
+
|
9480
|
+
**User should be careful with the dtype of both the array AND the filter.**
|
9472
9481
|
|
9473
9482
|
:param filter: filter to convolve with
|
9474
9483
|
:param method: method to use for convolution ('scipyfft', 'jaxfft', 'classic')
|
9475
|
-
:param inplace: if True, the array is modified in place, otherwise a new array is returned
|
9484
|
+
:param inplace: if True, the array is modified in place, otherwise a new array is returned -- same type as the original one
|
9476
9485
|
:return: convolved array, WolfArray instance
|
9477
9486
|
|
9478
9487
|
"""
|
@@ -9487,6 +9496,10 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
9487
9496
|
logging.error("Filter must be a WolfArray or a numpy array")
|
9488
9497
|
return None
|
9489
9498
|
|
9499
|
+
if self.dtype != _filter.dtype:
|
9500
|
+
logging.warning(_("Filter and array should have the same dtype - {} - {}").format(self.dtype, _filter.dtype))
|
9501
|
+
logging.warning(_("Convolution result will have the dtype - {}").format(self.dtype))
|
9502
|
+
|
9490
9503
|
if method == 'classic':
|
9491
9504
|
from scipy.signal import convolve2d
|
9492
9505
|
convolved = convolve2d(self.array.data, _filter, mode='same', fillvalue=0.0)
|
@@ -9508,7 +9521,7 @@ class WolfArray(Element_To_Draw, header_wolf):
|
|
9508
9521
|
self.array.data[:,:] = convolved
|
9509
9522
|
return self
|
9510
9523
|
else:
|
9511
|
-
newWolfArray = WolfArray(mold=self)
|
9524
|
+
newWolfArray = WolfArray(mold=self, whichtype=self.wolftype)
|
9512
9525
|
newWolfArray.array.data[:,:] = convolved
|
9513
9526
|
newWolfArray.array.mask[:,:] = self.array.mask[:,:]
|
9514
9527
|
newWolfArray.count()
|
@@ -16,7 +16,7 @@ wolfhece/PyPalette.py,sha256=k9b_95GYD0USQ8DS5zGXeZ577712U6772kmhEbJtlXw,35406
|
|
16
16
|
wolfhece/PyParams.py,sha256=Dh9C_WYICMjo3m9roRySsu8ZgFzzYhSr6RpbaXZni0M,99423
|
17
17
|
wolfhece/PyPictures.py,sha256=m1kY0saW6Y9Q0bDCo47lW6XxDkBrbQG-Fd8uVn8G5ic,2514
|
18
18
|
wolfhece/PyTranslate.py,sha256=4appkmNeHHZLFmUtaA_k5_5QL-5ymxnbVN4R2OblmtE,622
|
19
|
-
wolfhece/PyVertex.py,sha256=
|
19
|
+
wolfhece/PyVertex.py,sha256=WboSqzI0fYI7wLk-jtgQ0ykX5QBKuVJuoavc8NnjEoo,46593
|
20
20
|
wolfhece/PyVertexvectors.py,sha256=0lt0YyHIz_IxgXqdqPlTDruDwjeP6L1Dw6B2Q35a8kQ,325801
|
21
21
|
wolfhece/PyWMS.py,sha256=LWkQk3R7miiVal-n5K5P5ClSQJA_vi5ImBxYGuxCx9A,9122
|
22
22
|
wolfhece/RatingCurve.py,sha256=bUjIrQjvIjkD4V-z8bZmA6pe1ILtYNM0-3fT6YUY1RU,22498
|
@@ -24,7 +24,7 @@ wolfhece/RatingCurveData.py,sha256=5UvnIm89BwqjnEbLCcY3CA8WoFd_xHJbooNy62fX5iY,5
|
|
24
24
|
wolfhece/RatingCurve_xml.py,sha256=cUjReVMHFKtakA2wVey5zz6lCgHlSr72y7ZfswZDvTM,33891
|
25
25
|
wolfhece/ReadDataDCENN.py,sha256=vm-I4YMryvRldjXTvRYEUCxZsjb_tM7U9yj6OaPyD0k,1538
|
26
26
|
wolfhece/Results2DGPU.py,sha256=45bLAkWvqHcw60QIP7qXyizbmS7buoDC7ndzOVfiWXg,26302
|
27
|
-
wolfhece/__init__.py,sha256=
|
27
|
+
wolfhece/__init__.py,sha256=kw2zFam1CqCH6CHgRHCZt7YXzsGaOQ-PwNkIi_E2H-Y,272
|
28
28
|
wolfhece/_add_path.py,sha256=nudniS-lsgHwXXq5o626XRDzIeYj76GoGKYt6lcu2Nc,616
|
29
29
|
wolfhece/analyze_vect.py,sha256=3lkMwaQ4KRddBVRvlP9PcM66wZwwC0eCmypP91AW-os,6015
|
30
30
|
wolfhece/cli.py,sha256=U8D7e_OezfrRfgMsa4TyQ7rI4voLKSY3RK-c8fb6rrw,3156
|
@@ -58,7 +58,7 @@ wolfhece/rain_SPWMI.py,sha256=qCfcmF7LajloOaCwnTrrSMzyME03YyilmRUOqrPrv3U,13846
|
|
58
58
|
wolfhece/textpillow.py,sha256=map7HsGYML_o5NHRdFg2s_TVQed_lDnpYNDv27MM0Vw,14130
|
59
59
|
wolfhece/tools2d_dll.py,sha256=oU0m9XYAf4CZsMoB68IuKeE6SQh-AqY7O5NVED8r9uw,13125
|
60
60
|
wolfhece/tools_mpl.py,sha256=gQ3Jg1iuZiecmMqa5Eli2ZLSkttu68VXL8YmMDBaEYU,564
|
61
|
-
wolfhece/wolf_array.py,sha256=
|
61
|
+
wolfhece/wolf_array.py,sha256=8ZM75yOInSkoJQsKaCABmgP_j2KLevO5BgxsSmvRvi8,491510
|
62
62
|
wolfhece/wolf_hist.py,sha256=7jeVrgSkM3ErJO6SRMH_PGzfLjIdw8vTy87kesldggk,3582
|
63
63
|
wolfhece/wolf_texture.py,sha256=IvFtekT5iLU2sivZOOlJXpE4CevjTQYSxHaOp4cH_wI,17723
|
64
64
|
wolfhece/wolf_tiles.py,sha256=v-HohqaWuMYdn75XLnA22dlloAG90iwnIqrgnB0ASQ4,10488
|
@@ -86,7 +86,7 @@ wolfhece/apps/curvedigitizer.py,sha256=lEJJwgAfulrrWQc-U6ij6sj59hWN3SZl4Yu1kQxVz
|
|
86
86
|
wolfhece/apps/hydrometry.py,sha256=lhhJsFeb4zGL4bNQTs0co85OQ_6ssL1Oy0OUJCzhfYE,656
|
87
87
|
wolfhece/apps/isocurrent.py,sha256=dagmGR8ja9QQ1gwz_8fU-N052hIw-W0mWGVkzLu6C7I,4247
|
88
88
|
wolfhece/apps/splashscreen.py,sha256=eCPAUYscZPWDYKBHDBWum_VIcE7WXOCBe1GLHL3KUmU,3088
|
89
|
-
wolfhece/apps/version.py,sha256=
|
89
|
+
wolfhece/apps/version.py,sha256=UGz-NV4qzN96AWCtJsnDr27SQMMZUOgYsoje1cRxP8s,387
|
90
90
|
wolfhece/apps/wolf.py,sha256=j_CgvsL8rwixbVvVD5Z0s7m7cHZ86gmFLojKGuetMls,729
|
91
91
|
wolfhece/apps/wolf2D.py,sha256=4z_OPQ3IgaLtjexjMKX9ppvqEYyjFLt1hcfFABy3-jU,703
|
92
92
|
wolfhece/apps/wolf_logo.bmp,sha256=ruJ4MA51CpGO_AYUp_dB4SWKHelvhOvd7Q8NrVOjDJk,3126
|
@@ -114,7 +114,7 @@ wolfhece/coupling/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
|
|
114
114
|
wolfhece/coupling/hydrology_2d.py,sha256=QBIcgujfOX1xX3ARF2PQz6Uqwu3j6EaRw0QlGjG_H7k,53090
|
115
115
|
wolfhece/drowning_victims/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
116
116
|
wolfhece/drowning_victims/drowning_class.py,sha256=xWr_SoFqpodQ51x2CqCRbfIiL903kk2YqIRoU35xZy0,93482
|
117
|
-
wolfhece/drowning_victims/drowning_functions.py,sha256=
|
117
|
+
wolfhece/drowning_victims/drowning_functions.py,sha256=6VP9KBqZWVfEwUcvwOErxRDaDjVNjHAZso5U_Ox1mw8,47369
|
118
118
|
wolfhece/eva/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
119
119
|
wolfhece/eva/bootstrap.py,sha256=Ys4xTDIvG_QtxCKWLYzb3_XAZU441jGX7fHIbd9Mvr0,840
|
120
120
|
wolfhece/eva/hydrogramme_mono.py,sha256=uZFIgJJ-JogMFzt7D7OnyVaHvgxCQJPZz9W9FgnuthA,8138
|
@@ -314,8 +314,8 @@ wolfhece/ui/wolf_multiselection_collapsiblepane.py,sha256=8PlMYrb_8jI8h9F0_EagpM
|
|
314
314
|
wolfhece/ui/wolf_times_selection_comparison_models.py,sha256=ORy7fz4dcp691qKzaOZHrRLZ0uXNhL-LIHxmpDGL6BI,5007
|
315
315
|
wolfhece/wintab/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
316
316
|
wolfhece/wintab/wintab.py,sha256=8A-JNONV6ujgsgG3lM5Uw-pVgglPATwKs86oBzzljoc,7179
|
317
|
-
wolfhece-2.2.
|
318
|
-
wolfhece-2.2.
|
319
|
-
wolfhece-2.2.
|
320
|
-
wolfhece-2.2.
|
321
|
-
wolfhece-2.2.
|
317
|
+
wolfhece-2.2.7.dist-info/METADATA,sha256=L3cl2QpOoOfUeWa8ox5Y41HslP4ad6In6xbQi1Ydk5U,2744
|
318
|
+
wolfhece-2.2.7.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
|
319
|
+
wolfhece-2.2.7.dist-info/entry_points.txt,sha256=ZZ-aSfbpdcmo-wo84lRFzBN7LaSnD1XRGSaAKVX-Gpc,522
|
320
|
+
wolfhece-2.2.7.dist-info/top_level.txt,sha256=EfqZXMVCn7eILUzx9xsEu2oBbSo9liWPFWjIHik0iCI,9
|
321
|
+
wolfhece-2.2.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|