Utils

Utils functions

source

multiple_targets

 multiple_targets ()

This function determines if the there are multiple target subject by examining the directories within the target path.If there are multiple target directories, it returns a list of the target subjects’ names


source

read_k_file

 read_k_file (path_to_file:str)

Reads the *NODES from a .k/.key file, extracting node IDs and x, y, and z coordinates. It returns a DataFrame with columns labeled as ‘Label - node id’, ‘x’, ‘y’, and ‘z’

Type Details
path_to_file str File to read
Returns DataFrame Dataframe of shape [n_nodes, [ID,x,y,z]]
read_k_file("mesh.key")

source

read_csv_file

 read_csv_file (path_to_file:str)

This function read .csv files in format [id, x, y,z] and coverts it to DataFrame

Type Details
path_to_file str File to read.
Returns DataFrame Dataframe of columns are id, x, y,z
df = read_csv_file("landmarks.csv")

source

read_xml_file

 read_xml_file (path_to_file:str)

This function read .xml files in format [id, x, y,z] and coverts it to DataFrame. It divides the second column into separate x y z. This function was developed for a specific case.

Type Details
path_to_file str File to read [label, x y z]
Returns DataFrame Dataframe of columns are id, x, y,z

source

from_df_to_np

 from_df_to_np (df:pandas.core.frame.DataFrame)

This function transform a pd.Dataframe of shape [ID, x,y,z] to numpy array of coordinates [x,y,z]

Type Details
df DataFrame Dataframe
Returns ndarray numpy array

source

to_ls_dyna

 to_ls_dyna (number)

This function write coordinates according to LS-DYNA formatting. Coordinates of nodes requires 16 digit.

to_ls_dyna(6.8)
'        6.800000'