pyCGM2.Utils#
files functions#
|
Concatenate multiple Excel files into a single Excel file. |
|
Copy and paste a file from a source to a destination. |
|
Copy and paste a directory from a source to a destination. |
|
Copy a session folder, optionally including only selected files. |
|
Create a new directory. |
|
Delete a directory. |
|
Retrieve all C3D files from a directory, optionally filtering by text within filenames. |
|
Extract the directory path from a full path. |
|
Get all subdirectories within a folder. |
|
Get the creation date of a file. |
|
Extract the filename from a full path. |
|
Retrieve all files with a specific extension from a directory. |
|
Retrieve marker weights for kinematic fitting from a specified file. |
|
Return required and optional anthropometric parameters from a given dictionary. |
|
Retrieve anthropometric data from a specified file. |
|
Retrieve CGM marker translators from a specified file. |
|
Check if a string is valid JSON. |
|
Check if a string is valid YAML. |
|
Load a pyCGM2 analysis instance from a file. |
|
Load a pyCGM2 model instance from a file. |
|
Load pyCGM2 model settings from a specified file. |
|
Load a set of anthropometric parameters (mp file). |
|
Load settings from a specified file. |
|
Open a JSON or YAML file and return its contents as a dictionary. |
|
Open a JSON file and return its contents as a dictionary. |
|
Open a serialized (pickle) file and return its contents. |
|
Open a YAML file and return its contents as a dictionary. |
|
Read a string content in JSON or YAML format and return it as a dictionary. |
|
Read an XML file and parse its contents. |
|
Rename a file. |
|
Save a pyCGM2 analysis instance to a file. |
|
Save a dictionary as a JSON file. |
|
Save a pyCGM2 model instance to a file. |
|
Save anthropometric parameters as a JSON file. |
|
Serialize an object and save it as a pickle file. |
|
Save a dictionary as a YAML file. |
|
Attempt to parse a string with a given loader and catch specific errors. |
utils functions#
|
Check if all elements in a list are similar. |
|
Get a similar element from a list. |
|
Homogenize arguments by merging positional and keyword arguments into a single dictionary. |
|
Check if a value is within a specified range. |
|
Encode a unicode variable to a specified encoding format. |
|
Convert a text string to a boolean value. |
Additional files functions#
|
count the number of directory in 'data_directory' |
|
count the number of directory containing a specific label in 'data_directory' |
|
Delete all .h5 files found in a directory and all its subdirectories, with optional logging. |
|
Return the parent directory of the given path, ensuring a trailing separator. |
|
Move a directory 'src' into the directory 'dst'. |
|
Move a file from a source to a destination. |
Additional utils functions#
|
A class for converting frame numbers between point and analog data formats. |
|
clean spacing in a string |
|
extract number from a string |
|
Check that a name strictly follows the |
|
remove duplicated item from a list |
|
Calculate the time range for a given set of values. |
Readers#
|
Reader of cell values of an Excel workbook (computed values). |
|
Check if a string is valid JSON. |
|
Check if a string is valid YAML. |
|
Open a JSON or YAML file and return its contents as a dictionary. |
|
Open a JSON file and return its contents as a dictionary. |
|
Open a YAML file and return its contents as a dictionary. |
|
Attempt to parse a string with a given loader and catch specific errors. |
Prettifier#
|
Dict factory for regex and corresponding substitution expression. |
|
Apply multiple regex substitutions to a string. |
|
Restore inline HTML tag format of BeautifulSoup.prettify() output. |
|
Prettify XML with intelligent inline tags. |
Timer#
|
A quick tic-toc timer, used as a context manager. |
Visualisation#
|
Append the origin and axes of a frame as constant points to an acquisition. |
Testing utilities#
|
Assert that a value equals a Vicon offset (degrees) stored in the PROCESSING metadata. |
|
Assert that two points of an acquisition are almost equal. |
|
Assert that the rms difference between two points of an acquisition is below a threshold. |
|
Assert that a point is almost equal in two acquisitions. |
|
Assert that the rms difference of a point between two acquisitions is below a threshold. |
|
Log a value and the corresponding Vicon offset (degrees) stored in the PROCESSING metadata. |
|
Plot the three components of a point and of its suffixed version. |
|
Plot the three components of two arrays. |
|
Plot the joint moments of a side for two output suffixes. |
|
Plot the joint forces of a side for two output suffixes. |