wolfhece.drowning_victims.drowning_class

Module Contents

wolfhece.drowning_victims.drowning_class.COLUMN_Z_PARAM = ['vertical', 'U_z', 'z_0', 'mu_stat', 'Time_float', 'T_w', 'ADD', 'ADD_resurface'][source]
wolfhece.drowning_victims.drowning_class.COLUMNS_HUMAN = ['Age', 'BMI', 'BSA', 'CAM', 'CDA', 'CLA', 'Death', 'dm', 'eps', 'fp_x', 'fp_y', 'fp_z',...[source]
class wolfhece.drowning_victims.drowning_class.Drowning_victim(Path_dir: str = None)[source]
Default_values()[source]

Sets the default values for each parameter by creating a first parameter.param

victim()[source]

Definition of the victim’s caracteristics

gender : Gender of the victim, 1 for man, 2 for women Age : Age of the victim in years height : Height of the victim in m mass : Mass of the victim in kg BMI : BMI of the victim in kg/m² clothes : clothing type of the victim (0 for naked, 1 for summer clothes, 2 for spring clothes, 3 for winter clothes) T_w : Average water temperature in °C ini_drowning : Time at which the victim drowned in the day (format 24H)

from_attributes_to_dictionnary()[source]

Create a dictionnary from the attributes of the class

from_dictionnary_to_attributes()[source]

Update the attributes of the class based on the values in self.param_dict.

from_dot_param_to_dictionnary(store_dir: pathlib.Path = None)[source]

Update the parameters with the modifications made by the user with the file parameters.param

Parameters:

store_dir – directory where the file parameters.param is

Human_generation()[source]

Generates the bodies for the simulation

:return Human

Attributes: Human : Dataframe panda with each line representing a body and n_b lines, so one for eahc body gender : Gender of the victim, 1 for man, 2 for women Age : Age of the victim in years height : Height of the victim in m mass : Mass of the victim in kg BMI : BMI of the victim in kg/m² clothes : clothing type of the victim (0 for naked, 1 for summer clothes, 2 for spring clothes, 3 for winter clothes) CAM : Added mass coefficient of the body CDA : Drag area of the body (drag coefficient * a reference area) CLA : Lift area of the body CSA : Side area of the body fp_x : Projection coefficient along the x-axis to go from the BSA to the frontal area fp_y : Projection coefficient along the y-axis to go from the BSA to the frontal area fp_z : Projection coefficient along the z-axis to go from the BSA to the frontal area lungs_volume_TLC : Lungs volume at Total Lungs Capacity lungs_volume_FRC : Lungs volume at Functionnal Residual Capacity (at rest, after normally expiring) dm : Amount of swallowed water BSA : Body surface area (i.e. surface of the skin) Death : Type of death eps : Width of the body V_clothes_o : Initial volume of clothes (according to Barwood et al., 2011) V_clothes_one : Volume of clothes after 20min at rest (according to Barwood et al., 2011) V_clothes_two : Volume of clothes after 20min of swimming (according to Barwood et al., 2011) error_perc_fat : Deviation to the average on the percentage body fat of the body calculated from the equation of Siri et al. 1960

Initialisation_arrays()[source]

Function where the matrixes of body position, speed, time, resurfacing and sinking are initialised, both for computing and saving Initialisation of other variables used in the simulation

Attributes:

BC_cells : Array containing the index of all cells that are boundary conditions for the hydrodynamic simulation DT_WOLF : Time step of the WOLF simulation NbX : Number of cells in the x-direction for the WOLF simulation NbY : Number of cells in the y-direction for the WOLF simulation ini_drowning : Hour at which the victim fell in the water count_Wolf : Time step of the Wolf simulation that we consider as our initial time in the Lagrangian simulation wanted_Wolf : Array containing all the times at which we have a new Wolf result Delta : Array containing the spatial and time steps Pos : Working array containing the 3D positions of all bodies at time t and t-dt with shape (n_b,3,2) Pos_b : Saving array containing the 3D positions of all bodies at all saving times with shape (n_b,3,n_t) U : Working array containing the 3D velocities of all bodies at time t and t-dt with shape (n_b,3,2) U_b : Saving array containing the 3D velocities of all bodies at all saving times with shape (n_b,3,n_t) time : Working array containing the time associated to each body with shape (n_b,) resurface : Saving array containing the resurfacing time of all bodies with shape (n_b,) sinking : Saving array containing the sinking time of all bodies with shape (n_b,) count : Counter to evaluate the progression of the savings sp : Parameter deserving to work with the working variables

start()[source]

Main of the class, runs the code with a parallelised code (n_parallel>1) or without

Parallel_loop()[source]

Necessary for the parallelisation as we have to give a list of arguments to the function instead of all the args separately

class wolfhece.drowning_victims.drowning_class.Drowning_victim_Viewer(idx='', plotted=True, mapviewer=None, need_for_wx=False, filedir=None)[source]

Bases: wolfhece.drawing_obj.Element_To_Draw

Inheritance diagram of wolfhece.drowning_victims.drowning_class.Drowning_victim_Viewer

Base class of element to add into WolfMapViewer or another GUI

filename = None[source]
filedir = None[source]
file_drowning = None[source]
n_peaks = 2[source]
newdrowning[source]
selection_drowning_point(event)[source]

Function to select the drowning point in the viewer

selection_progress(event)[source]

Function to select the drowning point in the viewer

update_drowning_pos()[source]

Update the values of “X-cell” and “Y-cell” in the parameters.param file.

create_exe_file(event)[source]

Start the drowning in a separate process

run_code(event)[source]
show_properties()[source]

Generic function to show properties of the object

from_dictionnary_to_wp()[source]

Return a Wolf_Param object that represents the parameters of the simulation, directly using the attributes of the class.

from_wp_to_dictionnary()[source]

Compare the parameters in self.wp with self.newdrowning.param_dict and update the values in self.newdrowning.param_dict when they differ.

hide_properties()[source]

Hide properties window

save()[source]

Save the parameters in a text file

saveas()[source]

Save the parameters in a text file

load_results()[source]

Load the results from the ‘Results.npz’ file and assign the arrays as attributes of the class.

init_plot()[source]
read_oneresult(idx)[source]

Read one result of the simulation and update the parameters in the GUI

read_last_result()[source]

Read the last results of the simulation and update the parameters in the GUI

find_minmax(update=False)[source]

Generic function to find min and max spatial extent in data

examplea WolfMapViewer instance needs spatial extent to zoom or test if

element must be plotted

plot(sx=None, sy=None, xmin=None, ymin=None, xmax=None, ymax=None, size=None)[source]

Plot data in OpenGL context

sort_positions_bodies()[source]
prepare_plot_runs_positions()[source]

Plot the runs position on a georeferenced map with bodies in blue being at the bottom and red being at the surface.

reset_plot_runs_positions()[source]
kde_on_grid(points, bandwidth, xmin, xmax, ymin, ymax, grid_size)[source]

Function used to calculate the kde on a point cloud. Use a large grid size to identify peaks and a small one to refine

detect_peaks(x, y, radius, num_peaks=2)[source]

Détecte les pics locaux dans une matrice 2D sans skimage.

param: x X coordinate of the points cloud param: y Y coordinate of the points cloud param: radius size of the grid to detect peaks param: n_peaks number of peaks to detect

kde_refined_based_coarse(points, wolfarray, bandwidth=50, coarse_grid_size=50, fine_grid_size=5, window_size=200, radius=150, n_peaks=3)[source]

Optimisation à 2 étages : détection des pics sur grille grossière puis raffinement local.

Returns: - refined_peaks : coordonnées des pics raffinés - clusters : liste de points pour chaque cluster - coords : coordonnées (x, y) de chaque maille dans les zones raffinées - values : valeur KDE associée à chaque maille

prepare_plot_kde()[source]

Plot the kernel density estimation of positions on a georeferenced map with bodies in blue being at the bottom and red being at the surface.

reset_plot_kde()[source]
prepare_plot_cells_positions()[source]

Plot the cells of the WOLF simulation, with a colorbar associated to the number of elements in the cell

reset_plot_cells_positions()[source]
zoom_on_hotspots(memory_view)[source]

Zoom on the hotspots of the KDE

get_bodies_characteristics()[source]

Plots a table of the Dataframe panda “Human” with the characteristics of each run

get_vertical_position_proportion()[source]

Gives the proportion of bodies at the surface and at the bottom of the water

class wolfhece.drowning_victims.drowning_class.ProgressBar(parent, n_processes, total)[source]

Bases: wx.Frame

Inheritance diagram of wolfhece.drowning_victims.drowning_class.ProgressBar

Creates and manages the progress frame

n_processes[source]
total[source]
progress_bars[source]
progress_text[source]
update_progress(progress_dict)[source]

Update the progress bars based on the values in progress_dict.

class wolfhece.drowning_victims.drowning_class.ProgressImage(n_processes, total, *args, **kw)[source]

Bases: wx.Frame

Inheritance diagram of wolfhece.drowning_victims.drowning_class.ProgressImage

Creates and manages the progress frame with a fractioned image appearance

n_processes[source]
total_segments[source]
total[source]
image_path = ''[source]
image_segments = [][source]
update_progress(progress_dict)[source]

Update the visibility of image segments based on the progress.